Skip to content

Commit f89eb94

Browse files
committed
Minor cleanups for flash partitioning and documentation.
1 parent 2916a8d commit f89eb94

File tree

5 files changed

+63
-80
lines changed

5 files changed

+63
-80
lines changed

config/examples/vorago_va416x0.config

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DUALBANK_SWAP?=0
2323
PKA?=0
2424
ENCRYPT=0
2525
WOLFTPM?=0
26+
OPTIMIZATION_LEVEL=1
2627

2728
# Optionally allow downgrade to older valid version in update partition
2829
ALLOW_DOWNGRADE?=0
@@ -34,21 +35,14 @@ NO_ARM_ASM?=0
3435
# Optional: Use smaller SHA512
3536
#CFLAGS_EXTRA+=-DUSE_SLOW_SHA512
3637

37-
# 1KB sector
38-
WOLFBOOT_SECTOR_SIZE?=0x400
39-
40-
# 32KB boot, 112KB partitions, 1KB swap
41-
WOLFBOOT_PARTITION_SIZE?=0x1C000
42-
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x8000
43-
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x24000
44-
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x3FC00
45-
46-
# Alternate layout for DEBUG=1 wolfBoot
47-
# 63KB boot, 96KB partitions, 1KB swap
48-
#WOLFBOOT_PARTITION_SIZE?=0x18000
49-
#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xFC00
50-
#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x27C00
51-
#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x3FC00
38+
# 2KB sector
39+
WOLFBOOT_SECTOR_SIZE?=0x800
40+
41+
# 38KB boot, 108KB partitions, 2KB swap
42+
WOLFBOOT_PARTITION_SIZE?=0x1B000
43+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x9800
44+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x24800
45+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x3F800
5246

5347
# Vorago SDK common drivers directory
5448
VORAGO_SDK_DIR?=$(PWD)/../VA416xx_SDK/

docs/Targets.md

Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,9 +3583,21 @@ Tested on VA41620 and VA41630 MCU's.
35833583

35843584
MCU: Cortex-M4 with Triple-Mode Redundancy (TMR) RAD hardening at up to 100MHz.
35853585
FLASH: The VA41630 has 256KB of internal SPI FRAM (for the VA41620 its external). FRAM is Infineon FM25V20A.
3586-
SRAM: 64KB on-chip SRAM and 256KB on-chip program memory
35873586

3588-
Boot ROM loads at 20MHz from SPI bus to internal data SRAM
3587+
Default flash layout:
3588+
3589+
| Partition | Size | Address | Description |
3590+
|-----------|-------|---------|-------------|
3591+
| Boot | 38KB | 0x0 | Bootloader partition |
3592+
| Boot | 108KB | 0x9800 | Boot partition |
3593+
| Update | 108KB | 0x24800 | Update partition |
3594+
| Swap | 2KB | 0x3F800 | Swap area |
3595+
3596+
SRAM: 64KB on-chip SRAM and 256KB on-chip instruction/program memory
3597+
3598+
Boot ROM loads at 20MHz from SPI bus to internal data SRAM.
3599+
3600+
By default the bootloader is built showing logs on UART0. To use UART1 set `DEBUG_UART_NUM=1`. To disable the bootloader UART change `DEBUG_UART=0` in the `.config`.
35893601

35903602
### Building Vorago VA416x0
35913603

@@ -3638,14 +3650,14 @@ make VORAGO_SDK_DIR=$PWD../VA416xx_SDK/
36383650
[BIN] wolfboot.bin
36393651
[SIZE]
36403652
text data bss dec hex filename
3641-
33900 4 26976 60880 edd0 wolfboot.elf
3653+
37480 4 26976 64460 fbcc wolfboot.elf
36423654
```
36433655

36443656
### Flashing Vorago VA416x0
36453657

3646-
Flash using Segger JLink: `JLinkExe -CommanderScript tools/scripts/flash_va416xx.jlink`
3658+
Flash using Segger JLink: `JLinkExe -CommanderScript tools/scripts/va416x0/flash_va416xx.jlink`
36473659

3648-
Example JLink flash script `tools/scripts/flash_va416xx.jlink`:
3660+
Example JLink flash script `tools/scripts/va416x0/flash_va416xx.jlink`:
36493661

36503662
```
36513663
device VA416XX
@@ -3654,6 +3666,7 @@ speed 2000
36543666
r
36553667
h
36563668
write4 0x40010010 0x1
3669+
exec SetCompareMode = 0
36573670
loadbin factory.bin 0x0
36583671
write4 0x40010010 0x0
36593672
loadfile ../VA416xx_SDK/loader.elf
@@ -3666,9 +3679,9 @@ Example boot ouput on UART 0 (MCU TX):
36663679

36673680
```
36683681
wolfBoot HAL Init
3669-
Boot partition: 0xFC00 (sz 5144, ver 0x1, type 0x601)
3670-
Partition 1 header magic 0x00000000 invalid at 0x27C00
3671-
Boot partition: 0xFC00 (sz 5144, ver 0x1, type 0x601)
3682+
Boot partition: 0x9800 (sz 5764, ver 0x1, type 0x601)
3683+
Partition 1 header magic 0x00000000 invalid at 0x24800
3684+
Boot partition: 0x9800 (sz 5764, ver 0x1, type 0x601)
36723685
Booting version: 0x1
36733686
========================
36743687
VA416x0 wolfBoot demo Application
@@ -3707,7 +3720,7 @@ Run: `arm-none-eabi-gdb`. This will source the `.gdbinit` to load symbols for `w
37073720

37083721
Note: This test was run with DEBUG=1 and DEBUG_UART=1 to generate logging on the UART.
37093722

3710-
See `tools/scripts/vorago/build_test_update.sh`:
3723+
See `tools/scripts/va416x0/build_test_update.sh`:
37113724

37123725
```sh
37133726
# Sign a new test app with version 2
@@ -3718,11 +3731,11 @@ echo -n "pBOOT" > trigger_magic.bin
37183731

37193732
# Assembly new factory update.bin
37203733
./tools/bin-assemble/bin-assemble \
3721-
update.bin \
3722-
0x0 wolfboot.bin \
3723-
0xFC00 test-app/image_v1_signed.bin \
3724-
0x27C00 test-app/image_v2_signed.bin \
3725-
0x3FBFB trigger_magic.bin
3734+
update.bin \
3735+
0x0 wolfboot.bin \
3736+
0x9800 test-app/image_v1_signed.bin \
3737+
0x24800 test-app/image_v2_signed.bin \
3738+
0x3F7FB trigger_magic.bin
37263739

37273740
# Use JLink to load
37283741
device VA416XX
@@ -3731,6 +3744,7 @@ speed 2000
37313744
r
37323745
h
37333746
write4 0x40010010 0x1
3747+
exec SetCompareMode = 0
37343748
loadbin update.bin 0x0
37353749
write4 0x40010010 0x0
37363750
loadfile ../VA416xx_SDK/loader.elf
@@ -3741,19 +3755,17 @@ Example update output:
37413755

37423756
```
37433757
wolfBoot HAL Init
3744-
Boot partition: 0xFC00 (sz 8976, ver 0x1, type 0x601)
3745-
Update partition: 0x27C00 (sz 8976, ver 0x2, type 0x601)
3758+
Boot partition: 0x9800 (sz 5764, ver 0x1, type 0x601)
3759+
Update partition: 0x24800 (sz 5764, ver 0x2, type 0x601)
37463760
Starting Update (fallback allowed 0)
3747-
Update partition: 0x27C00 (sz 8976, ver 0x2, type 0x601)
3748-
Boot partition: 0xFC00 (sz 8976, ver 0x1, type 0x601)
3749-
verify integrity: img 0x1FFFE844, part 1
3750-
verify authenticity: img 0x1FFFE844, part 1
3761+
Update partition: 0x24800 (sz 5764, ver 0x2, type 0x601)
3762+
Boot partition: 0x9800 (sz 5764, ver 0x1, type 0x601)
37513763
Versions: Current 0x1, Update 0x2
37523764
Copy sector 0 (part 1->2)
37533765
Copy sector 0 (part 0->1)
37543766
Copy sector 0 (part 2->0)
3755-
Boot partition: 0xFC00 (sz 8976, ver 0x2, type 0x601)
3756-
Update partition: 0x27C00 (sz 8976, ver 0x1, type 0x601)
3767+
Boot partition: 0x9800 (sz 5764, ver 0x2, type 0x601)
3768+
Update partition: 0x24800 (sz 5764, ver 0x1, type 0x601)
37573769
Copy sector 1 (part 1->2)
37583770
Copy sector 1 (part 0->1)
37593771
Copy sector 1 (part 2->0)
@@ -3763,33 +3775,13 @@ Copy sector 2 (part 2->0)
37633775
Copy sector 3 (part 1->2)
37643776
Copy sector 3 (part 0->1)
37653777
Copy sector 3 (part 2->0)
3766-
Copy sector 4 (part 1->2)
3767-
Copy sector 4 (part 0->1)
3768-
Copy sector 4 (part 2->0)
3769-
Copy sector 5 (part 1->2)
3770-
Copy sector 5 (part 0->1)
3771-
Copy sector 5 (part 2->0)
3772-
Copy sector 6 (part 1->2)
3773-
Copy sector 6 (part 0->1)
3774-
Copy sector 6 (part 2->0)
3775-
Copy sector 7 (part 1->2)
3776-
Copy sector 7 (part 0->1)
3777-
Copy sector 7 (part 2->0)
3778-
Copy sector 8 (part 1->2)
3779-
Copy sector 8 (part 0->1)
3780-
Copy sector 8 (part 2->0)
3781-
Copy sector 9 (part 1->2)
3782-
Copy sector 9 (part 0->1)
3783-
Copy sector 9 (part 2->0)
3784-
Erasing remainder of partition (85 sectors)...
3785-
Boot partition: 0xFC00 (sz 8976, ver 0x2, type 0x601)
3786-
Update partition: 0x27C00 (sz 8976, ver 0x1, type 0x601)
3787-
Copy sector 94 (part 0->2)
3778+
Erasing remainder of partition (49 sectors)...
3779+
Boot partition: 0x9800 (sz 5764, ver 0x2, type 0x601)
3780+
Update partition: 0x24800 (sz 5764, ver 0x1, type 0x601)
3781+
Copy sector 52 (part 0->2)
37883782
Copied boot sector to swap
3789-
Boot partition: 0xFC00 (sz 8976, ver 0x2, type 0x601)
3783+
Boot partition: 0x9800 (sz 5764, ver 0x2, type 0x601)
37903784
Booting version: 0x1
3791-
verify integrity: img 0x1FFFE904, part 0
3792-
verify authenticity: img 0x1FFFE904, part 0
37933785
========================
37943786
VA416x0 wolfBoot demo Application
37953787
Copyright 2025 wolfSSL Inc
@@ -3825,12 +3817,10 @@ Boot logs after hard reset:
38253817

38263818
```
38273819
wolfBoot HAL Init
3828-
Boot partition: 0xFC00 (sz 8976, ver 0x2, type 0x601)
3829-
Update partition: 0x27C00 (sz 8976, ver 0x1, type 0x601)
3830-
Boot partition: 0xFC00 (sz 8976, ver 0x2, type 0x601)
3820+
Boot partition: 0x9800 (sz 5764, ver 0x2, type 0x601)
3821+
Update partition: 0x24800 (sz 5764, ver 0x1, type 0x601)
3822+
Boot partition: 0x9800 (sz 5764, ver 0x2, type 0x601)
38313823
Booting version: 0x2
3832-
verify integrity: img 0x1FFFE904, part 0
3833-
verify authenticity: img 0x1FFFE904, part 0
38343824
========================
38353825
VA416x0 wolfBoot demo Application
38363826
Copyright 2025 wolfSSL Inc

hal/va416x0.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,21 @@ const stc_iocfg_pin_cfg_t bootDefaultConfig[] =
8888

8989
static void UartInit(VOR_UART_Type* uart, uint32_t baudrate)
9090
{
91-
if (VOR_UART0 == uart){
91+
if (VOR_UART0 == uart) {
9292
VOR_SYSCONFIG->PERIPHERAL_CLK_ENABLE |= CLK_ENABLE_UART0;
9393
uart->CLKSCALE = UART_CALC_CLOCKSCALE(UART_CLK, baudrate);
94-
} else if (VOR_UART1 == uart){
94+
} else if (VOR_UART1 == uart) {
9595
VOR_SYSCONFIG->PERIPHERAL_CLK_ENABLE |= CLK_ENABLE_UART1;
9696
uart->CLKSCALE = UART_CALC_CLOCKSCALE(UART_CLK, baudrate);
97-
} else if (VOR_UART2 == uart){
97+
} else if (VOR_UART2 == uart) {
9898
VOR_SYSCONFIG->PERIPHERAL_CLK_ENABLE |= CLK_ENABLE_UART2;
9999
uart->CLKSCALE = UART_CALC_CLOCKSCALE(UART2_CLK, baudrate);
100100
} else {
101101
return;
102102
}
103103

104104
/* Configure word size and RTS behavior. */
105-
uart->CTRL = (3 << UART_CTRL_WORDSIZE_Pos) |
106-
(UART_CTRL_DEFRTS_Msk);
105+
uart->CTRL = (3 << UART_CTRL_WORDSIZE_Pos) | (UART_CTRL_DEFRTS_Msk);
107106

108107
/* Enable CTS flow control IO, if needed */
109108
#ifdef configUART_CTS_FLOW_CONTROL
@@ -120,10 +119,10 @@ static void UartInit(VOR_UART_Type* uart, uint32_t baudrate)
120119
uart->RXFIFOIRQTRG = 1;
121120
uart->TXFIFOIRQTRG = 8;
122121

123-
if (VOR_UART0 == uart){
122+
if (VOR_UART0 == uart) {
124123
NVIC_SetPriority(UART0_RX_IRQn, 1);
125124
NVIC_EnableIRQ(UART0_RX_IRQn);
126-
} else if (VOR_UART1 == uart){
125+
} else if (VOR_UART1 == uart) {
127126
NVIC_SetPriority(UART1_RX_IRQn, 1);
128127
NVIC_EnableIRQ(UART1_RX_IRQn);
129128
} else {

tools/scripts/va416x0/build_test_clean.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ make test-app/image.bin
77

88
IMAGE_HEADER_SIZE=512 ./tools/keytools/sign --ecc384 --sha384 test-app/image.bin wolfboot_signing_private_key.der 1
99

10-
dd if=/dev/zero of=blank_update.bin bs=1K count=97
10+
dd if=/dev/zero of=blank_update.bin bs=1K count=108
1111

1212
./tools/bin-assemble/bin-assemble \
1313
factory.bin \
1414
0x0 wolfboot.bin \
15-
0xFC00 test-app/image_v1_signed.bin \
16-
0x27C00 blank_update.bin
15+
0x9800 test-app/image_v1_signed.bin \
16+
0x24800 blank_update.bin
1717

1818
JLinkExe -CommanderScript tools/scripts/va416x0/flash_va416xx.jlink

tools/scripts/va416x0/build_test_update.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ echo -n "pBOOT" > trigger_magic.bin
99
./tools/bin-assemble/bin-assemble \
1010
update.bin \
1111
0x0 wolfboot.bin \
12-
0xFC00 test-app/image_v1_signed.bin \
13-
0x27C00 test-app/image_v2_signed.bin \
14-
0x3FBFB trigger_magic.bin
12+
0x9800 test-app/image_v1_signed.bin \
13+
0x24800 test-app/image_v2_signed.bin \
14+
0x3F7FB trigger_magic.bin
1515

1616
JLinkExe -CommanderScript tools/scripts/va416x0/flash_va416xx_update.jlink

0 commit comments

Comments
 (0)