sprintf causes memory overlap

Hello,

Project secure boot loader S140, SDK 16.0, nRF52840.

This line of code causes compile/LInker errors in my project. I guess I need to adjust memory start address in my Linker section placement macros (?). But I'm not sure which value should be changed to what. Please help.

sprintf(hex, "%2X", ble_addr.addr[1]);

Here is the complete error message:

Building ‘secure_bootloader_ble_s140_pca10056’ from solution ‘secure_bootloader_ble_s140_pca10056’ in configuration ‘Release’
  Compiling ‘nrf_dfu_ble.c’
    ignoring return value of 'malloc' declared with attribute 'warn_unused_result' [-Wunused-result]
  Linking secure_bootloader_ble_s140_pca10056.elf
     section .mbr_params_page VMA [00000000000fe000,00000000000fefff] overlaps section .text VMA [00000000000f83d4,00000000000fe1db]
     section .crypto_data VMA [00000000000fe1dc,00000000000fe1e3] overlaps section .mbr_params_page VMA [00000000000fe000,00000000000fefff]
    Build failed
Build failed

Thanks.

Parents
  • Hi,

    The linker error shows that the bootlaoder became too large. You found a way to optimize this, but generally, if you get this error and cannot get the size down, you need to move the bootlodaer addres down. Let it start at an address 0x1000 lower as that is the minimum size increase possible as it must be a multiple of a page size. And increase the size of 0x1000 (or corresondingly to how much you moved it down) in the linker configuration. Then, it should build without any problems. Note that the bootloader start address cannot change in the field, so this will only work for products that are in development, and you cannot udpate to a new bootlaoder at a different address via DFU.

Reply
  • Hi,

    The linker error shows that the bootlaoder became too large. You found a way to optimize this, but generally, if you get this error and cannot get the size down, you need to move the bootlodaer addres down. Let it start at an address 0x1000 lower as that is the minimum size increase possible as it must be a multiple of a page size. And increase the size of 0x1000 (or corresondingly to how much you moved it down) in the linker configuration. Then, it should build without any problems. Note that the bootloader start address cannot change in the field, so this will only work for products that are in development, and you cannot udpate to a new bootlaoder at a different address via DFU.

Children
No Data
Related