Hi There,
I am trying to utilize the application header feature and am running into a few strange issues. I notice there is no real information on how to use the application header information in the bootloader in any of the documentation I have read so this is how I am going about it:
In the boot loader I am defining the following struct:
typedef struct {
uint32_t headerVersion;
uint64_t firmwareVersion;
uint64_t firmwareSize;
uint32_t firmwareCRC;
uint32_t headerCRC;
}__attribute__((__packed__)) app_metadata_v1_t;
and then in the main function I am casting it to the memory address:
app_metadata_v1_t *active_app_metadata = (app_metadata_v1_t*) HEADER_ADDR;
My mbed_app.json is setup as follows:
"target.header_format": [
["headerVersion", "const", "32le", "2"],
["firmwareVersion", "timestamp", "64le", null],
["firmwareSize", "size", "64le", ["application"]],
["firmwareCRC", "digest", "CRCITT32le", "application"],
["headerCRC", "digest", "CRCITT32le", "header"]
]
And so, I am getting the following results when I print out the values of the struct:
Header Version = 2
FirmwareVersion = 301989888
FirmwareSize = 301989888
I am not sure why I am getting the exact same value for both Firmware Size and Version as the Header version is coming through correctly. It appears to me that on compile the firmware version and size values are not being populated correctly.
However here is the app_header.hex file generated by the main app:
:020000040002F8
:1000000002000000ED92295F0000000018DD0200F0
:0C0010000000000006AE16E41A6831DBA8
:00000001FF
Line 1 gives me the Header Version number 2 just fine:
:02 0000 04 0002 F8
Line 2 gives me both 64 byte values
:10 0000 00 02000000ED92295F 0000000018DD0200 F0
Line 3 gives me both 32 byte values
:0C 0010 00 00000000 06AE16E4 1A6831DBA8
I would love to hear from anyone who has tried this and had some success! Thanks