Skip to content

Commit 5b36a6d

Browse files
committed
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.
1 parent 248fd98 commit 5b36a6d

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed

.github/workflows/footprint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
3131
- name: Select config
3232
run: |
33-
cp config/examples/stm32f4.config .config && make include/target.h
33+
cp config/examples/stm32f407-discovery.config .config && make include/target.h
3434
3535
- name: Build key tools
3636
run: |

.github/workflows/test-build-cmake.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@ jobs:
3030
- name: Build wolfBoot
3131
run: make -C build
3232

33-
- name: Run CMake build for STM32F4
33+
- name: Run CMake build for STM32F407-DISCOVERY
3434
run: |
3535
rm -rf ./build
36-
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
36+
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
37+
- name: Build wolfBoot
38+
run: make -C build
39+
40+
- name: Run CMake build for STM32F411-BLACKPILL
41+
run: |
42+
rm -rf ./build
43+
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
3744
- name: Build wolfBoot
3845
run: make -C build
3946

.github/workflows/test-configs.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,17 @@ jobs:
272272
arch: arm
273273
config-file: ./config/examples/stm32f4-small-blocks-uart-update.config
274274

275-
stm32f4_test:
275+
stm32f407_discovery_test:
276276
uses: ./.github/workflows/test-build.yml
277277
with:
278278
arch: arm
279-
config-file: ./config/examples/stm32f4.config
279+
config-file: ./config/examples/stm32f407-discovery.config
280+
281+
stm32f411_blackpill_test:
282+
uses: ./.github/workflows/test-build.yml
283+
with:
284+
arch: arm
285+
config-file: ./config/examples/stm32f411-blackpill.config
280286

281287
stm32f7_dualbank_test:
282288
uses: ./.github/workflows/test-build.yml

CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,29 @@ if(ARCH STREQUAL "ARM")
238238
if(${WOLFBOOT_TARGET} STREQUAL "stm32f4")
239239
set(ARCH_FLASH_OFFSET 0x08000000)
240240
set(WOLFBOOT_ORIGIN ${ARCH_FLASH_OFFSET})
241+
242+
if(NOT DEFINED CLOCK_SPEED)
243+
message(FATAL_ERROR "CLOCK_SPEED must be defined")
244+
endif()
245+
if(NOT DEFINED STM32_PLLM)
246+
message(FATAL_ERROR "STM32_PLLM must be defined")
247+
endif()
248+
if(NOT DEFINED STM32_PLLN)
249+
message(FATAL_ERROR "STM32_PLLN must be defined")
250+
endif()
251+
if(NOT DEFINED STM32_PLLP)
252+
message(FATAL_ERROR "STM32_PLLP must be defined")
253+
endif()
254+
if(NOT DEFINED STM32_PLLQ)
255+
message(FATAL_ERROR "STM32_PLLQ must be defined")
256+
endif()
257+
add_compile_definitions(
258+
CLOCK_SPEED=${CLOCK_SPEED}
259+
STM32_PLLM=${STM32_PLLM}
260+
STM32_PLLN=${STM32_PLLN}
261+
STM32_PLLP=${STM32_PLLP}
262+
STM32_PLLQ=${STM32_PLLQ}
263+
)
241264
endif()
242265

243266
if(${WOLFBOOT_TARGET} STREQUAL "stm32u5")

IDE/IAR/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ application image starts at address 0x08020000.
1212

1313
```
1414
$template=Get-Content -path ..\..\include\target.h.in;
15-
Get-Content -path ..\..\config\examples\stm32f4.config | ForEach-Object {$v=$_.Split('?='); $a=$v[0]; $b=$v[2]; $template=($template -replace "##$a##",$b) };
15+
Get-Content -path ..\..\config\examples\stm32f407-discovery.config | ForEach-Object {$v=$_.Split('?='); $a=$v[0]; $b=$v[2]; $template=($template -replace "##$a##",$b) };
1616
$template=($template -replace "##.*##","");
1717
Set-Content -path target.h $template
1818
```
@@ -91,4 +91,4 @@ If you are using a STM32F407-discovery board, a red LED will turn on upon applic
9191

9292
## Armored Mode (Glitch Resistance)
9393

94-
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.
94+
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.

config/examples/stm32f4-small-blocks-uart-update.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x00000
2727
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x4000
2828
WOLFBOOT_LOAD_ADDRESS?=0x200000
2929
WOLFBOOT_LOAD_DTS_ADDRESS?=0x400000
30+
CLOCK_SPEED?=160000000
31+
STM32_PLLM?=8
32+
STM32_PLLN?=336
33+
STM32_PLLP?=2
34+
STM32_PLLQ?=7

0 commit comments

Comments
 (0)