This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Segger Embedded Studio support for NRF5_SDK_12_3_0_d7732ad (This is not a question.)

Hello everybody.

This post is about how to use Segger Embedded Studio for ARM with NRF51 series microprocessors. There is a tutorial about import keil project to ses. However, tutorial is about NRF52 series. When I examined the devzone, I saw that many people have problems about working with ses and nrf51. Also, there were some problems that I couldn't solve until now such as https://devzone.nordicsemi.com/f/nordic-q-a/40349/segger-embedded-studio-project-does-not-run-code-without-press-reset-button. Finally, I succeeded in transferring keil project to ses with all futures like debug or download. The SDK v12.3 with segger support can be found on https://github.com/srcnert/nRF5_SDK_12.3.0_d7731ad_ses.support.

Additionally, I wanna summarize the steps of this transfer as follows.

1) Download SDK v12.3.0.

2) Add SDK to "flash_placement.xml", "ses_nrf51_startup.s" and "thumb_crt0.s" to "/components/toolchain/embedded_studio" folder.

(Destination of the files: Nordic's guide has the links for these files:

)

3) Download Segger Embedded Studio v3.52a and open it. (According to responses, Segger Embedded Studio v4.50 is also usable.)

4) Select "File >> Import Project >> Import Keil MDK Project" and select your uvprojx file. And then, select "Internal Toolchain".

5) If softdevice is present, delete "flash_S130...." from Build Configuration section.

6) Navigate to "Project >> Options >> Linker >> Linker" and set "SEGGER" to "GNU".

7) Delete "Internal Files" folder's element and add "flash_placement.xml", "ses_nrf51_startup.s" and "thumb_crt0.s" and "system_nrf51.c". 

(You need to change the file filter to see XML files otherwise it appears that the file isn't there in the Add Existing file dialog because it defaults to *.c)

*** "Project >> Options >> Linker >> Section Placement File" must be "../../../../../../components/toolchain/embedded_studio/flash_placement.xml".

8) Navigate to "Project >> Options >> Preprocessor >> User Include Directories" and add following lines.

      - ../../../../../../components/device

      - ../../../../../../components/toolchain/cmsis/include

9) Navigate to "Project >> Options >> Linker >> Section Placement Macros" and add following lines.

      - If soft device (S130 v2.0.1) is not present, FLASH_PLACEMENT = 0x00000000 SRAM_START = 0x20000000.

      - If soft device (S130 v2.0.1) is present, FLASH_PLACEMENT = 0x1B000 SRAM_START = 0x200013C8.

*** According to your project, you must adjust SRAM_START value.

(*** the Flash and Ram items are to be entered on separate lines.)

10) If NRF51822 is used, navigate to "Project >> Options >> Preprocessor >> Preprocessor Definitions" and change "NRF51422" to "NRF51822".

11) If NRF51822 is used, navigate to "Project >> Options >> Debugger >> Target Device" and select "NRF51822_xxAA".

12) If softdevice is present, navigate to "Project >> Options >> Preprocessor >> Preprocessor Definitions" and add "NO_VTOR_CONFIG".

13) If softdevice is present, navigate to "Project >> Options >> Loader >> Additional Load File[0]" and select S130 v2.0.1 hex file.

14) Navigate to "Project >> Options >> Target Scripts >> Disconnect Script" and add "TargetInterface.resetAndStop()" line.

*** The step 14 is used to solve download problem. You can see detail at https://devzone.nordicsemi.com/f/nordic-q-a/40349/segger-embedded-studio-project-does-not-run-code-without-press-reset-button

15) Navigate to "Project >> Options >> Debugger >> Register Definition File" and select nrf51.svd file.

--

After these steps, you can switch to Segger Embedded Studio v4.16.

***If ses compiler gives "In function 'SystemInit': undefined reference to '_SRAM_segement_end_error', You must change it to '_RAM_segement_end_error' at startup file and remake step 11.

*** Also, project in "/examples_segger/ble_peripheral/ble_app_template/pca10028/s130/ses_official" directly created at SES (without import keil project) and I recommend using it.

If you see any problem, please inform me. If everybody use the same SDK folder, we can create impeccable SES support for NRF51 series MCUs. If you like the project, don't forget to give stars from the GitHub Slight smile .

Thanks.

(Editted according to suggestions on March 9)

Parents
  • This is incredibly helpful, I was also struggling to get the nRF51-DK working with the recommended latest version of SES v4.50 because the instructions in Nordic's Getting Started Guide v1.3 did not work. The critical point is that the flash_placement.xml file needs to be added to the Internal Files in the project structure in your step 6, which Nordic's guide does not say to do, in fact the screenshot on page 21 clearly shows 3 files in that folder, not the 4 which are needed.

    I have a few suggestions:

    • You should swap steps 8 and 9, because the Section Placement Macros item doesn't show up when the Linker is SEGGER.
    • There is no need to specify version 3.52a of SES in step 3 because it works fine with the current v4.50. So you can also delete the step after 15, switching to the latest SES.
    • In Step 2, you don't say where to get the files from. Nordic's guide has the links for these files:
    • In Step 6, you need to change the file filter to see XML files otherwise it appears that the file isn't there in the Add Existing file dialog because it defaults to *.c
    • In your note on correcting the SystemInit undefined reference, the labels do not end '_error'. I did have to make this change when building examples\peripheral\blinky\pca10028\blank
    • In Step 9, the Flash and Ram items are to be entered on separate lines.

    I also had the common problem of 'nrf.h no such file or directory' but found it was due to a space before the ../../../../../../components/device entry in the User Include Directory list, so that one was my fault, but easily done.

    Hope this helps others who are new to this platform.

Reply
  • This is incredibly helpful, I was also struggling to get the nRF51-DK working with the recommended latest version of SES v4.50 because the instructions in Nordic's Getting Started Guide v1.3 did not work. The critical point is that the flash_placement.xml file needs to be added to the Internal Files in the project structure in your step 6, which Nordic's guide does not say to do, in fact the screenshot on page 21 clearly shows 3 files in that folder, not the 4 which are needed.

    I have a few suggestions:

    • You should swap steps 8 and 9, because the Section Placement Macros item doesn't show up when the Linker is SEGGER.
    • There is no need to specify version 3.52a of SES in step 3 because it works fine with the current v4.50. So you can also delete the step after 15, switching to the latest SES.
    • In Step 2, you don't say where to get the files from. Nordic's guide has the links for these files:
    • In Step 6, you need to change the file filter to see XML files otherwise it appears that the file isn't there in the Add Existing file dialog because it defaults to *.c
    • In your note on correcting the SystemInit undefined reference, the labels do not end '_error'. I did have to make this change when building examples\peripheral\blinky\pca10028\blank
    • In Step 9, the Flash and Ram items are to be entered on separate lines.

    I also had the common problem of 'nrf.h no such file or directory' but found it was due to a space before the ../../../../../../components/device entry in the User Include Directory list, so that one was my fault, but easily done.

    Hope this helps others who are new to this platform.

Children
No Data
Related