|
263 | 263 | OpenOCD can be either run in background (to allow remote GDB and monitor terminal connections), or |
264 | 264 | directly from command line, to execute terminal scripts. |
265 | 265 |
|
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` |
267 | 267 |
|
268 | 268 | Using the following openocd commands, the initial images for wolfBoot and the test application |
269 | 269 | are loaded to flash in bank 0: |
@@ -309,3 +309,95 @@ From another console, connect using gdb, e.g.: |
309 | 309 | arm-none-eabi-gdb |
310 | 310 | (gdb) target remote:3333 |
311 | 311 | ``` |
| 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