Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the Nordic nRF5340 #498

Merged
merged 19 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d301691
Support for the Nordic nRF5340 (application and network cores):
dgarske Sep 26, 2024
d45ec98
Improve network core firmware update.
dgarske Sep 27, 2024
680b9b4
Fixes for properly functioning network core updates.
dgarske Sep 27, 2024
69a95e8
Consolidate duplicate TEST_FLASH code.
dgarske Sep 27, 2024
f24ba5d
Fix for the `set_trailer_at` with external flash to use 32-bit write …
dgarske Sep 30, 2024
eb9b549
QSPI Power control (active low).
dgarske Oct 1, 2024
c8b0d74
Switch network core to use external flash HAL, but map to shared memo…
dgarske Oct 1, 2024
77dde99
Example for using custom UART port/pin. Additional debug output on er…
dgarske Oct 1, 2024
f832f74
Fixed and improved erase of remainder of partition logic and logging.…
dgarske Oct 1, 2024
e45124c
Attempt to not grow code size with end of partition sector erase chan…
dgarske Oct 1, 2024
7445d86
Enable backup for network core, so the last known image will still be…
dgarske Oct 1, 2024
55e9efe
Fix for nRF5340 `uart_write` issue with memchr args, which caused occ…
dgarske Oct 2, 2024
c0688ef
Improve the nRF5340 build script to support arguments.
dgarske Oct 2, 2024
f04d36f
Enable ECC384 and SHA384. Fix sleep_us. Add Cortex-M hard-fault handl…
dgarske Oct 3, 2024
0319028
Fix `sleep_us` logic to use RTC. Resolves issue with different optimi…
dgarske Oct 4, 2024
cecb813
Added tests for delta updates. Added logging for delta version errors…
dgarske Oct 4, 2024
3e3d44b
Switch to using IPC for communicating state. Prevents possible hard f…
dgarske Oct 8, 2024
bd1215a
Fix issue with network core update when not a multiple of 4 bytes. Th…
dgarske Oct 8, 2024
422f9e8
Support for SPU to write protect bootloader flash region on applicati…
dgarske Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gdbinit
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
file wolfboot.elf
tar rem:3333
add-symbol-file test-app/image.elf
set pagination off
foc c


20 changes: 20 additions & 0 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ jobs:
arch: arm
config-file: ./config/examples/nrf52840.config

nrf5340_app_test:
uses: ./.github/workflows/test-build.yml
with:
arch: arm
config-file: ./config/examples/nrf5340.config

nrf5340_net_test:
uses: ./.github/workflows/test-build.yml
with:
arch: arm
config-file: ./config/examples/nrf5340_net.config

nxp_p1021_test:
uses: ./.github/workflows/test-build.yml
with:
Expand Down Expand Up @@ -196,6 +208,14 @@ jobs:
config-file: ./config/examples/sim.config
make-args: SPMATH=1 WOLFBOOT_SMALL_STACK=0 WOLFBOOT_HUGE_STACK=1

sim_multi_sector_erase:
uses: ./.github/workflows/test-build.yml
with:
arch: host
config-file: ./config/examples/sim.config
make-args: CFLAGS_EXTRA=-DWOLFBOOT_FLASH_MULTI_SECTOR_ERASE


# TODO: SP math with small stack has issues

stm32c0:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ BIG_ENDIAN?=0
USE_GCC?=1
USE_GCC_HEADLESS?=1
FLASH_OTP_KEYSTORE?=0
BOOTLOADER_PARTITION_SIZE?=$$(( $(WOLFBOOT_PARTITION_BOOT_ADDRESS) - $(ARCH_FLASH_OFFSET)))

OBJS:= \
./src/string.o \
./src/image.o \
./src/libwolfboot.o \
./hal/hal.o \
./hal/$(TARGET).o

ifeq ($(SIGN),NONE)
Expand Down Expand Up @@ -140,7 +142,6 @@ ifeq ($(FLASH_OTP_KEYSTORE),1)
endif

ASFLAGS:=$(CFLAGS)
BOOTLOADER_PARTITION_SIZE?=$$(( $(WOLFBOOT_PARTITION_BOOT_ADDRESS) - $(ARCH_FLASH_OFFSET)))

all: $(MAIN_TARGET)

Expand Down
4 changes: 3 additions & 1 deletion arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ else
CFLAGS+=-mcpu=cortex-m33 -DCORTEX_M33
LDFLAGS+=-mcpu=cortex-m33
ifeq ($(TZEN),1)
OBJS+=hal/stm32_tz.o
ifneq (,$(findstring stm32,$(TARGET)))
OBJS+=hal/stm32_tz.o
endif
CFLAGS+=-mcmse
ifeq ($(WOLFCRYPT_TZ),1)
SECURE_OBJS+=./src/wc_callable.o
Expand Down
1 change: 1 addition & 0 deletions config/examples/nrf52840.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TARGET?=nrf52
SIGN?=ECC256
HASH?=SHA256
DEBUG?=0
DEBUG_UART?=1
VTOR?=1
CORTEX_M0?=0
NO_ASM?=0
Expand Down
65 changes: 65 additions & 0 deletions config/examples/nrf5340.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ARCH?=ARM
TZEN?=0
TARGET?=nrf5340
SIGN?=ECC384
HASH?=SHA384
WOLFBOOT_VERSION?=1
VTOR?=1
CORTEX_M0?=0
CORTEX_M33?=1
NO_ASM?=0
NO_MPU=1
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=0
DELTA_UPDATES?=1

SPMATH?=1
RAM_CODE?=1

DUALBANK_SWAP?=0
FLAGS_HOME=0
DISABLE_BACKUP=0
EXT_FLASH?=1
SPI_FLASH?=0
QSPI_FLASH?=1

# Flash is 4KB pages (app)
WOLFBOOT_SECTOR_SIZE?=0x1000

# Application offset (reserve 48KB for wolfBoot)
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xC000

# Application Partition Size (952KB)
WOLFBOOT_PARTITION_SIZE?=0xEE000

# External Flash offset for application update (1MB)
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x0

# External Flash offset for network update at 0x100000 (size=256KB)

# External Flash offset for swap (4KB)
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x140000

V?=0
DEBUG?=0
DEBUG_UART?=1
USE_GCC=1
OPTIMIZATION_LEVEL=2

# Optionally wait for network core to boot before starting application core
CFLAGS_EXTRA+=-DNRF_SYNC_CORES

# Use larger block size for swapping sectors (performance improvement)
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

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

#CFLAGS_EXTRA+=-DDEBUG_FLASH
#CFLAGS_EXTRA+=-DDEBUG_QSPI=1

# Hard fault debugging
#CFLAGS_EXTRA+=-DDEBUG_HARDFAULT
57 changes: 57 additions & 0 deletions config/examples/nrf5340_net.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
ARCH?=ARM
TZEN?=0
TARGET?=nrf5340_net
SIGN?=ECC384
HASH?=SHA384
WOLFBOOT_VERSION?=1
VTOR?=1
CORTEX_M0?=0
CORTEX_M33?=1
NO_ASM?=1
NO_MPU=1
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=0
DELTA_UPDATES?=1

SPMATH?=1
RAM_CODE?=1

DUALBANK_SWAP?=0
FLAGS_HOME=0
DISABLE_BACKUP=0
# Implementation maps to shared application core memory
EXT_FLASH?=1
SPI_FLASH?=0
QSPI_FLASH?=0

# Flash base for network core
ARCH_FLASH_OFFSET=0x01000000

# Flash is 2KB pages
WOLFBOOT_SECTOR_SIZE?=0x800

# Application offset (reserve 48KB for wolfBoot)
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x0100C000

# Application Partition Size (184KB)
WOLFBOOT_PARTITION_SIZE?=0x2E000

# Flash offset for update (provided by application core to shared memory)
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x100000

# Flash offset for swap (uses shared memory)
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x12E000

# Network core uses partition ID 2
WOLFBOOT_PART_ID=2

V?=0
DEBUG?=0
DEBUG_UART?=1
USE_GCC=1
OPTIMIZATION_LEVEL=2

#CFLAGS_EXTRA+=-DDEBUG_FLASH

# Hard fault debugging
#CFLAGS_EXTRA+=-DDEBUG_HARDFAULT
Loading
Loading