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

Linker stage fails with missing reference to _start

Hey I am trying to create a blinky project from scratch on System: MAC OSX Eclipse Neon GCC 4.9

I am trying have it eclipse managed make.

I am at a point when after the compilation during the linking stage I get this error.

Building file: ../src/system_nrf52.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -O2  -g -DBOARD_PCA10040 -DBSP_DEFINES_ONLY -DCONFIG_GPIO_AS_PINRESET -DNRF52_PAN_12 -DNRF52_PAN_15 -DNRF52_PAN_58 -DNRF52_PAN_20 -DNRF52_PAN_54 -DNRF52_PAN_31 -DNRF52_PAN_30 -DNRF52_PAN_51 -DNRF52_PAN_36 -DNRF52_PAN_53 -DNRF52_PAN_64 -DNRF52_PAN_55 -DNRF52_PAN_62 -DNRF52_PAN_63 -DNRF52 -I"/Users/bhaumik/Downloads/nRF5_SDK_12-2/examples/bsp" -I/Users/bhaumik/mac-build/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/lib/armv6-m -I"/Users/bhaumik/Downloads/nRF5_SDK_12-2" -I"/Users/bhaumik/Downloads/nRF5_SDK_12-2/components/drivers_nrf/hal" -I"/Users/bhaumik/Downloads/nRF5_SDK_12-2/components/toolchain/cmsis/include" -I"/Users/bhaumik/Downloads/nRF5_SDK_12-2/components/toolchain/gcc" -I"/Users/bhaumik/Downloads/nRF5_SDK_12-2/components/toolchain" -I"/Users/bhaumik/Downloads/nRF5_SDK_12-2/components/device" -I"/Users/bhaumik/Downloads/nRF5_SDK_12-2/components/drivers_nrf/delay" -std=gnu99 -MMD -MP -MF"src/system_nrf52.d" -MT"src/system_nrf52.o" -c -o "src/system_nrf52.o" "../src/system_nrf52.c"
Finished building: ../src/system_nrf52.c
 
Building target: Eclipse_template.elf
Invoking: Cross ARM C Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -O2  -g -T "/Users/bhaumik/Documents/workspace/Eclipse_template/blinky_gcc_nrf52.ld" -Xlinker --gc-sections -L/Users/bhaumik/Downloads/nRF5_SDK_12-2/components/toolchain/gcc -Wl,-Map,"/Users/bhaumik/Documents/workspace/Eclipse_template/debug/Eclipse_template.map" -o "Eclipse_template.elf"  ./src/gcc_startup_nrf52.o ./src/main.o ./src/system_nrf52.o   
./src/gcc_startup_nrf52.o: In function `Reset_Handler':
/Users/bhaumik/Documents/workspace/Eclipse_template/Debug/../src/gcc_startup_nrf52.s:408: undefined reference to `__START'
collect2: error: ld returned 1 exit status
make: *** [Eclipse_template.elf] Error 1

16:29:19 Build Finished (took 218ms)

I think this part of the code is part of cr0.o and it should get that automatically. I am not sure why this is happening

Can any one help. I have uploaded my code here

Parents
  • You're not reading the error message properly and hence the title of the question is wrong

    undefined reference to `__START'
    

    not _start which is defined in crt0.o (not cr0.o) but __START

    That shows that the #define in the gcc_startup_nrf52.S file hasn't been expanded in the assembly back to _start, or else you've defined __START as __START which seems unlikely. If you nm the .o file you'll see it needs the symbol __START

    and likely this all has something to do with the change from .s to .S files in SDK12, `.S files are supposed to be preprocessed before being assembled but the entire change appears to have borked various things.

    I'm actually quite surprised that gcc doesn't complain about the #defines in the .S file if it's not preprocessing it, but it's not.

  • Hello RK, Thanks for your response. Your correction are right, I do make my eclipse project compile .s file, by adding the extension as assembly file in my project properties on eclipse. However, your explanation does not help to resolve the issue. It has taken me a week to get this far with SDK v12, in your opinion should i stick with SDK v11?

Reply
  • Hello RK, Thanks for your response. Your correction are right, I do make my eclipse project compile .s file, by adding the extension as assembly file in my project properties on eclipse. However, your explanation does not help to resolve the issue. It has taken me a week to get this far with SDK v12, in your opinion should i stick with SDK v11?

Children
No Data
Related