Manually writing firmware images to mcuboot slots - how to access the flags and meta information?

Hi, I need a little help with mcuboot.

We want to transfer firmware updates via CAN (MCP2515), which is already implemented. Was we are short of time, and we want to integrate the update process into our existing CAN based service software, we didn't implement a mcumgr tunnel via CAN, but try to directly access the mcuboot slots.

As far as I understand from all the documentation and the tutorials, I have to perform the following steps to manually do the

  • Upload the correct firmware image (app_update.bin / net_core_app_update.bin) to the corresponding slots
  • Set the image as pending and mark it as confirmed beforehand (so that it is kept as active image permanently)
  • Perform a reset and wait for the update process to finish (mcuboot)
  • Optional: Mark the new image as confirmed in the first run if it was not done before

I assume that the status bits of the image are somewhere within the mcuboot_pad section which is a 512 bytes section before the actual code begins.

Can anyone please help me with the following questions?

  • Where can I find the content definition for the mcuboot_pad section?
  • Which bit do I have to set to mark the image as pending?
  • Which bit do I have to set to mark the image as confirmed? (mark the image as valid automatically, like setting the confirmed checkbox in Auterm)
    • I currently do not manually confirm my image in the code. Does a normal nRF Connect project confirm new firmware automatically once it starts running, or do I manually have to confirm it? Like mentioned before, for my other project, I just used the confirmed checkbox in Autoerm when updating via USB / mcumgr.
  • Where can I find the bits that tell me that an update has failed?
  • Where can I find the hash values of the images? Do I have to calculate them manually or are they stored somewhere in the flash memory and update binaries?
  • I have read that it is possible to update both NET core and APP core at the same time (using two update slots), reverting both images if either of them fails (which is important when performing updates via Bluetooth/OTA). Do I have to manually set up the dependency of the image pair? How do I do it?
  • (Update) How can I create a third slot (beside mcuboot_primary and mcuboot_secondary) for the NET core update? I couldn't find a CONFIG_* option. Can I just manually reserve some space for the third slot in pm_static.yml? Will it be automatically recognized by mcuboot if I call it mcuboot_tertiary or so?

Please reply with low level information, e.g. memory offsets within the slots and references to bit field definitions etc. I find it extremely difficult to find the needed information in online documentations, as most descriptions are kept abstract and contain high-level and concept information only. If there is a simple tutorial available which works with the low level data structures, please let me know!

Best regards,
Michael

Parents Reply
  • Hi Michael,

    Here are the comments to the two previous questions:

    • Can update both at the same time but netcore is unrevertable(current implementation will copy garbage from RAM into network core if you enable it).
    • It won't be automatically recognized, you could do mcuboot_primary_1 and mcuboot_secondary_1 and have number of images 3 but support is a bit hard coded so a few new defines needs to be made.

    Good luck to your development. Just let me know if you need more help.

    Best regards,

    Charlie

Children
No Data
Related