Fix build and test issues with stm32f4 targets

- Add the new CLOCK_SPEED and STM32_PLLx variables to the CMakeLists
  file

- Rename references of 'stm32f4.config' to 'stm32f407-discovery.config'
documentation and github workflow files.
pull/572/head
Alex Lanzano 2025-06-21 14:43:30 -04:00
parent 248fd985b3
commit 5b36a6dddd
6 changed files with 48 additions and 7 deletions

View File

@ -30,7 +30,7 @@ jobs:
- name: Select config
run: |
cp config/examples/stm32f4.config .config && make include/target.h
cp config/examples/stm32f407-discovery.config .config && make include/target.h
- name: Build key tools
run: |

View File

@ -30,10 +30,17 @@ jobs:
- name: Build wolfBoot
run: make -C build
- name: Run CMake build for STM32F4
- name: Run CMake build for STM32F407-DISCOVERY
run: |
rm -rf ./build
cmake -B build -DWOLFBOOT_TARGET=stm32f4 -DWOLFBOOT_PARTITION_SIZE=0x20000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x08020000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x08040000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x08060000
cmake -B build -DWOLFBOOT_TARGET=stm32f4 -DWOLFBOOT_PARTITION_SIZE=0x20000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x08020000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x08040000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x08060000 -DCLOCK_SPEED=160000000 -DSTM32_PLLM=8 -DSTM32_PLLN=336 -DSTM32_PLLP=2 -DSTM32_PLLQ=7
- name: Build wolfBoot
run: make -C build
- name: Run CMake build for STM32F411-BLACKPILL
run: |
rm -rf ./build
cmake -B build -DWOLFBOOT_TARGET=stm32f4 -DWOLFBOOT_PARTITION_SIZE=0x20000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x08020000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x08040000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x08060000 -DCLOCK_SPEED=84000000 -DSTM32_PLLM=25 -DSTM32_PLLN=336 -DSTM32_PLLP=4 -DSTM32_PLLQ=7
- name: Build wolfBoot
run: make -C build

View File

@ -272,11 +272,17 @@ jobs:
arch: arm
config-file: ./config/examples/stm32f4-small-blocks-uart-update.config
stm32f4_test:
stm32f407_discovery_test:
uses: ./.github/workflows/test-build.yml
with:
arch: arm
config-file: ./config/examples/stm32f4.config
config-file: ./config/examples/stm32f407-discovery.config
stm32f411_blackpill_test:
uses: ./.github/workflows/test-build.yml
with:
arch: arm
config-file: ./config/examples/stm32f411-blackpill.config
stm32f7_dualbank_test:
uses: ./.github/workflows/test-build.yml

View File

@ -238,6 +238,29 @@ if(ARCH STREQUAL "ARM")
if(${WOLFBOOT_TARGET} STREQUAL "stm32f4")
set(ARCH_FLASH_OFFSET 0x08000000)
set(WOLFBOOT_ORIGIN ${ARCH_FLASH_OFFSET})
if(NOT DEFINED CLOCK_SPEED)
message(FATAL_ERROR "CLOCK_SPEED must be defined")
endif()
if(NOT DEFINED STM32_PLLM)
message(FATAL_ERROR "STM32_PLLM must be defined")
endif()
if(NOT DEFINED STM32_PLLN)
message(FATAL_ERROR "STM32_PLLN must be defined")
endif()
if(NOT DEFINED STM32_PLLP)
message(FATAL_ERROR "STM32_PLLP must be defined")
endif()
if(NOT DEFINED STM32_PLLQ)
message(FATAL_ERROR "STM32_PLLQ must be defined")
endif()
add_compile_definitions(
CLOCK_SPEED=${CLOCK_SPEED}
STM32_PLLM=${STM32_PLLM}
STM32_PLLN=${STM32_PLLN}
STM32_PLLP=${STM32_PLLP}
STM32_PLLQ=${STM32_PLLQ}
)
endif()
if(${WOLFBOOT_TARGET} STREQUAL "stm32u5")

View File

@ -12,7 +12,7 @@ application image starts at address 0x08020000.
```
$template=Get-Content -path ..\..\include\target.h.in;
Get-Content -path ..\..\config\examples\stm32f4.config | ForEach-Object {$v=$_.Split('?='); $a=$v[0]; $b=$v[2]; $template=($template -replace "##$a##",$b) };
Get-Content -path ..\..\config\examples\stm32f407-discovery.config | ForEach-Object {$v=$_.Split('?='); $a=$v[0]; $b=$v[2]; $template=($template -replace "##$a##",$b) };
$template=($template -replace "##.*##","");
Set-Content -path target.h $template
```
@ -91,4 +91,4 @@ If you are using a STM32F407-discovery board, a red LED will turn on upon applic
## Armored Mode (Glitch Resistance)
If you would like to enable the "Armored" mode (glitch resistance) in IAR you can set the compiler pre-processor macro `WOLFBOOT_ARMORED`. Note: This has only been tested with ECDSA on Cortex-M.
If you would like to enable the "Armored" mode (glitch resistance) in IAR you can set the compiler pre-processor macro `WOLFBOOT_ARMORED`. Note: This has only been tested with ECDSA on Cortex-M.

View File

@ -27,3 +27,8 @@ WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x00000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x4000
WOLFBOOT_LOAD_ADDRESS?=0x200000
WOLFBOOT_LOAD_DTS_ADDRESS?=0x400000
CLOCK_SPEED?=160000000
STM32_PLLM?=8
STM32_PLLN?=336
STM32_PLLP?=2
STM32_PLLQ?=7