main() not called from _start()

Asked by Mark Freeman

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:

-DNRF52
-DNRF52832
-DBOARD_PCA10040
-D__NO_SYSTEM_INIT
-mthumb
-mcpu=cortex-m4
-mfloat-abi=softfp
-mfpu=fpv4-sp-d16
-ffunction-sections
-Wall
-O0
-ffunction-sections
-fdata-sections
-fno-strict-aliasing
-fno-builtin

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

Thanks!

Question information

Language:
English Edit question
Status:
Expired
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

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