This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Moving project from Keil to Eclipse : Make fails

Hey there!

I am trying to switch from Keil to Eclipse.

I have followed several tutorials on this website (like this one) and I can easily create new eclipse project, import SDK examples, then build, flash & debug...

That was easy because "examples" are provided with a gcc section that contains a makefile.

So, I have rewritten a new makefile based on example makefiles, like this question.

All seems to work until the linking:

"C:\Program Files\GNU ARM Eclipse\Build Tools\2.8-201611221915\bin\make.exe"
rm -rf _build
echo  Makefile
 Makefile
mkdir _build
Compiling file: ble_common.c
[ ... ]
Compiling file: app_fifo.c
Compiling file: fds.c
Compiling file: fstorage.c
Compiling file: nrf_assert.c
Compiling file: sdk_mapped_flags.c
Compiling file: softdevice_handler.c
Assembly file: gcc_startup_nrf51.s
Linking target: nrf51422_xxac_s130.out
_build/gcc_startup_nrf51.o: In function `Reset_Handler':
(.text+0x34): undefined reference to `SystemInit'
_build/gcc_startup_nrf51.o: In function `Reset_Handler':
(.text+0x38): undefined reference to `__START'
collect2.exe: error: ld returned 1 exit status
Makefile:224: recipe for target 'nrf51422_xxac_s130' failed
make: *** [nrf51422_xxac_s130] Error 1

I do not clearly understand what is happening because it is a file provided in the SDK... I have not modified it. I am using the SDK v12.1.0.

To be sure that the problem was not my SDK, my example makefile or even the builder, I have done the same test on blinky:

C:\Users\***\Desktop\SDK-Test\examples\peripheral\blinky\pca10028\s130\armgcc>
"C:\Program Files\GNU ARM Eclipse\Build Tools\2.8-201611221915\bin\make.exe"
rm -rf _build
echo  Makefile
 Makefile
mkdir _build
Compiling file: system_nrf51.c
Compiling file: main.c
Compiling file: nrf_delay.c
Assembly file: gcc_startup_nrf51.s
Linking target: nrf51422_xxac_s130.out
make[1]: Entering directory 'C:/Users/***/Desktop/SDK-Test/examples/peripheral/blinky/pca10028/s130/armgcc'
Preparing: nrf51422_xxac_s130.bin
Preparing: nrf51422_xxac_s130.hex
''
   text    data     bss     dec     hex filename
   1452     108      28    1588     634 _build/nrf51422_xxac_s130.out
''
make[1]: Leaving directory 'C:/Users/***/Desktop/SDK-Test/examples/peripheral/blinky/pca10028/s130/armgcc'

On it there is no problem.

Does anyone has an idea of what I have done wrong ?

Thanks for your help!

Parents
  • It appears that the SystemInit function is in the system_nrf51.c file. Is this file missing from your Makefile?

    $(SDK_ROOT)/components/toolchain/system_nrf51.c \

    Note that in your blink example, "Compiling file: system_nrf51.c" is shown, is this missing from your main build?

    [Edit] Missed that you were building for nRF51 device.

Reply
  • It appears that the SystemInit function is in the system_nrf51.c file. Is this file missing from your Makefile?

    $(SDK_ROOT)/components/toolchain/system_nrf51.c \

    Note that in your blink example, "Compiling file: system_nrf51.c" is shown, is this missing from your main build?

    [Edit] Missed that you were building for nRF51 device.

Children
  • Hey thanks for you answer! That solves partially my problem:

    Assembly file: gcc_startup_nrf51.s
    Linking target: nrf51422_xxac_s130.out
    _build/gcc_startup_nrf51.o: In function `Reset_Handler':
    (.text+0x38): undefined reference to `__START'
    collect2.exe: error: ld returned 1 exit status
    Makefile:226: recipe for target 'nrf51422_xxac_s130' failed
    make: *** [nrf51422_xxac_s130] Error 1
    

    I have forgotten to add files that are in "device" (in Keil). The second is "amr_startup_nrf51.s". However, I am getting errors when I try to add it in C_SOURCE_FILES :

    Compiling file: system_nrf51.c
    make: *** No rule to make target '_build/arm_startup_nrf51.s', needed by 'nrf51422_xxac_s130'.  Stop.
    

    Or in ASM_SOURCE_FILES :

    Makefile:245: recipe for target '_build/arm_startup_nrf51.o' failed
    make: *** [_build/arm_startup_nrf51.o] Error 1
    
Related