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

How to get the reference of the SoC library API?

Hello,

We are currently migrating (or trying to...) from IAR Arm Embedded to Eclipse/GCC.

I'm trying to compile our project using gcc and eclipse. I followed this tutorial : devzone.nordicsemi.com/.../

I managed to build my Makefile and link most files (with some difficulties but seems to be ok now). I am still not able to compile as some function/reference are undefined (and not found in c/h files).

See log:

C:/Users/Teeptrak/Documents/GitHub/BLE-module/library/nrf51_sdk_v810/components/drivers_nrf/pstorage/pstorage.c:597: undefined reference to 'sd_flash_write'

C:/Users/Teeptrak/Documents/GitHub/BLE-module/library/nrf51_sdk_v810/components/drivers_nrf/pstorage/pstorage.c:608: undefined reference to 'sd_flash_page_erase'

C:/Users/Teeptrak/Documents/GitHub/BLE-module/library/nrf51_sdk_v810/components/drivers_nrf/pstorage/pstorage.c:638: undefined reference to 'sd_flash_write'

c:/program files (x86)/gnu tools arm embedded/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v6-m\libc_nano.a(lib_a-sbrkr.o): In function '_sbrk_r': sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk' collect2.exe: error: ld returned 1 exit status

These functions/references are, following documentatrion, in SoC library API. I can't find them anywhere else (in c or h files)...

Setup SDK 8.1 GCC 6.3 Eclipse 4.7.0

How can I make my code compile :-). Maybe we are missing something obvious...

Thanks.

Parents
  • The functions you are missing are created by some macro magic in the headers of the SDK. The functions must be declared somewhere, or otherwise, your compiler would have complained already. My best guess is, that you are mixing C++ with C and that the old SDK version is not aware of C++ and thus you have to wrap the include of the SDK headers with an extern "C" {} to tell the compiler that the SDK functions have C binding.

Reply
  • The functions you are missing are created by some macro magic in the headers of the SDK. The functions must be declared somewhere, or otherwise, your compiler would have complained already. My best guess is, that you are mixing C++ with C and that the old SDK version is not aware of C++ and thus you have to wrap the include of the SDK headers with an extern "C" {} to tell the compiler that the SDK functions have C binding.

Children
Related