2019-10-21 00:46:49 -03:00
|
|
|
/*
|
|
|
|
application -> bootloader communication structure This is put into
|
|
|
|
the start of RAM by AP_Periph to facilitate firmware upload with
|
|
|
|
UAVCAN
|
|
|
|
*/
|
|
|
|
|
2019-10-25 22:45:33 -03:00
|
|
|
#pragma once
|
|
|
|
|
2019-10-21 00:46:49 -03:00
|
|
|
#define APP_BOOTLOADER_COMMS_MAGIC 0xc544ad9a
|
|
|
|
|
|
|
|
struct app_bootloader_comms {
|
|
|
|
uint32_t magic;
|
|
|
|
uint32_t reserved[4];
|
|
|
|
uint8_t server_node_id;
|
|
|
|
uint8_t my_node_id;
|
|
|
|
uint8_t path[201];
|
|
|
|
};
|
2019-10-25 22:45:33 -03:00
|
|
|
|
2019-10-27 20:46:29 -03:00
|
|
|
#ifndef FW_MAJOR
|
|
|
|
#define FW_MAJOR 0
|
|
|
|
#define FW_MINOR 0
|
|
|
|
#endif
|
|
|
|
|
2019-10-25 22:45:33 -03:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
suitable for this board. The build dependent values in this structure
|
|
|
|
are filled in by set_app_descriptor() in the waf build
|
|
|
|
*/
|
|
|
|
struct app_descriptor {
|
2019-10-27 20:46:29 -03:00
|
|
|
uint8_t sig[8] = { 0x40, 0xa2, 0xe4, 0xf1, 0x64, 0x68, 0x91, 0x06 };
|
2019-10-25 22:45:33 -03:00
|
|
|
// crc1 is the crc32 from firmware start to start of image_crc1
|
2019-10-27 20:46:29 -03:00
|
|
|
uint32_t image_crc1 = 0;
|
2019-10-25 22:45:33 -03:00
|
|
|
// crc2 is the crc32 from the start of version_major to the end of the firmware
|
2019-10-27 20:46:29 -03:00
|
|
|
uint32_t image_crc2 = 0;
|
2019-10-25 22:45:33 -03:00
|
|
|
// total size of firmware image in bytes
|
2019-10-27 20:46:29 -03:00
|
|
|
uint32_t image_size = 0;
|
|
|
|
uint32_t git_hash = 0;
|
2019-10-25 22:45:33 -03:00
|
|
|
// software version number
|
2019-10-27 20:46:29 -03:00
|
|
|
uint8_t version_major = FW_MAJOR;
|
|
|
|
uint8_t version_minor = FW_MINOR;
|
2019-10-25 22:45:33 -03:00
|
|
|
// APJ_BOARD_ID (hardware version). This is also used in CAN NodeInfo
|
|
|
|
// with high byte in HardwareVersion.major and low byte in HardwareVersion.minor
|
2019-10-27 20:46:29 -03:00
|
|
|
uint16_t board_id = APJ_BOARD_ID;
|
|
|
|
uint8_t reserved[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
2019-10-25 22:45:33 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
#define APP_DESCRIPTOR_TOTAL_LENGTH 36
|
|
|
|
static_assert(sizeof(app_descriptor) == APP_DESCRIPTOR_TOTAL_LENGTH, "app_descriptor incorrect length");
|