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

How to sign an image to use for FOTA for nrf9160?

Dear all,

I am trying to work with FOTA. I am able to run successfully the http_application_update.

But now, I want the device to download a custom firmware that I have written (very basic stuff).

From what I understood I need to somehow create a signed firmware image. How exactly can I do that? Can it be done using the SEGGER Studio?
Will this process of signing the image create the update.bin file that I need to upload to the server?

Parents
  • Hello, 

    From what I understood I need to somehow create a signed firmware image. How exactly can I do that? Can it be done using the SEGGER Studio?

    Have you looked at the HTTP Application Update documentation? "A signed firmware image that is available for download from an HTTP server. This image is automatically generated when building the application.

    When building the project, remember to edit prj.conf. 
    Configure the application version to be 2. To do so, either change CONFIG_APPLICATION_VERSION to 2 in the prj.conf file, or select Project > Configure nRF Connect SDK Project > HTTP application update sample in SEGGER Embedded Studio and change the value for Application version. Then rebuild the application.

    Kind regards,
    Øyvind 

Reply
  • Hello, 

    From what I understood I need to somehow create a signed firmware image. How exactly can I do that? Can it be done using the SEGGER Studio?

    Have you looked at the HTTP Application Update documentation? "A signed firmware image that is available for download from an HTTP server. This image is automatically generated when building the application.

    When building the project, remember to edit prj.conf. 
    Configure the application version to be 2. To do so, either change CONFIG_APPLICATION_VERSION to 2 in the prj.conf file, or select Project > Configure nRF Connect SDK Project > HTTP application update sample in SEGGER Embedded Studio and change the value for Application version. Then rebuild the application.

    Kind regards,
    Øyvind 

Children
  • Hello Oyvind,

    I think that there is a misunderstanding. What I want to do is to compile my own firmware application (for example something that simply prints "Hello world!"), put it on the server and have it downloaded from my device, have it installed and see the message on my terminal.

    I assume that this is what FOTA is about, right?

    So my question is how can I create the .bin file of my own custom written simple firmware.

  • I'm sorry, I did misunderstand. To generate a .bin file that is valid for download, it has to be signed with mcuboot. This can be done by adding the following to prj.conf of your application:

    CONFIG_BOOTLOADER_MCUBOOT=y
    This will automatically add the mcuboot project, and generate the update.bin file which is signed with the same key as found in mcuboot, as mentioned under Specifying the image file in the sample documentation.

    Let's say you want to download the AT_client sample via firmware.nRFCloud.com.
    1. Follow the Hosting your image on nRF Cloud steps from the HTTP Application Download. 
    2. After copying the URL as described in the steps above, start your HTTP Application Download sample in SES.
    3. In SES, select Project > Configure nRF Connect SDK Project > menuconfig > HTTP application update sample and add the host name and file to downlaod.
    4. Compile and program your board.
    5. Open the LTE Link Monitor and see that the output says (after a connection is established)
      ***** Booting Zephyr OS v1.14.99-ncs2 *****
      Press Button 1 to start the FOTA download


      This is where your application is added. In this case the AT_client
    6. Open the AT_client project via Open nRF Connect SDK project (remember to check Clean Build Directory)
    7. Project > Configure nRF Connect SDK Project > menuconfig and search for mcuboot. 
    8. Check the box MCUboot bootloader support and click configure
    9. Build the project. Once it is done, you should find update.bin in at_client\build_nrf9160_pca10090ns\zephyr
    10. Now upload the file to firmware.nrfcloud.com.
    11. Reset the device and ensure again that connection is established as step 5.
    12. Press Button 1 on the nRF9160 DK to start the download process and wait until “Download complete” is printed in the terminal.

    13. Press the RESET button on the board. MCUboot will now detect the downloaded image and write it to flash. This can take up to a minute and nothing is printed in the terminal while this is processing.

    14. Now you should see
      ***** Booting Zephyr OS v1.14.99-ncs2 *****
      The AT host sample started

    Let me know how that works for you, and if anything is unclear. 

    Kind regards,
    Øyvind
  • Hi Ovyind,

    Thank you for your explanation. I managed to figure out things on my own to a certain degree, but this response gave me all the necessary input to fill in my own gaps.

    Again thank you very much.

Related