This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Main not called

I'm trying to get a stripped down, simple LED blinking sample to work (like blinky) when building with GCC however main() is never called. I'm guessing I'm either using the wrong startup file or missing a compiler/linker setting? I know the hex file produced from the build process is executable because if I add a call to main() from the bottom of SystemInit() in system_nrf52.c then my code is executed and the LED blinks as expected. If I replace main() with a call to _start() then my code is not executed. So it seems that _start() is not calling main() for some reason? I have not managed to find the right source for crt0.s to see what might prevent _start() from calling main().

I am using SDK 14.2 (although the problem is the same with other versions of the SDK). I am using the 2015 Q3 version of GCC as specified in the SDK release notes. I am using gcc_startup_nrf52.s I am using the linker script blinky_gcc_nrf52.ld (non SD version). I am not building with a soft device. I am not using Keil uVision.

Compiler and linker settings: -DNRF52 -DNRF52832 -DBOARD_PCA10040 -march=armv7e-m -mcpu=cortex-m4 -mthumb -mabi=aapcs -Wall -O0 -I. -IC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/device -IC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/boards -IC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/drivers_nrf/hal -IC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/drivers_nrf/delay -IC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/drivers_nrf/nrf_soc_nosd -IC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/libraries/util -IC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/toolchain -IC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/toolchain/cmsis/include -LC:/NordicSDK/nRF5_SDK_14.2.0_17b948a/components/toolchain/gcc -Tblinky_gcc_nrf52.ld

Any ideas as to what I am missing?

Thanks!

Parents
  • So did you find the solution to your problem then? Did you know that segger embedded studio (ses) is free for Nordic SDK users? The Blinky example is available in SDK 14.2 under the ble_peripheral folder/ble_app_blinky. Then, just choose your dev kit folder, choose the softdevice folder & open the ses folder. There, you can open the ses file (e.g. examples/ble_peripheral/ble_app_blinky/pca10040/s132/ses/ble_app_blinky_pca10040_s132). If you do decide to use ses, there is a great introductory playlist to getting started with ses on Nordic's Youtube channel.

Reply
  • So did you find the solution to your problem then? Did you know that segger embedded studio (ses) is free for Nordic SDK users? The Blinky example is available in SDK 14.2 under the ble_peripheral folder/ble_app_blinky. Then, just choose your dev kit folder, choose the softdevice folder & open the ses folder. There, you can open the ses file (e.g. examples/ble_peripheral/ble_app_blinky/pca10040/s132/ses/ble_app_blinky_pca10040_s132). If you do decide to use ses, there is a great introductory playlist to getting started with ses on Nordic's Youtube channel.

Children
No Data
Related