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

Download and debug application using SES in the presence of bootloader

Hello, guys!

We are using SDK 15.0.0 and nRF52840 SoC device.

Our goal is to debug the application with SES in the presence of bootloader. This thread explains that we need to:

  1. merge bootloader and bootloader settings .hex files into a single .hex file
  2. flash that single .hex into nRF52840 device by the help of nrfjprog tool
  3. Apply Debug->Go from SES to debug the application.

We were able to successfully finish steps 1 and 2. However, here is what we get after flashing merged .hex file into nRF52840 device:

What is flashed seems not to be equal to merged .hex file. Consequently, we are unable to debug application from SES.

Do you have any idea what we are missing here?

Here is the set of commands we apply:

## To generate bootloader settings:
nrfutil settings generate --family NRF52840 --application application.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 bootloader_settings.hex

## To merge .hex files:
mergehex --merge bootloader.hex bootloader_settings.hex --output bootloader_with_settings.hex

## To flash merged .hex file:
nrfjprog --program bootloader_with_settings.hex -f nrf52 --sectoranduicrerase 
nrfjprog --reset -f nrf52	

Thanks in advance for your time and efforts!

Sincerely,

Bojan

Parents
  • Hi ,

    Steps as follows:

    1. Generate bootloader settings hex

    2. Merge with bootloader hex to generate bootloader_with_settings.hex

    3. Merge bootloader_with_settings.hex with application hex -->

    mergehex --merge bootloader_with_settings.hex application.hex --output bl_app.hex

    4. Merge bl_app.hex with Softdevice

    mergehex --merge bl_app.hex SD.hex --output sd_bl_app.hex

    5. Erase memory

    nrfjprog –eraseall

    6. Program memory

    nrfjprog --program sd_bl_app.hex

    Let me know if this helps.

    Best,

    SK

  • Hello SK.

    Just tried to merge the .hex files the way you described. I was unable to debug, unfortunately.

    Here is how the final sd_bl_app.hex looks like when implemented in nRF52840:

    Am I missing something ?

    Regards,

    Bojan.

  • Hi, 

    Can you confirm when you click Debug -> Go in SES, it does not hit main()? If that's the case, memory mapping is not done correctly. 

    In such case, there is a good article on adjustment in RAM and Flash that you can follow: 

    https://devzone.nordicsemi.com/nordic/short-range-guides/b/getting-started/posts/adjustment-of-ram-and-flash-memory

  • Hello SK.

    Thanks for the useful link. It is now clear about Flash and RAM. However, I still don't know how can I adjust the bootloader, MBR, bootloader settings parameters in secure_bootloader_gcc_nrf52.ld file that comes with dfu example.

    For example, when I compile secure_bootloader_ble_s140_pca10056 example and load the .hex file nto nRF Programmer tool here is what I get:

    Bootloader is not seen as a bootloader but as application. This is the appropriate content of secure_bootloader_gcc_nrf52.ld file

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0xf8000, LENGTH = 0x6000
      RAM (rwx) :  ORIGIN = 0x20002a98, LENGTH = 0x3d568
      uicr_bootloader_start_address (r) : ORIGIN = 0x00000FF8, LENGTH = 0x4
      bootloader_settings_page (r) : ORIGIN = 0x000FF000, LENGTH = 0x1000
      uicr_mbr_params_page (r) : ORIGIN = 0x00000FFC, LENGTH = 0x4
      mbr_params_page (r) : ORIGIN = 0x000FE000, LENGTH = 0x1000
    }

    Should I adjust some more parameter in order to properly load bootloader?

    Thanks in advance.

    Bojan.

Reply
  • Hello SK.

    Thanks for the useful link. It is now clear about Flash and RAM. However, I still don't know how can I adjust the bootloader, MBR, bootloader settings parameters in secure_bootloader_gcc_nrf52.ld file that comes with dfu example.

    For example, when I compile secure_bootloader_ble_s140_pca10056 example and load the .hex file nto nRF Programmer tool here is what I get:

    Bootloader is not seen as a bootloader but as application. This is the appropriate content of secure_bootloader_gcc_nrf52.ld file

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0xf8000, LENGTH = 0x6000
      RAM (rwx) :  ORIGIN = 0x20002a98, LENGTH = 0x3d568
      uicr_bootloader_start_address (r) : ORIGIN = 0x00000FF8, LENGTH = 0x4
      bootloader_settings_page (r) : ORIGIN = 0x000FF000, LENGTH = 0x1000
      uicr_mbr_params_page (r) : ORIGIN = 0x00000FFC, LENGTH = 0x4
      mbr_params_page (r) : ORIGIN = 0x000FE000, LENGTH = 0x1000
    }

    Should I adjust some more parameter in order to properly load bootloader?

    Thanks in advance.

    Bojan.

Children
Related