Skip to content

Commit 655ba46

Browse files
committed
Added more configuration options for stm32c0
1 parent c332cb9 commit 655ba46

File tree

4 files changed

+136
-6
lines changed

4 files changed

+136
-6
lines changed
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
ARCH?=ARM
2+
TARGET?=stm32c0
3+
SIGN?=LMS
4+
LMS_LEVELS=1
5+
LMS_HEIGHT=10
6+
LMS_WINTERNITZ=8
7+
IMAGE_SIGNATURE_SIZE=1456
8+
IMAGE_HEADER_SIZE=2048
9+
HASH?=SHA256
10+
DEBUG?=0
11+
VTOR?=1
12+
CORTEX_M0?=1
13+
NO_ASM?=0
14+
NO_MPU?=1
15+
EXT_FLASH?=0
16+
SPI_FLASH?=0
17+
ALLOW_DOWNGRADE?=0
18+
NVM_FLASH_WRITEONCE?=1
19+
WOLFBOOT_VERSION?=0
20+
V?=0
21+
SPMATH?=1
22+
DUALBANK_SWAP?=0
23+
24+
# Enable this to support wolfBoot self-update
25+
RAM_CODE?=0
26+
27+
# Use slightly smaller SHA2-256
28+
CFLAGS_EXTRA+=-DUSE_SLOW_SHA256
29+
30+
# Enable this feature for secure memory support
31+
# Makes the flash sectors for the bootloader unaccessible from the application
32+
# Requires using the STM32CubeProgrammer to set FLASH_SECR -> SEC_SIZE pages
33+
#CFLAGS_EXTRA+=-DFLASH_SECURABLE_MEMORY_SUPPORT
34+
35+
36+
#Partition: Boot: 8KB, App, 10KB
37+
WOLFBOOT_PARTITION_SIZE?=0x2800
38+
WOLFBOOT_SECTOR_SIZE?=0x800
39+
#Max WOLFBOOT size is 8KB
40+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08002000
41+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x085000
42+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x08007800
43+
44+
#Example debugging partition for larger wolfBoot
45+
#Partition: Boot: 22KB, App, 4K
46+
#DEBUG?=1
47+
#WOLFBOOT_PARTITION_SIZE?=0x1000
48+
#WOLFBOOT_SECTOR_SIZE?=0x800
49+
#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08005800
50+
#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08006800
51+
#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x08007800
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
ARCH?=ARM
2+
TARGET?=stm32c0
3+
SIGN?=RSA2048
4+
HASH?=SHA256
5+
DEBUG?=0
6+
VTOR?=1
7+
CORTEX_M0?=1
8+
NO_ASM?=0
9+
NO_MPU?=1
10+
EXT_FLASH?=0
11+
SPI_FLASH?=0
12+
ALLOW_DOWNGRADE?=0
13+
NVM_FLASH_WRITEONCE?=1
14+
WOLFBOOT_VERSION?=0
15+
V?=0
16+
SPMATH?=1
17+
DUALBANK_SWAP?=0
18+
19+
# Enable this to support wolfBoot self-update
20+
RAM_CODE?=0
21+
22+
# Use slightly smaller SHA2-256
23+
CFLAGS_EXTRA+=-DUSE_SLOW_SHA256
24+
25+
# Enable this feature for secure memory support
26+
# Makes the flash sectors for the bootloader unaccessible from the application
27+
# Requires using the STM32CubeProgrammer to set FLASH_SECR -> SEC_SIZE pages
28+
#CFLAGS_EXTRA+=-DFLASH_SECURABLE_MEMORY_SUPPORT
29+
30+
31+
#Partition: Boot: 12KB, App, 8KB
32+
WOLFBOOT_PARTITION_SIZE?=0x2000
33+
WOLFBOOT_SECTOR_SIZE?=0x800
34+
#Max WOLFBOOT size is 10KB
35+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08003000
36+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08005000
37+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x08007800
38+
39+
#Example debugging partition for larger wolfBoot
40+
#Partition: Boot: 22KB, App, 4K
41+
#DEBUG?=1
42+
#WOLFBOOT_PARTITION_SIZE?=0x1000
43+
#WOLFBOOT_SECTOR_SIZE?=0x800
44+
#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08005800
45+
#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08006800
46+
#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x08007800

config/examples/stm32c0.config

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
ARCH?=ARM
22
TARGET?=stm32c0
3-
#Supports ED25519/SHA384
4-
# No longer supported: RSA2048/SHA256
53
SIGN?=ED25519
64
HASH?=SHA384
75
DEBUG?=0

docs/Targets.md

+39-4
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,13 @@ mon reset init
443443
Supports STM32C0x0/STM32C0x1. Instructions are for the STM Nucleo-C031C6 dev board.
444444

445445
Tested build configurations:
446-
* With RSA2048 and SHA2-256 the code size is 9724 and it boots in under 1 second.
446+
* With RSA2048 and SHA2-256 the code size is 10988 and it boots in under 1 second.
447447
* With ED25519 and SHA2-384 the code size is 10024 and takes about 10 seconds for the LED to turn on.
448+
* With LMS-8-10-1 and SHA2-256 the code size is 8164
448449

449-
Example 32KB partitioning on STM32-G070:
450+
### Example 32KB partitioning on STM32-G070
451+
452+
with ED25519:
450453

451454
- Sector size: 2KB
452455
- Wolfboot partition size: 10KB
@@ -461,11 +464,43 @@ Example 32KB partitioning on STM32-G070:
461464
#define WOLFBOOT_PARTITION_SWAP_ADDRESS 0x08007800 /* at 30KB */
462465
```
463466

467+
with LMS:
468+
469+
- Sector size: 2KB
470+
- Wolfboot partition size: 8KB
471+
- Application partition size: 10 KB
472+
- Swap size 2KB
473+
474+
```C
475+
#define WOLFBOOT_SECTOR_SIZE 0x800 /* 2 KB */
476+
#define WOLFBOOT_PARTITION_BOOT_ADDRESS 0x08002000 /* at 8KB */
477+
#define WOLFBOOT_PARTITION_SIZE 0x2800 /* 10 KB */
478+
#define WOLFBOOT_PARTITION_UPDATE_ADDRESS 0x08005000 /* at 20KB */
479+
#define WOLFBOOT_PARTITION_SWAP_ADDRESS 0x08007800 /* at 30KB */
480+
```
481+
482+
with RSA2048:
483+
484+
- Sector size: 2KB
485+
- Wolfboot partition size: 12KB
486+
- Application partition size: 8 KB
487+
- Swap size 2KB
488+
489+
```C
490+
#define WOLFBOOT_SECTOR_SIZE 0x800 /* 2 KB */
491+
#define WOLFBOOT_PARTITION_BOOT_ADDRESS 0x08003000 /* at 12KB */
492+
#define WOLFBOOT_PARTITION_SIZE 0x2000 /* 8 KB */
493+
#define WOLFBOOT_PARTITION_UPDATE_ADDRESS 0x08005000 /* at 20KB */
494+
#define WOLFBOOT_PARTITION_SWAP_ADDRESS 0x08007800 /* at 30KB */
495+
```
496+
464497
### Building STM32C0
465498

466-
Reference configuration (see [/config/examples/stm32c0.config](/config/examples/stm32c0.config)).
499+
Reference configuration files (see [config/examples/stm32c0.config](/config/examples/stm32c0.config),
500+
[config/examples/stm32c0-rsa2048.config](/config/examples/stm32c0-rsa2048.config) and
501+
[config/examples/stm32c0-lms-8-10-1.config](/config/examples/stm32c0-lms-8-10-1.config)).
467502

468-
You can copy this to wolfBoot root as `.config`: `cp ./config/examples/stm32c0.config .config`.
503+
You can copy one of these to wolfBoot root as `.config`: `cp ./config/examples/stm32c0.config .config`.
469504
To build you can use `make`.
470505

471506
The TARGET for this is `stm32c0`: `make TARGET=stm32c0`.

0 commit comments

Comments
 (0)