Official Sheffield ARMBand micro:bit program
microbit/microbit-dal/nRF51822/nrf51-sdk/README.md@0:b9164b348919, 2016-10-17 (annotated)
- Committer:
- MrBedfordVan
- Date:
- Mon Oct 17 12:41:20 2016 +0000
- Revision:
- 0:b9164b348919
Official Sheffield ARMBand Micro:bit program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MrBedfordVan | 0:b9164b348919 | 1 | # nrf51-sdk |
MrBedfordVan | 0:b9164b348919 | 2 | Module to contain files provided by the nordic nRF51 SDK. The latest version of this module uses files from Nordic SDK 10.0.0. The files are extracted from [here](https://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v10.x.x/nRF51_SDK_10.0.0_dc26b5e.zip). |
MrBedfordVan | 0:b9164b348919 | 3 | |
MrBedfordVan | 0:b9164b348919 | 4 | ## Changes made to Nordic files |
MrBedfordVan | 0:b9164b348919 | 5 | The files are kept the same as much as possible to the Nordic SDK. Modifications are made in order to integrate with mbed. |
MrBedfordVan | 0:b9164b348919 | 6 | - ble/common/ble_conn_state.c: Preprocessor tests regarding S110, S120 or S130 macro should be replace by TARGET_MCU_NRF51_XXK_SXXX tests |
MrBedfordVan | 0:b9164b348919 | 7 | |
MrBedfordVan | 0:b9164b348919 | 8 | ## Porting new versions of Nordic SDK |
MrBedfordVan | 0:b9164b348919 | 9 | A list of files currently requierd by mbed is maintained in [script/required_files.txt](https://github.com/ARMmbed/nrf51-sdk/blob/master/script/required_files.txt). [A python script](https://github.com/ARMmbed/nrf51-sdk/blob/master/script/pick_nrf51_files.py) 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 the filename. |
MrBedfordVan | 0:b9164b348919 | 10 | |
MrBedfordVan | 0:b9164b348919 | 11 | ### Script usage |
MrBedfordVan | 0:b9164b348919 | 12 | ``` |
MrBedfordVan | 0:b9164b348919 | 13 | python pick_nrf51_files.py [options] <full-noridc-sdk-path> <nrf51-sdk-yotta-module-path> |
MrBedfordVan | 0:b9164b348919 | 14 | options: --purge : to delete all existing files and start again |
MrBedfordVan | 0:b9164b348919 | 15 | --dry-run : to list the files to be copied but not actually copy them |
MrBedfordVan | 0:b9164b348919 | 16 | ``` |
MrBedfordVan | 0:b9164b348919 | 17 | |
MrBedfordVan | 0:b9164b348919 | 18 | 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 [pick_nrf51_files.py](https://github.com/ARMmbed/nrf51-sdk/blob/master/script/pick_nrf51_files.py). |
MrBedfordVan | 0:b9164b348919 | 19 | |
MrBedfordVan | 0:b9164b348919 | 20 | After running the script, the changes in [the previous section](#changes-made-to-nordic-files) will have to be applied manually again. |
MrBedfordVan | 0:b9164b348919 | 21 | |
MrBedfordVan | 0:b9164b348919 | 22 | Folder structure or even file name can change between releases of the nordic sdk, hence a degree of manual adjustment is needed when porting. |
MrBedfordVan | 0:b9164b348919 | 23 | |
MrBedfordVan | 0:b9164b348919 | 24 | ## Using Noridc Headers |
MrBedfordVan | 0:b9164b348919 | 25 | 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. |
MrBedfordVan | 0:b9164b348919 | 26 | ```c |
MrBedfordVan | 0:b9164b348919 | 27 | extern "C" { |
MrBedfordVan | 0:b9164b348919 | 28 | #include "softdevice_handler.h" |
MrBedfordVan | 0:b9164b348919 | 29 | } |
MrBedfordVan | 0:b9164b348919 | 30 | ``` |