This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Flash and debug application with signed bootloader in IAR or how to flash Bootloader Settings before debugging

I have a project which needs to be built in IAR, but uses the signed bootloader. I understand, that if I want to flash and debug the application from within IAR, I need to also write the Bootloader Settings page, otherwise the application won't be loaded because the CRC check failed.

How can I do this in IAR before starting the debugger? In Keil uVision 5, there is the possibility to load the bootloader settings using an init file (in the "Utilities" tab, section "Configure Flash Menu Command"). In the init file, I can simply load the "settings.hex" generated by nrfutil. Unfortunately I fail to find an equivalent possibility in Keil.

Do you have any pointers or are there example projects where this works?

  • Hi Wagner,

    Can you just flash settings.hex manually using nrfjprog, or merge the settings.hex with the bootloader and the application hex (using merge hex) ?

  • Hi Hung Bui, Thanks for your suggestions. I would like to get this to run from within IAR upon application download to make the development/debug process more straight forward. From my understanding, when downloading the application IAR does not load any .hex files but just its own ".out"-binary format, so merging the two hex-files is not that useful in my use case. Of course, technically it would be possible to flash the bootloader settings manually, but it's a bit inconvenient, especially when the application is often flashed.

  • I see. I'm not aware of a way to run a script or to combine hex with IAR, don't have much experience with this compiler. But I am thinking that you can simply disable CRC check in the bootloader in your development. And update the bootloader CRC check back when you make the release.

  • I managed to solve the issue using the following steps:

    1. Converted the .hex-file generated by nrfutil to a raw binary file.
    2. Created an additional IAR-project for the bootloader settings, which is configured according to the IAR Technical Note 21367, with linker addresses adjusted to match the bootloader settings page and including the binary generated in 1. This is actually configured to be done in the pre-build of this IAR-project.
    3. In the post-build of the actual application IAR-project, generate the bootloader settings .hex-file using nRF-util and then invoke the IAR build of the bootloader settings IAR-project.
    4. In the project settings of the application IAR project, go to "Debugger" > "Images" and tick "Download extra image" and select the .out-file generated in the bootloader settings IAR-project and set the offset to the location of the Bootloader-settings page.
  • Thanks, that would have been an option. In the meantime I was able to solve the issue.

Related