Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Setting up FreeRTOS on nRF52832

Hi All,

I'm trying to add FreeRTOS into an existing project that is based off the UART example but has a lot of stuff stripped out of it.  I've been referencing the HRS FreeRTOS project to migrate differences.

However, I'm stuck at a point now where I'm getting the following error:

.\_build\nrf52832_xxaa.axf: Error: L6200E: Symbol SWI2_EGU2_IRQHandler multiply defined (by nrf_sdh_freertos.o and nrf_sdh.o).

It's clear that there is something being defined twice because of these files, but I can't pinpoint why I'm getting this error when compiling in my project as opposed to the HRS FreeRTOS example.  I've already done the following:

  • Added FreeRTOS source files from SDK external folder into my project
  • Added the nrf_sdh_freertos.c file
  • Added the appopriate compiler paths for FreeRtos external files
  • Added the FREERTOS tag into preprocessor defines
  • Copied the FreeRTOSConfig.h file from the example
  • Replaced app_timer.c with app_timer_freertos.c

Any ideas if there are other steps I'm missing during this migration?  I'm using SDK 14.0.0.  Also, I don't have any #includes in my main yet (just think of my main as empty for now).

  • the error message tells you where the symbol is multiply defined. You have two versions of the *sdh* routines in there, one the freertos one and one the usual one. Either remove nrf_sdh.c or nrf_sdh_freertos.c, I would expect removing the former is correct. 

  • Thanks RK.  Yes I realize it means that the IRQHandler is being defined multiple times, but the Nordic SDK examples have both nrf_sdh.c and nrf_sdh_freertos.c both present in the project tree so I wasn't sure about simply removing one of them.

    After closer inspection at the source files for both nrf_sdh.c and nrf_sdh_freertos.c, the handler which the compiler is complaining about is only defined in nrf_sdh.c if the NRF_SDH_DISPATCH_MODEL == NRF_SDH_DISTPATCH_MODEL_INTERRUPT, which is what my working example was set to in the sdk_config.h.

    Looking closer at the SDK FreeRTOS example, I can see that sdk config parameter is set to polling, not interrupt.  Changing to polling solved the issue.

Related