Retrieve MCUBoot version from main application

Hi,

I'm trying to retrieve the MCUBoot version inside my application (from the VERSION file).

In the Zephyr documentation (docs.zephyrproject.org/.../index.html), I found that I can access app_version.h (located in /app/build/app/zephyr/include/generated/app_version.h).

A similar file exists in the MCUBoot build folder (/app/build/mcuboot/zephyr/include/generated/app_version.h).

I'm facing two problems:
1) I can't find a way to include the MCUBoot app_version.h file in my code.
2) Assuming I can include it, it uses the same macro names as the application. In my code, I need to use both the application version and the MCUBoot version. How can I modify the macro names generated for MCUBoot to avoid conflicts?

thanks

Parents Reply
  • Hi Sigard,

    Thank you for your response. I’ve been trying to use the FW Info API as suggested, but I’m still struggling with some aspects. I need to gather the following data before proceeding with the DFU for MCUBoot:

    1. Determine which slot is active (s0/s1):
      The issue here is that the version alone isn’t enough. For example, the second slot might have a newer version, but if it’s invalid, it doesn’t count, and only the other slot would be relevant. In this case, I need to reliably determine the active slot.

    2. Retrieve the firmware version:
      For this, I have an idea: I plan to read the TLV using the fw_info struct to extract the uint32_t version variable. Is this a good way to retrieve the version at runtime? Alternatively, should I use retained memory to get this information, assuming MCUBoot has the ability to write to that area?

    Could you please confirm if this is the correct approach, or suggest any better alternatives?

    Thanks for your help!

Children
Related