AP_Bootloader: add support for printing current firmware and boot status

This commit is contained in:
bugobliterator 2024-02-08 16:07:05 +11:00 committed by Andrew Tridgell
parent d867364088
commit 7fabce6cb6
3 changed files with 15 additions and 3 deletions

View File

@ -134,6 +134,18 @@ int main(void)
try_boot = false;
led_set(LED_BAD_FW);
}
#if AP_BOOTLOADER_NETWORK_ENABLED
if (ok == check_fw_result_t::CHECK_FW_OK) {
const auto *app_descriptor = get_app_descriptor();
if (app_descriptor != nullptr) {
network.status_printf("Firmware OK: %ld.%ld.%lx\n", app_descriptor->version_major,
app_descriptor->version_minor,
app_descriptor->git_hash);
}
} else {
network.status_printf("Firmware Error: %d\n", (int)ok);
}
#endif
#endif // AP_CHECK_FIRMWARE_ENABLED
#ifndef BOOTLOADER_DEV_LIST
else if (timeout == HAL_BOOTLOADER_TIMEOUT) {

View File

@ -14,6 +14,7 @@ class BL_Network {
public:
void init(void);
void save_comms_ip(void);
void status_printf(const char *fmt, ...);
private:
struct netif *thisif;
@ -53,7 +54,6 @@ private:
HAL_Semaphore status_mtx;
char bl_status[256];
void status_printf(const char *fmt, ...);
};
#endif // AP_BOOTLOADER_NETWORK_ENABLED

View File

@ -78,7 +78,7 @@ static check_fw_result_t check_firmware_signature(const app_descriptor_signed *a
/*
check firmware CRC and board ID to see if it matches
*/
static check_fw_result_t check_good_firmware_signed(void)
static check_fw_result_t check_good_firmware_signed()
{
const uint8_t sig[8] = AP_APP_DESCRIPTOR_SIGNATURE_SIGNED;
const uint8_t *flash1 = (const uint8_t *)(FLASH_LOAD_ADDRESS + (FLASH_BOOTLOADER_LOAD_KB + APP_START_OFFSET_KB)*1024);
@ -130,7 +130,7 @@ static check_fw_result_t check_good_firmware_signed(void)
check firmware CRC and board ID to see if it matches, using unsigned
signature
*/
static check_fw_result_t check_good_firmware_unsigned(void)
static check_fw_result_t check_good_firmware_unsigned()
{
const uint8_t sig[8] = AP_APP_DESCRIPTOR_SIGNATURE_UNSIGNED;
const uint8_t *flash1 = (const uint8_t *)(FLASH_LOAD_ADDRESS + (FLASH_BOOTLOADER_LOAD_KB + APP_START_OFFSET_KB)*1024);