9 years, 10 months ago.

_exit, _kill_r and _getpid_r

I would like to use Eclipse and J-Link to download LPC1768 code to a board I'm building. I've installed the software for Eclipse, J-Link and the GNU ARM compiler. I have tried importing into Eclipse several small mbed program that I've exported but without success.

I've been able to compile the source file for blinky but the linker generates some errors. 1) It couldn't find a start address and it defaulted to 0x8000; I don't know if that's a problem or not. Perhaps that's something I should define. 2) There were three unresolved references: _exit, _kill_r and _getpid_r. Could someone tell me where these symbols are defined?

Thanks in advance.

Did you export them for the GCC ARM (=using mbed makefile which is generated) ? What is your toolchain version ?

posted by Martin Kojtal 07 Jun 2014

1 Answer

8 years, 11 months ago.

This is some weird "of course it's like this - why would it be sensible?" GNU thing. Basically when you link your program you need to link libc *twice* and it needs to be before libnosys. Like this:

-l:libmbed.a -lstdc++ -lsupc++ -lm -lgcc -lc -lc -lnosys

Ideally you would put those last three in a group like this if your build system supports it:

 -Wl,--start-group -lc -lc -lnosys -Wl,--end-group

More info here: https://answers.launchpad.net/gcc-arm-embedded/+question/232833

Yes this is stupid. I wonder if clang is saner...