This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SAM7.s branch to main() causes SWI. Why ?

Hello.

In my SAM7.s startup file for AT91SAM7X256, the following instructions are executed:

. . .
; Enter the C code
       IMPORT  __main
       LDR     R0, =__main
      BX      R0


. . . Disassembled as follows:
0x0010011C  E24DAB01  SUB       R10,R13,#0x00000400
0x00100120  E59F0024  LDR       R0,[PC,#0x0024]
0x00100124  E12FFF10  BX        R0
0x00100128  FFFFFD00  (???)
0x0010012C  A5000401  STRGE     R0,[R0,#-0x0401]
0x00100130  FFFFFF00  (???)

This BX instruction should cause my main() to be executed next.
Instead, the PC executes/enters the SWI_Handler immediately after the BX instruction.
Is there a fundamental issue I have overseen ?
I appreciate your answers/comments to this issue.

Regards Terje Bøhler