Skip to content

Commit 832ac47

Browse files
dgarskedanielinux
authored andcommitted
Example for using custom UART port/pin. Additional debug output on erase of unused flash sectors.
1 parent eb175cd commit 832ac47

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

config/examples/nrf5340.config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ USE_GCC=1
4949
CFLAGS_EXTRA+=-DFLASHBUFFER_SIZE=0x1000
5050

5151
# Enable optional power control pin (active low) P1.00
52-
CFLAGS_EXTRA+=-DQSPI_PWR_CTRL_PORT=1 -DQSPI_PWR_CTRL_PIN=0
52+
#CFLAGS_EXTRA+=-DQSPI_PWR_CTRL_PORT=1 -DQSPI_PWR_CTRL_PIN=0
53+
54+
# Use UART0 on P0.22
55+
#CFLAGS_EXTRA+=-DUART_PORT=0 -DUART_PIN=22
5356

5457
CFLAGS_EXTRA+=-DDEBUG_FLASH
5558
CFLAGS_EXTRA+=-DDEBUG_QSPI=1

docs/Targets.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,11 +2186,8 @@ Tested with the Nordic nRF5340-DK. This device has two cores:
21862186
1) Application core: Cortex-M33 at 128MHz, w/TrustZone, 1MB flash, 512KB RAM
21872187
2) Network core: Cortex-M33 at 64MHz, 256KB Flash and 64KB RAM
21882188
2189-
The cores communicate using the IPC peripheral.
2190-
2191-
The network core can access application core resources (flash, RAM, and peripherals) when granted permission through the application's DCNF and SPU settings. A small portion of the application core RAM is dedicated to the exchange of messages between the application and network cores.
2192-
21932189
The DK board has two virtual COM ports. Application core and Network core will each output to different VCOM ports.
2190+
The cores communicate firmware updates using shared memory hosted on application core.
21942191
21952192
Example Boot Output:
21962193

hal/nrf5340.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,11 @@ static void hal_net_check_version(void)
466466
/* signal network core to do update */
467467
hal_shm_status_set(&shm->app, SHARED_STATUS_UPDATE_START);
468468

469+
wolfBoot_printf("Waiting for net core update to finish...\n");
470+
469471
/* wait for update_done */
470472
ret = hal_shm_status_wait(&shm->net,
471-
SHARED_STATUS_UPDATE_DONE, 1000000);
473+
SHARED_STATUS_UPDATE_DONE, 5000000);
472474
if (ret == 0) {
473475
wolfBoot_printf("Network core firmware update done\n");
474476
}

src/update_flash.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ static int wolfBoot_swap_and_final_erase(int resume)
265265
wb_flash_write(boot, tmpBootPos, (void*)tmpBuffer, sizeof(tmpBuffer));
266266
}
267267
/* erase the last boot sector(s) */
268+
wolfBoot_printf("Erasing unused boot sectors...\n");
268269
wb_flash_erase(boot, WOLFBOOT_PARTITION_SIZE - eraseLen, eraseLen);
269270
/* set the encryption key */
270271
#ifdef EXT_ENCRYPTED
@@ -281,6 +282,7 @@ static int wolfBoot_swap_and_final_erase(int resume)
281282
/* mark boot as TESTING */
282283
wolfBoot_set_partition_state(PART_BOOT, IMG_STATE_TESTING);
283284
/* erase the last sector(s) of update */
285+
wolfBoot_printf("Erasing unused update sectors...\n");
284286
wb_flash_erase(update, WOLFBOOT_PARTITION_SIZE - eraseLen, eraseLen);
285287
return 0;
286288
}
@@ -440,7 +442,7 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
440442
}
441443
#ifndef DISABLE_BACKUP
442444
/* start re-entrant final erase, return code is only for resumption in
443-
* wolfBoot_start*/
445+
* wolfBoot_start */
444446
wolfBoot_swap_and_final_erase(0);
445447
#endif
446448
out:

0 commit comments

Comments
 (0)