Fix issue with network core update when not a multiple of 4 bytes. The QSPI driver requires READ.CNT to be a multiple of 4 bytes (so read a bit more if odd remainder).

pull/507/head
David Garske 2024-10-08 12:33:29 -07:00 committed by Daniele Lacamera
parent d803a20217
commit 3e87c70fa2
1 changed files with 6 additions and 4 deletions

View File

@ -595,15 +595,17 @@ static void hal_net_check_version(void)
wolfBoot_verify_authenticity(&img) == 0)
{
wolfBoot_printf("Network image valid, loading into shared mem\n");
/* initialize remainder of shared memory with 0xFF (erased) */
memset(shm->data + shm->core.app.size, FLASH_BYTE_ERASED,
sizeof(shm->data) - shm->core.app.size);
/* relocate image to shared ram */
#ifdef EXT_FLASH
ret = ext_flash_read(PART_NET_ADDR, shm->data, shm->core.app.size);
/* must be multiple of 4 (READ.CNT length must be multiple of 4) */
ret = ext_flash_read(PART_NET_ADDR, shm->data,
(shm->core.app.size + 3) & ~3);
#else
memcpy(shm->data, img.hdr, shm->core.app.size);
#endif
/* initialize remainder of shared memory with 0xFF (erased) */
memset(shm->data + shm->core.app.size, FLASH_BYTE_ERASED,
sizeof(shm->data) - shm->core.app.size);
if (ret >= 0) {
doUpdateNet = 1;