porting an nRF52 SES project to nRF51

I have the same application that runs on both nrf51 and nrf52 MCUs. The Bluetooth in the application uses SoftDevice and not the SDK primarily because I started with the pc-driver which uses just SoftDevice. The nRF51 project is Keil and I want to migrate it to SES. I know there is a lot of noise about this but it is proving to be very difficult to do as the project, being just and example in the peripheral directory has a lot of include files, preprocessor values, etc. that must be configured. The import methods that I have followed on the Segger and Nordic sites have not done these configurations.

So instead how hard would it be to take a SES project file from nrf52 using SoftDevice S140 and change it to an nrf51 project using S130? The names of my application files are the same in both cases. I dont know if replacing the S140 and nrf52 references to the corresponding ones for nrf51 would work..

  • Hello,

    It should not be a problem to convert the 52 project into an nRF51 project. The most important steps that come to mind are: 

    1. Update the linker settings to match the device

    2. Change relevant preprocessor symbols (e.g. S132 -> S130).

    3. Change the startup files 

    If you are able to share your project, I can try to convert your 52 project to build for the nRF51. Need to know which package variant of the 51 you are using in that case.

  • I have made stabs at creating a SES based nrf51 project over the past years but basically gave up because there were simply too many things I didn't know and the locations of all the sources and includes are pretty complex in the SDK. I have decided to take another crack at it now that I am more familiar with the SDK and have looked into the raw project files of the SES and Keil projects and thought that maybe I could make use of them for the includes, pre-processors and source file configurations. So I tried the approach above but there were too many details about the MCUs I simply was unsure about.

    However, I do have an nRF52 and nRF51 project that do exactly the same thing. My application code for the two are almost identical as there are not too many differences between the SoftDevice S139 and S140 API calls. So I am working on two approaches to make the Keil to SES port. The first is the one referenced here. The second is that I started a new SES project from scratch based on the nRF51822 (that for the nRF51 DK) mcu. I then used the Keil project files to get the includes, preprocessors, and source files. I got a LOT further with this approach BUT got stuck on the fact that the 'arm_startup_nrf51.s' of the SDK includes a 'startup_config.h' file, but that file does not exist. I think if I got that file then the project would at least build (might need further tweaks)..

    IN any case, I attach my nrf52 project. It is to  be placed in the examples/peripherals directory. of the 17.1.0 SDK. It expects a 140 SoftDevice HEX file in the components/softdevice/s140/hex directory.

    Okay, well I would LIKE to send an attachment and I see that attachments can somehow be added but Ifor the life of me I cannot see how to do that! (Its not an image or video file.)

  • arm_startup_nrf51.s is for Keil uVision and the arm toolchain (has a different assembly syntax than GCC). For SES you should include the ses_startup_nrf51.s file instead.

    You can select the file you want to attach by clicking "Upload" here:

  • Okay, so it IS the video/image file option. Gees!ble_app_met_epoch.zip

    Unzip and place in the examples/peripheral directory of the 17.1.0 nrf5 SDK. It expects a S140 SoftDevice hex file in the components directory.

    Here is my attempt as a SES project for my nrf51 version

    nrf51_ble_app_met_epoch.zip

    This is placed in the examples/peripherals directory of a 12.3.0 nrf52 SDK. It expects an s130 SoftDevice hex file in the components directory

  • Here is the project configuration I made based on the 2 projects you uploaded:

    7028.nrf51_ses.zip

    To build the project, ensure SDK folder ('nRF5_SDK_12.3.0_d7731ad') is placed adjacent to the project folder. Otherwise, you need to update SDK_ROOT variable in the project configuration.

    Please note that I have not done any testing beyond verifying that it builds and runs. Converting old projects like this requires many small manual steps, making it easy to miss a step or overlook something. So please make sure that you test and review the changes on your end. 

Related