Skip to content

Commit

Permalink
Example for using custom UART port/pin. Additional debug output on er…
Browse files Browse the repository at this point in the history
…ase of unused flash sectors.
  • Loading branch information
dgarske committed Oct 1, 2024
1 parent 09ccfd7 commit 49c58a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion config/examples/nrf5340.config
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ USE_GCC=1
CFLAGS_EXTRA+=-DFLASHBUFFER_SIZE=0x1000

# Enable optional power control pin (active low) P1.00
CFLAGS_EXTRA+=-DQSPI_PWR_CTRL_PORT=1 -DQSPI_PWR_CTRL_PIN=0
#CFLAGS_EXTRA+=-DQSPI_PWR_CTRL_PORT=1 -DQSPI_PWR_CTRL_PIN=0

# Use UART0 on P0.22
#CFLAGS_EXTRA+=-DUART_PORT=0 -DUART_PIN=22

CFLAGS_EXTRA+=-DDEBUG_FLASH
CFLAGS_EXTRA+=-DDEBUG_QSPI=1
5 changes: 1 addition & 4 deletions docs/Targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -2131,11 +2131,8 @@ Tested with the Nordic nRF5340-DK. This device has two cores:
1) Application core: Cortex-M33 at 128MHz, w/TrustZone, 1MB flash, 512KB RAM
2) Network core: Cortex-M33 at 64MHz, 256KB Flash and 64KB RAM
The cores communicate using the IPC peripheral.
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.
The DK board has two virtual COM ports. Application core and Network core will each output to different VCOM ports.
The cores communicate firmware updates using shared memory hosted on application core.
Example Boot Output:
Expand Down
4 changes: 3 additions & 1 deletion hal/nrf5340.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,11 @@ static void hal_net_check_version(void)
/* signal network core to do update */
hal_shm_status_set(&shm->app, SHARED_STATUS_UPDATE_START);

wolfBoot_printf("Waiting for net core update to finish...\n");

/* wait for update_done */
ret = hal_shm_status_wait(&shm->net,
SHARED_STATUS_UPDATE_DONE, 1000000);
SHARED_STATUS_UPDATE_DONE, 5000000);
if (ret == 0) {
wolfBoot_printf("Network core firmware update done\n");
}
Expand Down
4 changes: 3 additions & 1 deletion src/update_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ static int wolfBoot_swap_and_final_erase(int resume)
wb_flash_write(boot, tmpBootPos, (void*)tmpBuffer, sizeof(tmpBuffer));
}
/* erase the last boot sector(s) */
wolfBoot_printf("Erasing unused boot sectors...\n");
wb_flash_erase(boot, WOLFBOOT_PARTITION_SIZE - eraseLen, eraseLen);
/* set the encryption key */
#ifdef EXT_ENCRYPTED
Expand All @@ -281,6 +282,7 @@ static int wolfBoot_swap_and_final_erase(int resume)
/* mark boot as TESTING */
wolfBoot_set_partition_state(PART_BOOT, IMG_STATE_TESTING);
/* erase the last sector(s) of update */
wolfBoot_printf("Erasing unused update sectors...\n");
wb_flash_erase(update, WOLFBOOT_PARTITION_SIZE - eraseLen, eraseLen);
return 0;
}
Expand Down Expand Up @@ -440,7 +442,7 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
}
#ifndef DISABLE_BACKUP
/* start re-entrant final erase, return code is only for resumption in
* wolfBoot_start*/
* wolfBoot_start */
wolfBoot_swap_and_final_erase(0);
#endif
out:
Expand Down

0 comments on commit 49c58a8

Please sign in to comment.