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

Flash examples with and without bootloader

Hello,

I tried to flash an application to the nRF52832. First I flashed the softdevice, after that I flashed the bootloader and next the application.

The application is not running and I read here that I ahve to merge the hex files so that the bootloader knows, that the app is valid, right?

If I would use the bootloader to flash an app, would the bootloader notice that this app is valid or do I have to flash everything together again?

Also, is it possible to jump out of the app to the bootloader? So that I could flah a new Image at any time without reseting the nRF?

EDIT

The Problem is, that I have the nRF connected to a SoC running Embedded Linux. The only connection I have to the SoC is UART (No hardware reset). The Bootloader on the nRF is only running for 2 seconds (or 3 min in the newer bootloader config but this is so much too long) but the Kernel needs some time to boot. So I thought of implementing a command in my application on the nRF that is received via UART and if the app receives this command it jumps to the bootloader and again waits 2 seconds for the new image.

How would I flash via BLE because it takes some time to connect to the device before flashing or not? Wouldn`t the bootloader exit its state and run the application before the connection is established and the firmware is sent

Thanks for your help

Parents
  • Assuming that you are using one of the latest version of the secure bootloader the following applies:

    When using the bootloader you need to flash what is called 'bootloader settings' to a specific address in memory. This is required so that the bootloader can validate the integrity of the application hex file.

    You can use nrfutil to generate this bootloader settings page for any given application hex file.

    github.com/.../pc-nrfutil (pip install nrfutil)

    The command would be something like

    nrfutil settings generate --family NRF52 --application "path/to/my/app.hex" --application-version 1 --bootloader-version 1 --bl-settings-version 1 bootloader_settings.hex
    

    This would generate a hex file which you need to flash alongside the bootloader, application and softdevice in order for your application to be started by the bootloader.

    EDIT Inline answers:

    If I would use the bootloader to flash an app, would the bootloader notice that this app is valid or do I have to flash everything together again?

    The bootloader verifies the correctness of the application by running a checksum on the received data and comparing it to the checksum contained in the DFU command received from the host.

    Also, is it possible to jump out of the app to the bootloader? So that I could flah a new Image at any time without reseting the nRF?

    I don't understand what you are asking. You can jump from the application to the bootloader at any point, however this usually requires some form of reset (softreset). It would help if you described the use-case.

    How would I flash via BLE because it takes some time to connect to the device before flashing or not? Wouldn`t the bootloader exit its state and run the application before the connection is established and the firmware is sent

    Once you have jumped to the bootloader using the "buttonless bootloader" functionality it will stay in "DFU mode" until an image has been received, or the device has been restarted.

  • I`ve editted my question, The Problem is, that I have the nRF connected to a SoC running Embedded Linux. The only connection I have to the SoC is UART (No hardware reset). The Bootloader on the nRF is only running for 2 seconds (or 3 min in the newer bootloader config but this is so much too long) but the Kernel needs some time to boot. So I thought of implementing a command in my application on the nRF that is received via UART and if the app receives this command it jumps to the bootloader and again waits 2 seconds for the new image.

Reply
  • I`ve editted my question, The Problem is, that I have the nRF connected to a SoC running Embedded Linux. The only connection I have to the SoC is UART (No hardware reset). The Bootloader on the nRF is only running for 2 seconds (or 3 min in the newer bootloader config but this is so much too long) but the Kernel needs some time to boot. So I thought of implementing a command in my application on the nRF that is received via UART and if the app receives this command it jumps to the bootloader and again waits 2 seconds for the new image.

Children
No Data
Related