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.

  • I use Crossworks, for which I have a personal license which wasn't very expensive (non-commerical). Crossworks can also run in limited size mode for free and Rowley (who make Crossworks) white-box it for Segger where it's called Segger Embedded Studio and is free (for non-commercial use). It's very much the same product simplified so it only supports Segger.

    There's a few blog posts on SES, one from the weekend actually. It's been in active development mode so things have been changing, but it's pretty stable now.

    If you go to the Blogs section and type 'a week with crossworks' into the search, you'll find the original post I wrote about it a couple of years ago. You have to put a little time into it, new IDEs are always like that, but when you get it, it's very easy to use and the debugging experience is superb.

Reply
  • I use Crossworks, for which I have a personal license which wasn't very expensive (non-commerical). Crossworks can also run in limited size mode for free and Rowley (who make Crossworks) white-box it for Segger where it's called Segger Embedded Studio and is free (for non-commercial use). It's very much the same product simplified so it only supports Segger.

    There's a few blog posts on SES, one from the weekend actually. It's been in active development mode so things have been changing, but it's pretty stable now.

    If you go to the Blogs section and type 'a week with crossworks' into the search, you'll find the original post I wrote about it a couple of years ago. You have to put a little time into it, new IDEs are always like that, but when you get it, it's very easy to use and the debugging experience is superb.

Children
No Data
Related