Skip to content

Commit dc4ea19

Browse files
authored
Merge pull request #28 from dgarske/stm32h7
Thanks David!
2 parents f09c27d + d146193 commit dc4ea19

6 files changed

Lines changed: 692 additions & 3 deletions

File tree

arch.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ ifeq ($(ARCH),ARM)
3232

3333
ifeq ($(TARGET),stm32f7)
3434
ARCH_FLASH_OFFSET=0x08000000
35-
else
36-
ARCH_FLASH_OFFSET=0x0
35+
endif
36+
37+
ifeq ($(TARGET),stm32h7)
38+
ARCH_FLASH_OFFSET=0x08000000
3739
endif
3840

3941
## Cortex-M CPU

config/examples/stm32h7.config

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ARCH?=ARM
2+
TARGET?=stm32h7
3+
SIGN?=ECC256
4+
DEBUG?=0
5+
VTOR?=1
6+
CORTEX_M0?=0
7+
NO_ASM?=0
8+
EXT_FLASH?=0
9+
SPI_FLASH?=0
10+
ALLOW_DOWNGRADE?=0
11+
NVM_FLASH_WRITEONCE?=0
12+
WOLFBOOT_VERSION?=1
13+
V?=0
14+
SPMATH?=1
15+
RAM_CODE?=1
16+
DUALBANK_SWAP?=0
17+
IMAGE_HEADER_SIZE?=256
18+
WOLFBOOT_PARTITION_SIZE?=0xD0000
19+
WOLFBOOT_SECTOR_SIZE?=0x20000
20+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x8020000
21+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x80F0000
22+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x81C0000

docs/Targets.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ halt
263263
OpenOCD can be either run in background (to allow remote GDB and monitor terminal connections), or
264264
directly from command line, to execute terminal scripts.
265265

266-
If OpenOCD is running, local TCP port 4444 can be used to access an interactive terminal prompt.
266+
If OpenOCD is running, local TCP port 4444 can be used to access an interactive terminal prompt. `telnet localhost 4444`
267267

268268
Using the following openocd commands, the initial images for wolfBoot and the test application
269269
are loaded to flash in bank 0:
@@ -309,3 +309,95 @@ From another console, connect using gdb, e.g.:
309309
arm-none-eabi-gdb
310310
(gdb) target remote:3333
311311
```
312+
313+
314+
## STM32H7
315+
316+
The STM32H7 flash geometry must be defined beforehand.
317+
318+
Use the "make config" operation to generate a .config file or copy the template
319+
using `cp ./config/examples/stm32h7.config .config`.
320+
321+
Example 2MB partitioning on STM32-H753:
322+
323+
```
324+
WOLFBOOT_SECTOR_SIZE?=0x20000
325+
WOLFBOOT_PARTITION_SIZE?=0xD0000
326+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x8020000
327+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x80F0000
328+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x81C0000
329+
```
330+
331+
### Build Options
332+
333+
The STM32H7 build can be built using:
334+
335+
```
336+
make TARGET=stm32h7 SIGN=ECC256
337+
```
338+
339+
### Loading the firmware
340+
341+
OpenOCD configuration for flashing/debugging, can be copied into `openocd.cfg` in your working directory:
342+
Note: May require OpenOCD 0.10.0 or greater for the STM32H7x support.
343+
344+
```
345+
source [find interface/stlink.cfg]
346+
source [find target/stm32h7x.cfg]
347+
$_CHIPNAME.cpu0 configure -event reset-init {
348+
mmw 0xe0042004 0x7 0x0
349+
}
350+
init
351+
reset
352+
halt
353+
```
354+
355+
OpenOCD can be either run in background (to allow remote GDB and monitor terminal connections), or
356+
directly from command line, to execute terminal scripts.
357+
358+
If OpenOCD is running, local TCP port 4444 can be used to access an interactive terminal prompt.
359+
360+
Using the following openocd commands, the initial images for wolfBoot and the test application
361+
are loaded to flash in bank 0:
362+
363+
```
364+
telnet localhost 4444
365+
flash write_image unlock erase wolfboot.bin 0x08000000
366+
flash verify_bank 0 wolfboot.bin
367+
flash write_image unlock erase test-app/image_v1_signed.bin 0x08020000
368+
flash verify_bank 0 test-app/image_v1_signed.bin 0x20000
369+
reset
370+
resume 0x08000000
371+
```
372+
373+
To sign the same application image as new version (2), use the python script `sign.py` provided:
374+
375+
```
376+
tools/keytools/sign.py test-app/image.bin ecc256.der 2
377+
```
378+
379+
From OpenOCD, the updated image (version 2) can be flashed to the second bank:
380+
```
381+
flash write_image unlock erase test-app/image_v2_signed.bin 0x08120000
382+
flash verify_bank 0 test-app/image_v1_signed.bin 0x20000
383+
```
384+
385+
Upon reboot, wolfboot will elect the best candidate (version 2 in this case) and authenticate the image.
386+
If the accepted candidate image resides on BANK B (like in this case), wolfBoot will perform one bank swap before
387+
booting.
388+
389+
390+
### Debugging
391+
392+
Debugging with OpenOCD:
393+
394+
Use the OpenOCD configuration from the previous section to run OpenOCD.
395+
396+
From another console, connect using gdb, e.g.:
397+
398+
```
399+
arm-none-eabi-gdb
400+
(gdb) target remote:3333
401+
(gdb) add-symbol-file test-app/image.elf 0x08020000
402+
(gdb) add-symbol-file wolfboot.elf 0x08000000
403+
```

0 commit comments

Comments
 (0)