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,492
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: 185
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,221
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,492
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
  • No one is chatting at the moment.
  • K3Nv2 @ K3Nv2:
    why
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, it's not funny
  • K3Nv2 @ K3Nv2:
    ok
  • BigOnYa @ BigOnYa:
    Wut?
  • K3Nv2 @ K3Nv2:
    That's not funny
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    So two cannibals where eating a clown and one says to the other. Hey does this taste funny to you?
    +2
  • K3Nv2 @ K3Nv2:
    What do you call a slow car? Retired
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Did you hear about the police car that someone stole the wheels off of? The police are working tirelessly to find the thieves.
    +2
  • K3Nv2 @ K3Nv2:
    A firefighter got arrested for assault his main claim was what I was told he was on fire
    +2
  • BigOnYa @ BigOnYa:
    What do you call a hooker with a runny nose? Full
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    What do you tell a woman with two black eyes? Nothing you already told her twice!
  • K3Nv2 @ K3Nv2:
    Diddy also works
  • K3Nv2 @ K3Nv2:
    A scientist heard the word batman so he put a naked lady in a cage with a bat
  • Psionic Roshambo @ Psionic Roshambo:
    Chuck Norris won a staring contest, with the sun.
  • K3Nv2 @ K3Nv2:
    A vampires favorite thing to do is moon you
  • BigOnYa @ BigOnYa:
    What's the difference between an airplane, and Ken's mom? Not everyone has been in an airplane.
  • K3Nv2 @ K3Nv2:
    What's the difference between @BigOnYa and his wife? Nothing both want to bone me
    +3
  • RedColoredStars @ RedColoredStars:
    How much wood could a wood chuck chuck if a wood chuck could chuck norris
    +1
  • BakerMan @ BakerMan:
    how do i know? you're a guy, and he wants to bone every guy on this site (maybe, idk)
    +1
  • K3Nv2 @ K3Nv2:
    He wants to bone anything with a dick
    +1
  • Xdqwerty @ Xdqwerty:
    Good night
    +1
  • BigOnYa @ BigOnYa:
    Nighty night, big day tomorrow. Congrats.
    K3Nv2 @ K3Nv2: https://www.instagram.com/reel/C7iLZ35NrQt/?igsh=MWd2Z3U0dmNlMmNxcw==