Skip to content

Commit bd1215a

Browse files
committed
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).
1 parent 3e3d44b commit bd1215a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

hal/nrf5340.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,15 +595,17 @@ static void hal_net_check_version(void)
595595
wolfBoot_verify_authenticity(&img) == 0)
596596
{
597597
wolfBoot_printf("Network image valid, loading into shared mem\n");
598-
/* initialize remainder of shared memory with 0xFF (erased) */
599-
memset(shm->data + shm->core.app.size, FLASH_BYTE_ERASED,
600-
sizeof(shm->data) - shm->core.app.size);
601598
/* relocate image to shared ram */
602599
#ifdef EXT_FLASH
603-
ret = ext_flash_read(PART_NET_ADDR, shm->data, shm->core.app.size);
600+
/* must be multiple of 4 (READ.CNT length must be multiple of 4) */
601+
ret = ext_flash_read(PART_NET_ADDR, shm->data,
602+
(shm->core.app.size + 3) & ~3);
604603
#else
605604
memcpy(shm->data, img.hdr, shm->core.app.size);
606605
#endif
606+
/* initialize remainder of shared memory with 0xFF (erased) */
607+
memset(shm->data + shm->core.app.size, FLASH_BYTE_ERASED,
608+
sizeof(shm->data) - shm->core.app.size);
607609
if (ret >= 0) {
608610
doUpdateNet = 1;
609611

0 commit comments

Comments
 (0)