Report version info
This commit is contained in:
parent
cc6a2f6b96
commit
74a36a3ed6
|
@ -22,6 +22,8 @@
|
|||
#include "configuration_types.h"
|
||||
#include "bqf.h"
|
||||
#include "run.h"
|
||||
#include "version.h"
|
||||
#include "pico_base/pico/version.h"
|
||||
#ifndef TEST_TARGET
|
||||
#include "pico/multicore.h"
|
||||
#include "pico/stdlib.h"
|
||||
|
@ -391,14 +393,21 @@ bool process_cmd(tlv_header* cmd) {
|
|||
}
|
||||
case GET_VERSION: {
|
||||
if (cmd->length == 4) {
|
||||
static const char* PICO_SDK_VERSION = PICO_SDK_VERSION_STRING;
|
||||
size_t firmware_version_len = strnlen(FIRMWARE_GIT_HASH, 64);
|
||||
size_t pico_sdk_version_len = strnlen(PICO_SDK_VERSION_STRING, 64);
|
||||
|
||||
result->type = OK;
|
||||
result->length = 4 + sizeof(version_status_tlv);
|
||||
result->length = 4 + sizeof(version_status_tlv) + firmware_version_len + 1 + pico_sdk_version_len + 1;
|
||||
version_status_tlv* version = ((version_status_tlv*) result->value);
|
||||
version->header.type = VERSION_STATUS;
|
||||
version->header.length = sizeof(version_status_tlv);
|
||||
version->current_version = CONFIG_VERSION;
|
||||
version->minimum_supported_version = MINIMUM_CONFIG_VERSION;
|
||||
version->reserved = 0;
|
||||
version->reserved = 0xff;
|
||||
memcpy((void*) version->version_strings, FIRMWARE_GIT_HASH, firmware_version_len + 1);
|
||||
memcpy((void*) &(version->version_strings[firmware_version_len + 1]), PICO_SDK_VERSION_STRING, pico_sdk_version_len + 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -81,7 +81,7 @@ typedef struct __attribute__((__packed__)) _flash_header_tlv {
|
|||
tlv_header header;
|
||||
uint32_t magic;
|
||||
uint32_t version;
|
||||
const uint8_t tlvs[];
|
||||
const uint8_t tlvs[0];
|
||||
} flash_header_tlv;
|
||||
|
||||
typedef struct __attribute__((__packed__)) _preprocessing_configuration_tlv {
|
||||
|
@ -93,7 +93,7 @@ typedef struct __attribute__((__packed__)) _preprocessing_configuration_tlv {
|
|||
|
||||
typedef struct __attribute__((__packed__)) _filter_configuration_tlv {
|
||||
tlv_header header;
|
||||
const uint8_t filters[];
|
||||
const uint8_t filters[0];
|
||||
} filter_configuration_tlv;
|
||||
|
||||
typedef struct __attribute__((__packed__)) _pcm3060_configuration_tlv {
|
||||
|
@ -110,6 +110,7 @@ typedef struct __attribute__((__packed__)) _version_status_tlv {
|
|||
uint16_t current_version;
|
||||
uint16_t minimum_supported_version;
|
||||
uint32_t reserved;
|
||||
const char version_strings[0]; // Firmware version\0Pico SDK version\0
|
||||
} version_status_tlv;
|
||||
|
||||
typedef struct __attribute__((__packed__)) _default_configuration {
|
||||
|
|
Loading…
Reference in New Issue