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

Embedding firmware for external MCU in firmware image

I have another MCU on the same board as the Nordic 52832. The firmware update image for the MCU is about 50kb in size, so instead of adding a parallel DFU for the MCU through Bluetooth I figured I could just embed the firmware in the Nordic firmware. What is the best way to store this data in the firmware image so it isn't loaded into RAM but can be read directly from flash as required? I'm guessing if I store it in an array it will be loaded into RAM.

  • Hi Nick, 

    Could you explain a little bit more on what you are planing to do ?

    How do you send the firmware from the nRF52 chip to the 2nd MCU ? 

    How do you receive this firmware to the NRF52  ?

    You can merge 2 binary image in flash. I don't see the reason of using an array here. 

  • I want to store the firmware binary data inside the Nordic firmware so I can just use the Nordic DFU and don’t need to add a second DFU process. The data will then be sent to the MCU via serial. So I need to read the data from flash and send it over serial on the nRF.

  • Okey, so your plan is to send one single image from the phone via BLE to the NRF52. And the NRF52 will update both itself and the 2nd MCU. 

    I think it's possible. You just need to combine to binary images (binary .bin not the .hex file) into one binary. Then create a .zip DFU packet from that combined binary. Then you can update the .zip file. In your application, you can then read the 2nd image and send it via UART. 

    You may need to convert the combined binary back to hex to create the .zip file. 

    One draw back of this is that you need big enough swap bank area to receive 2 images at once. 

  • Yes correct.

    How can binary images be combined? Can nrfutil or mergehex do this? Then how can I get the flash location of this data in code?

    I thought DFU bootloader overwrites application flash directly?

  • Hi Nick, 

    I think it's easiest to use J-Link Commander to do the combination. There are functions called loadbin and savebin that you can load a binary file in a location that you choose and then you can load the combined binary out. 

    I have used the tool in my example for DFU master, you can find here. Check the documentation. 

    When you have the binary, you need to modify the .zip and the initpacket manually because nrfutil doesn't support .bin as input. Or you need to convert .bin to .hex (or use nrfjprog to read hex but you may need to modify the .hex so that it only contain the meaningful part not the 0xFFFFFFF part). 

    DFU bootloader when running in dual mode will not overwrite the application until the image is received. 

Related