This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bootloader hardfault

Hi,

Im trying to use BLE DFU Bootloader from examples. I loaded SD8 and then bootloader via nrfStudio (dont have a valid app flashed), but I cant see the device from Android app. I decided to do some debugging via Keil. I recompiled Bootloader with no optimisation and moved bootloader address to 0x3A000.

If I try to debug in Keil it doesnt stop at main, but if i manually press stop it gets into hardfault: image description

Memory settings: image description

Compilation settings: image description

Im using Revision 3 chip. What do I do wrong?

app.zip

hex

Bootloader

Bootloader hex O3

bootloader package without BANK_VALID_APP

Bootloader HEX without BANK_VALID_APP

Memory map according to NRF Studio: Memory map

Bootloader optimisation Level 2 gets stuck on run: image description

Image size > 0x6400

  • Attached to main thread. I think O3 was enabled last time as well. File sizes seem identical.

  • The size issue turned out to be error with the script I used to create a hexdump of the hexfile you sent me.

    In the bootloader hex you have set the BANK_VALID_APP flag on the bootloader settings flash page. If you are using a single bank bootloader, the application will be erased and the new bootloader is saved to the application flash space. When the bootloader is swapped with the old one, it will check the bootloader settings to see if the BANK_VALID_APP flag is set. If it is set, the bootloader will branch to what it thinks is a valid application, but in reality is just an empty flash area.

    Do not set the BANK_VALID_APP in bootlaoder images when performing OTA DFU. Only set it if you're flashing BL+APP+SD using a programmer.

  • I removed BANK_VALID_APP, but still having the same problem: Data Size Exceeds Limit. Just for the sake of clarity I tried two things: 1)first flashed SD+APP+BL with set BANK_VALID_APP. Then I tried OTA DFU and sent a BL without BANK_VALID_APP.

    1. I loaded SD+BL without BANK_VALID_APP and tried to do OTA DFU. Got the same error. Im attaching both new package and hex file to the main thread. Please have a look.
  • I found the issue. The image size was 0x6000 bytes and the size reserved for the bootloader was 0x5C00, i.e. 0x400 (1kB) too large.

    Change the ROM/RAM settings to the following

    IROM1 start: 0x39C00 size:6000
    

    and set BOOTLOADER_REGION_START to 0x00039C00 in dfu_types.h.

  • Hm this is a bit weird. How do I flash it with a cable then and it works? There is no size check?

Related