You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.0 KiB


Module to contain files provided by the nordic nRF51 SDK

The latest version of this module uses files from Nordic SDK 8.1.0. The files are extracted from:

Changes made to Nordic files

The files are kept the same as much as possible to the Nordic SDK. These minor modifications are made in order to integrate with mbed:

  1. Add #define asm __ASM to the top of nrf_delay.h. Because all yotta mobules compile with -std=c99 which does not include "asm" keyword.
  2. Add #define BLE_STACK_SUPPORT_REQD to the top of ble_stack_handler_types.h.
  3. Add this patch to nrf_svc.h
index 3e907ea..fcb05a1 100644
--- a/source/nordic_sdk/components/softdevice/s130/headers/nrf_svc.h
+++ b/source/nordic_sdk/components/softdevice/s130/headers/nrf_svc.h
@@ -53,7 +53,7 @@
   { \
     __asm( \
         "svc %0\n" \
-        "bx r14" : : "I" (number) : "r0" \
+        "bx r14" : : "I" ((uint32_t) number) : "r0" \
     ); \
   }    \
   _Pragma("GCC diagnostic pop")

Porting new versions of Nordic SDK

A list of files currently requierd by mbed is maintained in script/required_files.txt. A python script is written to help porting from nordic sdk releases. required_files.txt is parsed to find a list of filenames. The script searches for these filenames in the sdk folder, and copy then into the yotta module mirroring the folder structure in the sdk. extraIncludes is automatically added to module.json to allow direct inclusion of noridc headers with just he filename.

Script usage

python <full-noridc-sdk-path> <nrf51-sdk-yotta-module-path>

There are files in the sdk with the same filename but in different folder. This is dealt with by excluding certain directories. The excluded directories are listed in

After running the script, the changes in the previous section will have to be applied manually again.

Folder structure or even file name can change between releases of the nordic sdk, hence a degree of manual adjustment is needed when porting.

Using Noridc Headers

The nordic sdk is written in C and yotta modules support C++. If you are trying to include Nordic files in a cpp program, you need to use the extern "C" keyword around the includes.

extern "C" {
#include "softdevice_handler.h"