Trying to use nRF5 SDK 12.3.0 for nRF51 on a FreeRTOS project

Continuing from my Getting Started post, we now want to use the same method on a FreeRTOS example such as ble_app_hrs_freertos.

When compiling, we get file include path problems, starting with nrf_ble_gatt.h. These can be fixed by adding the following entries into the Project - Options - Preprocessor - User Include Directories
../../../../../../components/ble/nrf_ble_gatt
../../../../../../components/libraries/sensorsim
../../../../../../external/freertos/source/include
../../../../../../external/freertos/portable/ARM/nrf51
../../../../../../external/freertos/portable/CMSIS/nrf51
../../../config/ble_app_hrs_freertos_pca10028_s130

But then we hit a problem in compiling 'port.c' - expected '(' before 'void' on line 92

port.c is in the Third Parties folder since it is a FreeRTOS file

This is the compiler not accepting an asm void function, which isn't related to any changes I've made to get this to run but is a provided file. Let's see if it is any different in the later version of the SDK

The source code is unchanged but the comments say that this file in SDK16 is for the Cortex M0, which is correct for an nRF51; rather than M4 which is correct for nRF52. But the port.c that is in the project is from SDK\external\freertos\portable\ARM\nrf51 which should be for M0, so why is there a mention of M4 in the SDK12 version?

I've looked at differences in FreeRTOSConfig.h that each project uses, comparing the nRF52/SDK16 with the nRF51/SDK12 but at this point, it seems a waste of time to go any further to debug problems in the configuration files of "Nordic provided examples" that should just work.

I've done a lot of work to try to get nRF51-DK (PCA10028) to work with SES and SDK12 but I'm now giving up and going to get a nRF52-DK (PCA10040) for further development (with SDK16). It is clearly the only devkit/SDK combination that is properly supported.



Assembly Code in SES

The problem in port.c is__asm, it is Keil specific so has to be replaced to be GCC compatible.

This can be solved by getting port.c and portmacro.h from freertos_nrf51 but then we get 'portNRF_RTC_REG' undeclared in 'port_cmsis_systick.c'.

Comparing this to the SDK16 version, that token is defined in portmacro_cmsis.h which is included in the SDK12 version but only as a dependency on port_cmsis.c, whereas in the SDK16 version it is included as a dependency on many files.

Since there is no mention of portmacro_cmsis.h in any project as a #include file, this must be to do with the FreeRTOS build/include structures and hence out of scope for me to fix.