Homebrew ARM9 "selected processor does not support Thumb mode"

  • Thread starter Thread starter gudenau
  • Start date Start date
  • Views Views 4,879
  • Replies Replies 5

gudenau

Largely ignored
Member
Joined
Jul 7, 2010
Messages
4,111
Reaction score
4,458
Trophies
2
Location
/dev/random
Website
www.gudenau.net
XP
7,785
Country
United States
I am attempting to create a small ARM9 application that dumps some information about the state of the processor. In order to do this I need to use the MRC instruction, but gcc seems to dislike this. From what I understand this processor should support thumb mode. What am I doing wrong?

The source is attached.
 

Attachments

Last edited by gudenau,
Your trying to call MRC from C which is compiled to THUMB by default which doesn't have that opcode. You can change your makefile to compile as ARM by default by changing this line "ARCH := -mthumb -mthumb-interwork" to "ARCH := -marm -mthumb-interwork"
 
  • Like
Reactions: marc00077
Your trying to call MRC from C which is compiled to THUMB by default which doesn't have that opcode. You can change your makefile to compile as ARM by default by changing this line "ARCH := -mthumb -mthumb-interwork" to "ARCH := -marm -mthumb-interwork"
.... or:

Code:
//code_sheet.s

.arm @or .thumb
.cpu arm7tdmi @<- replace with your ARM Core here
.text

//code

.align
.pool
.end

This tells the compiler to actually compile opcodes that, may now be defunct, such as :

SWP / SWPB
http://infocenter.arm.com/help/topic/com.arm.doc.dht0008a/CJHBGBBJ.html

That were up to armv5

http://infocenter.arm.com/help/topic/com.arm.doc.dht0008a/CJHIHDDA.html

Because of these problems, ARMv6 and later deprecate using SWP and SWPB. The Multiprocessor Extensions to ARMv7 introduce the SW bit in the CP15 System Control Register. On processors that implement these extensions, after power-up or a reset, software must set this bit to 1 to enable use of the SWP and SWPB instructions.

Which means you can't compile your code if you don't tell the compiler which CPU Core your machine code should be created for.
 
.... or:

Code:
//code_sheet.s

.arm @or .thumb
.cpu arm7tdmi @<- replace with your ARM Core here
.text

//code

.align
.pool
.end

This tells the compiler to actually compile opcodes that, may now be defunct, such as :

SWP / SWPB
http://infocenter.arm.com/help/topic/com.arm.doc.dht0008a/CJHBGBBJ.html

That were up to armv5

http://infocenter.arm.com/help/topic/com.arm.doc.dht0008a/CJHIHDDA.html



Which means you can't compile your code if you don't tell the compiler which CPU Core your machine code should be created for.
If I make an asm file that is complied as ARM instead of THUMB would calling it "automagicly" switch modes when calling/returing?
 

Site & Scene News

Popular threads in this forum