main() not called from _start()

Asked by Mark Freeman on 2017-12-01

Trying to compile a very simple blinking LED C program for a bare metal Cortex M4 (Nordic nRF52832) however, main() is never reached. If I modify the startup code to call main() instead of _start() then main executes and the LED blinks as expected.

This problem occurs using V4.9.3 of the toolchain and also with the latest toolchain downloaded from ARM. However, using the custom toolchain provided with the EmBitz IDE the test program works as expected and the LED blinks?

I guess I must be missing a compiler/linker directive or linking against the wrong crto in the ARM-NONE-EABI toolchain??? I'm guessing the custom toolchain was compiled in such a way to work around this?? I'm using the following complier/linker options:


Does anyone have any ideas what could prevent _start() from calling main()?


Question information

English Edit question
GNU Arm Embedded Toolchain Edit question
No assignee Edit question
Last query:
Last reply:
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.