From 87d38f77bf371e66e60997f504965ee4f2c4175d Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Wed, 20 Sep 2023 09:05:19 +0200 Subject: [PATCH 1/3] Add WOLFSSL_SP_ARM_CORTEX_M_ASM to cortex-m33 --- arch.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch.mk b/arch.mk index 532f63581..d7233b4a9 100644 --- a/arch.mk +++ b/arch.mk @@ -167,7 +167,12 @@ ifeq ($(ARCH),ARM) CFLAGS += -mcmse endif ifeq ($(SPMATH),1) - MATH_OBJS += ./lib/wolfssl/wolfcrypt/src/sp_c32.o + ifeq ($(NO_ASM),1) + MATH_OBJS += ./lib/wolfssl/wolfcrypt/src/sp_c32.o + else + CFLAGS+=-DWOLFSSL_SP_ASM -DWOLFSSL_SP_ARM_CORTEX_M_ASM + MATH_OBJS += ./lib/wolfssl/wolfcrypt/src/sp_cortexm.o + endif endif else ifeq ($(CORTEX_M7),1) From 6ce0bbf013d2554e03cb91cf6eeea62e30a7d50d Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Wed, 20 Sep 2023 13:49:57 +0200 Subject: [PATCH 2/3] Stm32l5 configuration: increase wolfboot partition Bootloader partition expanded to 48KB to accommodate assembly optimizations in wolfBoot. --- config/examples/stm32l5-nonsecure-dualbank.config | 6 +++--- docs/Targets.md | 14 +++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/config/examples/stm32l5-nonsecure-dualbank.config b/config/examples/stm32l5-nonsecure-dualbank.config index 778962832..ba0214fc5 100644 --- a/config/examples/stm32l5-nonsecure-dualbank.config +++ b/config/examples/stm32l5-nonsecure-dualbank.config @@ -18,8 +18,8 @@ V?=0 SPMATH?=1 RAM_CODE?=0 DUALBANK_SWAP?=1 -WOLFBOOT_PARTITION_SIZE?=0x38000 +WOLFBOOT_PARTITION_SIZE?=0x36000 WOLFBOOT_SECTOR_SIZE?=0x800 -WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08008000 -WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08048000 +WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x0800a000 +WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x0804a000 WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xFFFFFFFF diff --git a/docs/Targets.md b/docs/Targets.md index be8fd4db3..1fa386fa5 100644 --- a/docs/Targets.md +++ b/docs/Targets.md @@ -174,10 +174,18 @@ To run flash `./test-app/image.bin` to `0x08000000`. Or program each partition using: 1. flash `wolfboot.bin` to 0x08000000: - `STM32_Programmer_CLI -c port=swd -d ./wolfboot.elf` -2. flash wolfBoot.bin to 0x0c00 0000 - - `STM32_Programmer_CLI -c port=swd -d ./test-app/image_v1_signed.bin 0x08008000` +2. flash main application to 0x0800 a000 + - `STM32_Programmer_CLI -c port=swd -d ./test-app/image_v1_signed.bin 0x0800a000` + +RED LD9 will be on indicating successful boot (). + +Updates can be flashed at 0x0804a000: + +- `STM32_Programmer_CLI -c port=swd -d ./test-app/image_v2_signed.bin 0x0804a000` + +The two partition are logically remapped by using BANK_SWAP capabilities. This partition +swap is immediate and does not require a SWAP partition. -RED LD9 will be on indicating successful boot () ### Debugging From 1121a1c5f85641e3ac38a8a4c1be6dd6d07f7d86 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Wed, 20 Sep 2023 13:52:29 +0200 Subject: [PATCH 3/3] Expanded wolfBoot partition in stm32U5-dualbank --- config/examples/stm32u5-nonsecure-dualbank.config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/examples/stm32u5-nonsecure-dualbank.config b/config/examples/stm32u5-nonsecure-dualbank.config index e1dc91401..c513b57ab 100644 --- a/config/examples/stm32u5-nonsecure-dualbank.config +++ b/config/examples/stm32u5-nonsecure-dualbank.config @@ -18,8 +18,8 @@ V?=0 SPMATH?=1 RAM_CODE?=0 DUALBANK_SWAP?=1 -WOLFBOOT_PARTITION_SIZE?=0x38000 +WOLFBOOT_PARTITION_SIZE?=0x36000 WOLFBOOT_SECTOR_SIZE?=0x2000 -WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08008000 -WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08108000 +WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x0800a000 +WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x0810a000 WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xFFFFFFFF