How can I import nordic sdk to dwm-simple (For the pupose of using nfc)?

Hey there,
I want to use some functionality from nordic sdk (especially nfc library). I included directories and tried to build, but it fails to link with the following errors even it compiles succesfully. The header containing following functions (nfc_t2t_lib.h) already included. Is there anything you can help me with? Is there any example that includes sdk already?

In function app_thread_entry': undefined reference tonfc_t2t_setup’
undefined reference to nfc_uri_msg_encode' undefined reference tonfc_t2t_payload_set’
undefined reference to `nfc_t2t_emulation_start’
ld returned 1 exit status
Build failed

Thanks in advance.

Hi Oguz,

please make sure the library is used with the linker. I guess that it is missing in the linking phase. Make sure you add the library to the LDFLAGS variable in the Makefile. See e.g. dwm-simple.

The header is necessary for the pre-processing phase so the issue above would be related with the header only if those undefined references are inline functions or defines.

Cheers,
TDK

Hi @leapslabs,
Thanks for your response. I am using SES with the ld provided by the on board package and nordic sdk. I also included prebuilt nfc library to the link command as follows.

“$(ToolChainDir)/arm-none-eabi-gcc” -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -Wl,–gc-sections -Wl,-static -Wl,-n -g -nostdlib -o “$(SolutionDir)/output/linker/$(SolutionName)_fw2.elf” “$(SolutionDir)/output/compiler/$(SolutionName).o” “$(SolutionDir)/…/…/lib/dwm.o” “$(SolutionDir)/…/…/lib/libdwm.a” “$(sdk_dir)/components/nfc/t2t_lib/nfc_t2t_lib_gcc.a” -nostartfiles -L “$(SolutionDir)/…/…/lib” -Wl,-Map,"$(SolutionDir)/output/linker/$(SolutionName)_fw2.map" -T “$(SolutionDir)/…/…/lib/target_s132_fw2.ld” -lm -lgcc -lc -lnosys

Now there is still errors like below.

  In function `app_thread_entry':
    undefined reference to `nfc_uri_msg_encode'
    In function `nfcHandleT2ReadCommand':
    C:\Users\woja.NVLSI\Documents\nfc-library1\private\armgcc/../nfc_lib/nfc_lib.c:298: undefined reference to `hal_nfc_send'
    In function `nfc_t2t_setup':
    C:\Users\woja.NVLSI\Documents\nfc-library1\private\armgcc/../nfc_lib/nfc_lib.c:475: undefined reference to `hal_nfc_setup'
    In function `nfc_t2t_emulation_start':
    C:\Users\woja.NVLSI\Documents\nfc-library1\private\armgcc/../nfc_lib/nfc_lib.c:571: undefined reference to `hal_nfc_start'
    ld returned 1 exit status

Note that I use ubuntu 16.04 and " C:\Users\woja.NVLSI…" things are coming from nfc_t2t__lib_gcc.a.

Sorry I took some time to respond because I experimented with the imports and commands after what you said.

Hi Oguz,

are you sure that the missing references (hal_nfc_send, hal_nfc_send, hal_nfc_setup, hal_nfc_start) are in the nfc_t2t_lib_gcc.a or other provided library? You can open and list the symbols in it.

Cheers,
TDK

A part of the output nm -C nfc_t2t_lib_gcc.a | less is as follows.

nfc_t2t_lib_nfc_lib.c.o:
U hal_nfc_done
U hal_nfc_parameter_get
U hal_nfc_parameter_set
U hal_nfc_send
U hal_nfc_setup
U hal_nfc_start
U hal_nfc_stop
U memcpy
U memset
00000000 b nfclib
00000000 r nfclibDefaultId
00000001 T nfc_t2t_done
00000001 T nfc_t2t_emulation_start
00000001 T nfc_t2t_emulation_stop
00000001 T nfc_t2t_internal_set
00000001 T nfc_t2t_parameter_get
00000001 T nfc_t2t_parameter_set
00000001 T nfc_t2t_payload_raw_set
00000001 T nfc_t2t_payload_set
00000001 T nfc_t2t_setup

I guess, they are not defined in the library but in the hal_nfc_t2t.h which I include (Not sure since when I try to go the included file it cant find but it does not give any compilation error.)
Note that directory of the included headers are included in the preprocessors include directories.
I think problem might be about

Thanks in advance.

Were you able to solve this? I need to do a similar thing.

Not really, there were still linker problems. My guess is the linker files used in dwm examples are need to be customized to work with the sdk but I could not achieve that.

Hi Oguz,

maybe you can share your project files and I can try to find out why you cannot link it (if there is no secret code). I suspect there should be some trivial issue.

Cheers,
TDK

Hi @leapslabs,
This project was just a trial, so no problem. Forum did not let me upload the zip so I uploaded to dwm-simple-mod.

Thanks for your efforts in advance.

Similar error is occured when I tried to build dwm-timer example with no modifications except for updating toolchain-dir and include directories.

In function `dwm_irq_hndlr':
undefined reference to `TIMER2_IRQHandler'
In function `app_thread_entry':
undefined reference to `nrf_drv_timer_init'
undefined reference to `nrf_drv_timer_extended_compare'
undefined reference to `nrf_drv_timer_enable'
ld returned 1 exit status

Build failed

Hi Oguz,

you can download the package here: https://drive.google.com/open?id=1ZFLZ0WgvMdi6iPoVM3TtkDgnYpZwKmgc

There were a few missing files and compile rules in your codes. It can compile and link correctly now but I have not tested it.

I don’t use Segger but common GCC tools. All the rules are in the Makefile. So you can adapt to Segger as needed.

Similarily the dwm-timer and dwm-uart can be compiled using the GCC tools. If you cannot compile it is problem with Segger. Please refer to their documentation.

Cheers,
TDK

1 Like

Seems like it was caused by segger, I was able to build with makefile, thanks.

Oguz.