ARM9 "selected processor does not support Thumb mode"

Discussion in '3DS - Homebrew Development and Emulators' started by gudenau, Jul 6, 2015.

  1. gudenau
    OP

    gudenau Never a unique idea

    Member
    3,257
    1,224
    Jul 7, 2010
    United States
    /dev/random
    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.
     

    Attached Files:

    • svc.zip
      File size:
      8.6 KB
      Views:
      43
    Last edited by gudenau, Jul 6, 2015
  2. Normmatt

    Normmatt Former AKAIO Programmer

    Member
    2,142
    544
    Dec 14, 2004
    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"
     
    marc00077 likes this.
  3. Coto

    Coto GBAtemp Addict

    Member
    2,353
    403
    Jun 4, 2010
    Chile
    .... 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.
     
  4. gudenau
    OP

    gudenau Never a unique idea

    Member
    3,257
    1,224
    Jul 7, 2010
    United States
    /dev/random
    If I make an asm file that is complied as ARM instead of THUMB would calling it "automagicly" switch modes when calling/returing?
     
  5. Coto

    Coto GBAtemp Addict

    Member
    2,353
    403
    Jun 4, 2010
    Chile
  6. gudenau
    OP

    gudenau Never a unique idea

    Member
    3,257
    1,224
    Jul 7, 2010
    United States
    /dev/random
    Edit:
    I am a derp.