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

Parents
  • Your application is 70kB and not 47kB. This means that you need at least 140kB of application flash space( two banks of 70kB each) when using a Dual Bank Bootloader. If you use the default ROM settings for the bootloader, i.e. the bootloader starts at 0x3C000 then you'll have

    0x3C000 - 0x18000 = 0x24000( 144kB left) 
    

    However, extending the bootloader section in order to debug the bootloader you are left with

    0x3A000 - 0x18000 = 0x22000( 136kB left) 
    

    which is not enough and you will get the Data Size Exceeds Limiterror

Reply
  • Your application is 70kB and not 47kB. This means that you need at least 140kB of application flash space( two banks of 70kB each) when using a Dual Bank Bootloader. If you use the default ROM settings for the bootloader, i.e. the bootloader starts at 0x3C000 then you'll have

    0x3C000 - 0x18000 = 0x24000( 144kB left) 
    

    However, extending the bootloader section in order to debug the bootloader you are left with

    0x3A000 - 0x18000 = 0x22000( 136kB left) 
    

    which is not enough and you will get the Data Size Exceeds Limiterror

Children
  • Hi Bjorn, how do you see its 70Kb? And why package generator says its 47Kb?

  • When you compile a project in Keil, the following line will be displayed in the Build Output:

    Program Size: Code=4740 RO-data=1112 RW-data=16 ZI-data=17568  
    

    Which tells you the size of your application program in bytes.

    ===============================================================
       Total RO Size (Code + RO Data) - Code size in bytes
       Total RW Size (RW Data + ZI Data) - RAM size in bytes
       Total ROM Size (Code + RO Data + RW Data) - Image size in bytes
    ===============================================================
    
  • Bjorn, you are totally correct, thanks! I switched to a single bank DFU, but now I have the same problem when trying to update bootloader. Not exactly sure how the procedure for bootloader works since it cant really overwrite itself while running... Would it erase application and work like a dual bank update?

  • The size of the new bootloader must NOT excede the size of the bootloader that is currently present on the chip. This is because the bootloader start adress is written to the UICR register which cannot be updated with out re-flashing the chip with a programmer. As for the memory layout during a bootloader update, please refer this page on our Infocenter

  • Im loading exactly the same bootloader that I already had on the chip. In the link that you provided it says that single bank updates allow only for APP updates, I did however successfully updated softdevice using singlebank update, is this correct? So may be single bank is available for SD and APP, but not BL?

Related