I’m recycling my old post since I got that problem fixed by just copying everything to a new project in Eclipse. I have no clue what was wrong. Anyway…
I’m using an Olimex LPC-P2103 and my program is based on the “lpc_p2103_UART” example that appeared in the Eclipse project list after installing the Olimex package. (Apparently using Yagarto toolchain)
I am now having the problem that any division I make is crashing.
I suspect it has to do with the fact that I am linking libgcc ( to get rid of undefined reference to ‘__udivsi3’) but it’s not the right lib.
There are 21 different search hits on “libgcc.a” under “C:\gccfd” where it installed, most of them in a subfolder of “C:\gccfd\yagarto\lib\gcc\arm-elf\4.2.2”
This is the last step before I lose control of the program.
http://img44.imageshack.us/img44/5200/n … rashes.gif
As you can see in the C-source it’s not a division-by-zero, and the next line to be called in the instruction list is the branch to __udivsi3.
Once I do that I lose the debugger and the program enters running state. When I interrupt it I find the program locked in this loop:
void UNDEF_Routine (void) {
while (1) ;
}
I see this function in crt.s
Reset_Addr: .word Reset_Handler /* defined in this module below */
Undef_Addr: .word UNDEF_Routine /* defined in main.c */
SWI_Addr: .word SWI_Routine /* defined in main.c */
PAbt_Addr: .word UNDEF_Routine /* defined in main.c */
DAbt_Addr: .word UNDEF_Routine /* defined in main.c */
I suspect the division causes a “data abort” or something similar and that triggers a jump to the UNDEF_Routine, and I think it’s because I’m linking the wrong library.
What do you think?
I read there is a problem with the LPC2000’s because there’s no floating point unit and the division call in the library won’t work properly. It was possible to build your own version of libgcc though.
There has to be a readily available library that can do this, right?
I am using Windows and wasn’t really planning on installing and building my own toolchain just for this and I am dreading there will be more problems just to get that done.
So, do you think it’s the library that causes the division to crash and is there a libgcc.a that will solve it?