Read out the bootloader version from nrfutil from the main application

Hi

How can I read out the bootloader version from the main application which I defined in the zip packet (or merged hex) with nrfutil?

rfutil pkg generate --hw-version 52 --bootloader-version X

nrfutil settings generate --no-backup --family NRF52840 --application ' + input_app_file_name + ' --application-version 0 --bootloader-version X

I think this sould be availbale over a function or regiser in the main application?

  • Hello,

    The application version will be kept in the bootloader settings area in the last flash page (Memory layout), so you could get the version number from there.

    Example:

    #include "nrf_dfu_types.h"
    
    #define BOOTLOADER_SETTINGS_PAGE_ADDR 0xFF000
    
    int main(void)
    {
        bool erase_bonds;
    
        // Initialize.
        log_init();
        nrf_dfu_settings_t const * dfu_settings = (nrf_dfu_settings_t const *) BOOTLOADER_SETTINGS_PAGE_ADDR;
        NRF_LOG_INFO("Application version %d", dfu_settings->app_version);
        ...

    Include path for nrf_dfu_types.h is ../../../../../../components/libraries/bootloader/dfu

    The other alternative would be to integrate the DFU settings module in your application, but I don't think it makes sense in this case as you only need read access.

    Best regards,

    Vidar

Related