From 92042925b129a4f60ccb0c806c536f36aceec94d Mon Sep 17 00:00:00 2001 From: Teemu Takaluoma Date: Wed, 26 Aug 2020 14:57:57 +0300 Subject: [PATCH] pelion-client-lite 1.2.1-lite --- CHANGELOG.md | 6 +++++- fota/fota_candidate.c | 11 +++++++++-- mbed-client/source/lwm2m_endpoint.c | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbe459f..e66dc5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## Changelog for Pelion Device Management Client Lite -### Release 1.2.0-lite (19.08.2020) +### Release 1.2.1-lite (26.08.2020) + +Fixed handling of partially written (due to power-cut) flash pages while installing the FW candidate. + +### Release 1.2.0-lite (17.08.2020) * Fixed an issue where Client Lite would trigger sleep-callback during the bootstrapping process. * Changed the notification handler to send a notification only when crossing the "less than" or "greater than" notification threshold values. diff --git a/fota/fota_candidate.c b/fota/fota_candidate.c index 6960744..52d3c5e 100644 --- a/fota/fota_candidate.c +++ b/fota/fota_candidate.c @@ -310,12 +310,15 @@ static int fota_candidate_extract_fragment(uint8_t **buf, uint32_t *actual_size, FOTA_DBG_ASSERT(ctx); - *ignore = false; // Move extra bytes from last time from end to beginning of buffer - memcpy(ctx->fragment_buf, ctx->fragment_buf + *actual_size, ctx->frag_extra_bytes); + if (!*ignore) { + memcpy(ctx->fragment_buf, ctx->fragment_buf + *actual_size, ctx->frag_extra_bytes); + } *buf = ctx->fragment_buf + ctx->frag_extra_bytes; + *ignore = false; + *actual_size = MIN(ctx->header_info.fw_size - ctx->bytes_completed, ctx->effective_block_size); if (!*actual_size) { return FOTA_STATUS_SUCCESS; @@ -457,6 +460,10 @@ int fota_candidate_iterate_image(bool validate, bool force_encrypt, const char * // Start iteration phase + actual_size = 0; + ctx->frag_extra_bytes = 0; + ignore = false; + ret = fota_candidate_extract_start(force_encrypt, expected_comp_name, install_alignment); if (ret) { goto fail; diff --git a/mbed-client/source/lwm2m_endpoint.c b/mbed-client/source/lwm2m_endpoint.c index dfd2763..6441121 100644 --- a/mbed-client/source/lwm2m_endpoint.c +++ b/mbed-client/source/lwm2m_endpoint.c @@ -44,7 +44,7 @@ #define TRACE_GROUP "lwEP" -static const char MCC_VERSION[] = "mccv=1.2.0-lite"; +static const char MCC_VERSION[] = "mccv=1.2.1-lite"; static const char ep_name_parameter[] = "ep="; /* Endpoint name. A unique name for the registering node in a domain. */ static const uint8_t resource_path[] = {'r', 'd'}; /* For resource directory */