2018-04-23 22:50:01 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 O.S.Systems
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2020-05-15 09:03:39 +08:00
|
|
|
#include <storage/flash_map.h>
|
|
|
|
|
2018-04-23 22:50:01 +08:00
|
|
|
#include "updatehub_firmware.h"
|
|
|
|
|
|
|
|
bool updatehub_get_firmware_version(char *version, int version_len)
|
|
|
|
{
|
|
|
|
struct mcuboot_img_header header;
|
|
|
|
|
2020-05-07 12:45:28 +08:00
|
|
|
if (boot_read_bank_header(FLASH_AREA_ID(image_0), &header,
|
2018-04-23 22:50:01 +08:00
|
|
|
version_len) != 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintk(version, version_len, "%d.%d.%d",
|
|
|
|
header.h.v1.sem_ver.major,
|
|
|
|
header.h.v1.sem_ver.minor,
|
|
|
|
header.h.v1.sem_ver.revision);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|