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

GNU _start routine generates undefined instruction exception

I am using Keil uVision 3.30a with the GNU compiler. I first tried using the GNU compiler that shipped with the debugger. A simple program appeared to work, but additional code that called sprintf (and of course brought in more library code) would die between the branch to _start at the end of Startup.s (yes, I'm using the GNU one) and my main() routine. Halting the processor showed it was stuck in Undef_Handler. Breaking at the branch to _start and stepping showed things branching 7 or so times, then hitting an SWI instruction that sent it to the undefined instruction exception vector. I noted that the date stamp on gcc was the end of 2003, so I loaded up version 4.0.2 from the gnuarm website. Once I got past the missing .dll file problem, things compiled quite nicely. However, now the crash is right after the jump to _start. The code at _start looks like so:

0x00000258 MOV R0,#0x00000016
0x0000025C ADD R1,PC,#0x000000E8
0x00000260 SWI 0x00123456
0x00000264 LDR R0,[PC,#0x00E0]
0x00000268 LDR R13,[R0,#0x0008]
0x0000026C LDR R10,[R0,#0x000C]
0x00000270 ADD R10,R10,#0x00000100

It doesn't like the SWI, which extensive Web surfing has indicated is a semihosting instruction. What the heck is semihosting, and what is it doing in the GNU binaries? I am hoping there is a compilation or configuration option I have missed that would make this thing execute happily. Any suggestions would be greatly appreciated.

Further info: I am running a purchased version of the Keil debugger and using support for calls between ARM and THUMB, compiling THUMB code, and enabling ARM/THUMB interworking. The linker map shows that the GNU libraries are fact being linked in (not some vestige of the Keil libraries from when I was running the evaluation software).

Thanks,
Kathy

0