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 found the problem and this was very hidden... But I don't understand what the difference !
    I rebuilt and test the thread secure dfu example and in fact, the "Debug" configuration doesn't work because of gcc_optimization_level = None !

    I rebuilt with my custom bootloader with gcc_optimization_level = "optimize for size" and now it's work.

    I don't understand why the jump function doesn't work with no optimization but it's the solution. If someone can explain, i'll be very gratefull Slight smile

    I don't test the other optimization level.

    Valentin

Reply
  • Hi,

    I've found the problem and this was very hidden... But I don't understand what the difference !
    I rebuilt and test the thread secure dfu example and in fact, the "Debug" configuration doesn't work because of gcc_optimization_level = None !

    I rebuilt with my custom bootloader with gcc_optimization_level = "optimize for size" and now it's work.

    I don't understand why the jump function doesn't work with no optimization but it's the solution. If someone can explain, i'll be very gratefull Slight smile

    I don't test the other optimization level.

    Valentin

Children
No Data
Related