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

MBR set a Hardfault after bootloader sequence

Hello,

I'm working on a project with thread network and I'm implementing a bootloader from the thread dfu secure bootloader example.

I had use this example with sucess but now, I change the memory segment for my custom application and the bootloader don't start the application, I have a hardfault handler in the MBR and I don't know why....

The bootloader is working, I can follow the instruction in debug mode and after the function nrf_bootloader_app_start(), my program stop to adress 0x0978 in the MBR and make a hardfault :

Does anyone known what MBR does at this adress ?

Bootloader Memory segments :

FLASH RX 0x0 0x100000
RAM RWX 0x20000000 0x40000
mbr_params_page RX 0x000FE000 0x1000
bootloader_settings_page RX 0x000FF000 0x1000
uicr_mbr_params_page RX 0x10001018 0x4
uicr_bootloader_start_address RX 0x10001014 0x4

Bootloader sections placement Macros :

FLASH_PH_START=0x0
FLASH_PH_SIZE=0x100000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x40000
FLASH_START=0xf6000
FLASH_SIZE=0x8000
RAM_START=0x20004000
RAM_SIZE=0x3bad0

Application Memory segments :

FLASH RX 0x0 0x100000
RAM RWX 0x20000000 0x40000
ot_flash_data RX 0x000f2000 0x4000
uicr_bootloader_start_address RX 0x10001014 0x4
bootloader_settings_page RX 0x000FF000 0x1000
uicr_mbr_params_page RX 0x10001018 0x4
mbr_params_page RX 0x000FE000 0x1000

Application section Placement macros :

FLASH_PH_START=0x0
FLASH_PH_SIZE=0x100000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x40000
FLASH_START=0x1000
FLASH_SIZE=0xf1000
RAM_START=0x20000008
RAM_SIZE=0x3fff8

I let the flash_placement.xml like in example.

Just for my information, does anyone known why the RAM start to 0x20000008 in application ?

Regards,

Valentin

Parents
  • Hi,

    I've made some progress and I know why there is Hardfault but I don't know why this is handle...

    I flash the MBR, bootloader with Segger studio and my application with nrfutil. I run the bootloader code step by step and I can going to app_start function in nrf_bootloader_app_start_final.c
    This is a break in the code before the hardfault :

    You can see in the Watch 1 that the new_msp = 0x20040000 - new_lr = 0xffffffff - reset_handler = 0x00001361.

    For me, all of these variables are good but next, the code jump to the address 0x978 :

    and so, a hardfault is fire at the address 0x000013C2...

    I told you a hardfault in MBR code but it's because of the bootloader who jump to MBR

    Before, I execute the code with thread secure dfu example, I get the same value for new_msp and reset handler and the jump to application was correct but with my custom code, the jump is not working...
    I don't know why... I begin the project with new blank project so I made all include and choose all parameter in segger, is there special setting for bootloader application in segger ?
    Do you know why this happen ?

    Regards,

    Valentin

Reply
  • Hi,

    I've made some progress and I know why there is Hardfault but I don't know why this is handle...

    I flash the MBR, bootloader with Segger studio and my application with nrfutil. I run the bootloader code step by step and I can going to app_start function in nrf_bootloader_app_start_final.c
    This is a break in the code before the hardfault :

    You can see in the Watch 1 that the new_msp = 0x20040000 - new_lr = 0xffffffff - reset_handler = 0x00001361.

    For me, all of these variables are good but next, the code jump to the address 0x978 :

    and so, a hardfault is fire at the address 0x000013C2...

    I told you a hardfault in MBR code but it's because of the bootloader who jump to MBR

    Before, I execute the code with thread secure dfu example, I get the same value for new_msp and reset handler and the jump to application was correct but with my custom code, the jump is not working...
    I don't know why... I begin the project with new blank project so I made all include and choose all parameter in segger, is there special setting for bootloader application in segger ?
    Do you know why this happen ?

    Regards,

    Valentin

Children
No Data
Related