Homebrew ARM9 "selected processor does not support Thumb mode"

gudenau

Largely ignored
OP
Member
Joined
Jul 7, 2010
Messages
3,882
Trophies
2
Location
/dev/random
Website
www.gudenau.net
XP
5,427
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

  • svc.zip
    8.6 KB · Views: 184
Last edited by gudenau,

Normmatt

Former AKAIO Programmer
Member
Joined
Dec 14, 2004
Messages
2,161
Trophies
1
Age
33
Website
normmatt.com
XP
2,204
Country
New Zealand
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

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
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.
 

gudenau

Largely ignored
OP
Member
Joined
Jul 7, 2010
Messages
3,882
Trophies
2
Location
/dev/random
Website
www.gudenau.net
XP
5,427
Country
United States
.... 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

General chit-chat
Help Users
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=mA-vTRfE_x0