How to upload application without erasing bootloader data? (with segger embedded studio)

Hello everyone,

I'm trying to use the buttonless dfu functionality on nRF52 DK. However, I can't seem to test the functionality when there is no bootloader flashed, but if I do flash the bootloader, when I flash my application Segger Embedded Studio erases previous memory data. Is there any way to flash everything all at once or, in a better case, just flash my app and debug it without having to delete bootloader?

Thanks

edit: I'm using SDK v17.1.0, with S132. Also, i don't want to debug the bootloader, just the bluetooth connection, or at least the code before the connection

Parents
  • Hi,

    I can't seem to test the functionality when there is no bootloader flashed,

    Yes, that is expected. Refering to the buttonless DFU template application, the call to ble_dfu_buttonless_async_svci_init() will fail if the booloader is missing. If you comment it out, you should be able to test your application without a bootloader (except for the buttonless DFU feature of course).

    but if I do flash the bootloader, when I flash my application Segger Embedded Studio erases previous memory data.

    As long as the application and bootloader does not overlap (which they cannot do), programming one should not erase the other. Are you sure that is what happens? If so, can you make sure you don't do a recover or erase all operation when you program the other? That said, testing an application with a bootloaer can be a bit of a hazzle, as the bootlaoder will validate the application and only start a valid application. So whenver you progrem an application, you also need to generate and program the bootloader settings page (alternatively you can modify the bootloader to start the application without checking if it is valid).

  • when i try to download my code into the 52DK, a pop-up dialog says the device is secured, and its flash needs to be erased. when i do this, there's no bootloader left in my code.

    Are you sure that is what happens?
  • Hi,

    I see. The AP protect. mecahnism is enabled by deafult, unless disabled both in the UICR and by firmware. As you are using nRF5 SDK v17.1.0 this will disable AP Protect automatically in firmware, but only if you also write to the UICR (the simplest way to do this is to use an up to date nRF Command Line Tools, and call nrfjprog --recover before you program the device, and make sure you don't do an erase all after that (which will erase the UICR again). See Access port protection controlled by hardware and software for more information about this mecahnism.

  • You're really helping me out here. I have one last question, do you happen to know if there's any way to program the bootloader merged with my app using Segger Embedded Studio (yes, it's important to do it on ses)?

    thanks a lot

  • Hi,

    It is not something we support directly, and you would have to generate the bootlaoder settings page as well (unless you have modified the bootloader to skip validation during developlment). I expect you can do it with a Post-Build Command in Segger Embedded studio though, if that runs a script you write that generates bootloader settings, and merge the bootloader and settings page. If you also add the bootoader as an additional load hex file in the same way as the SoftDevice hex file is added to example proejcts, I expect that would work.

Reply
  • Hi,

    It is not something we support directly, and you would have to generate the bootlaoder settings page as well (unless you have modified the bootloader to skip validation during developlment). I expect you can do it with a Post-Build Command in Segger Embedded studio though, if that runs a script you write that generates bootloader settings, and merge the bootloader and settings page. If you also add the bootoader as an additional load hex file in the same way as the SoftDevice hex file is added to example proejcts, I expect that would work.

Children
No Data
Related