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

confusion on boot loader settings

I want to merge soft device, application and boot loader in order to improve efficiency for factory. I searched relative topics in this forum and found something useful. At last I got a solution. But I still have confusion on it. It is said that declaration     "uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used));" should be initialized. So I  do as I was told like this:   "uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) = {BANK_VALID_APP};".   After everything done, I got m_bootloader_settings. I found member bank_0 wasn't the very value BANK_VALID_APP. Once I found it was 0x1FF0B00 and 0x101FF02. I changed initialization as 0x02, 0x03 and other 1 byte length values, then I found the most significant byte of member bank_0 changed as I set. I'm sure I had erased all flash before programming. It seems that m_bootloader_settings doesn't locate from address BOOTLOADER_SETTINGS_ADDRESS. When I use "const" to restrain m_bootloader_settings, I can find it at BOOTLOADER_SETTINGS_ADDRESS correctly, with everything as I expected. But I'm not sure what adventure it will cause.
Is there anyone have got any tips?
Parents
  • Hi,

    It seems that you found the solution to your issue, and you're verifying that setting the array m_boot_settings[] as a const is ok. I did a quick check, and the generated .hex is equal.

    Since this is an array that is located in flash, declaring the array is "const" is the proper way. However, there is an issue with the Keil project settings when setting the array to "BANK_VALID_APP". The Keil linker seems to be a bit confused and complains that you're exceeding the IROM size.

    Workaround: We have set the size of the image incorrectly. If you set the IROM1 Size to "0x3C00" it should compile properly:

    image description

    Cheers, Håkon

  • Thank you, Håkon Alseth ! Your way might work well. I set IROM1 from 0x3B000, size 0x4800 and IRAM1 from 0x20002000, size 0x2000. It compiled properly. My concern is the reason why I got m_boot_settings[] incorrectly if it is initialized without "const" restraint.

Reply
  • Thank you, Håkon Alseth ! Your way might work well. I set IROM1 from 0x3B000, size 0x4800 and IRAM1 from 0x20002000, size 0x2000. It compiled properly. My concern is the reason why I got m_boot_settings[] incorrectly if it is initialized without "const" restraint.

Children
No Data
Related