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
  • Thank you for the good explanation! But I still got some problems with Section Placement.

    The keyword FLASH_PLACEMENT seems to be wrong. In my opinion it should be FLASH_START like

    FLASH_START=0x1B000

    SRAM_START=0x200013C8

    Spaces also not allowed in both expressions. (Found here: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/segger-embedded-studio-a-cross-platform-ide)

    Only after such modification I got the right placement offset

     

    Also, if somebody want to create the project from scratch by his own it seems to be necessary to remove nRF51822_xxAA_MemoryMap.xml (automatically created by SES) in Options -> Build -> Memory Map File and add in Options -> Build -> Memory Segments

    For SES 3.52 (Tested with SES Release 3.52  Build 2018091305.37077)

    FLASH RX 0x00000000 0x00040000

    SRAM RWX 0x20000000 0x00004000

    For SES 4.52c

    FLASH RX 0x00000000 0x00040000;SRAM RWX 0x20000000 0x00004000

    Otherwise I got every time this error:

      Linking ble_blinky.elf

        Output/Debug/Exe/ble_blinky.elf section `.init.SystemCoreClockUpdate' will not fit in region `UNPLACED_SECTIONS'

        region `UNPLACED_SECTIONS' overflowed by 21332 bytes

    …. Build failed

    Please correct me if something is wrong!

    Best regards, Stani

  • Hi 

    You can find the SDK v12.3 with segger support on https://github.com/srcnert/nRF5_SDK_12.3.0_d7731ad_ses.support. In this address, you must use "examples_segger" folder to use segger embedded studio. Also, You can find a segger project on  "..\examples_segger\ble_peripheral\ble_app_template\pca10028\s130\ses_official". This example directly created on segger, does not be imported form keil project. You can arrange this ses example according to your wishes. I think that it is the simplest way.

    Best regards,

    Sercan.

Reply Children
No Data
Related