AP_Bootloader: pre-define fields of app_descriptor

this is needed to store it in flash
This commit is contained in:
Andrew Tridgell 2019-10-28 10:46:29 +11:00
parent b5af1edf0d
commit ec1060d4f8
1 changed files with 14 additions and 9 deletions

View File

@ -16,6 +16,11 @@ struct app_bootloader_comms {
uint8_t path[201];
};
#ifndef FW_MAJOR
#define FW_MAJOR 0
#define FW_MINOR 0
#endif
/*
the app_descriptor stored in flash in the main firmware and is used
by the bootloader to confirm that the firmware is not corrupt and is
@ -23,21 +28,21 @@ struct app_bootloader_comms {
are filled in by set_app_descriptor() in the waf build
*/
struct app_descriptor {
uint8_t sig[8];
uint8_t sig[8] = { 0x40, 0xa2, 0xe4, 0xf1, 0x64, 0x68, 0x91, 0x06 };
// crc1 is the crc32 from firmware start to start of image_crc1
uint32_t image_crc1;
uint32_t image_crc1 = 0;
// crc2 is the crc32 from the start of version_major to the end of the firmware
uint32_t image_crc2;
uint32_t image_crc2 = 0;
// total size of firmware image in bytes
uint32_t image_size;
uint32_t git_hash;
uint32_t image_size = 0;
uint32_t git_hash = 0;
// software version number
uint8_t version_major;
uint8_t version_minor;
uint8_t version_major = FW_MAJOR;
uint8_t version_minor = FW_MINOR;
// APJ_BOARD_ID (hardware version). This is also used in CAN NodeInfo
// with high byte in HardwareVersion.major and low byte in HardwareVersion.minor
uint16_t board_id;
uint8_t reserved[8];
uint16_t board_id = APJ_BOARD_ID;
uint8_t reserved[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
};
#define APP_DESCRIPTOR_TOTAL_LENGTH 36