Skip to content

CMake STM32H7 Example is Broken #586

@kwalker-plxs

Description

@kwalker-plxs

The example here for the stm32h7 does not compile as it stands.

It looks to be an issue with the isr_tim2 usage in startup_arm.c:

vscode ➜ /workspaces/stm32-cpp-project-template/wolfBoot/build (h757) $ make
[  2%] Building C object CMakeFiles/wolfboothal.dir/hal/stm32h7.c.o
[  4%] Linking C static library libwolfboothal.a
[  4%] Built target wolfboothal
[  7%] Building signing tool
[  9%] Building keygen tool
[  9%] Built target keytools
[ 11%] Generating keystore.c and signing private key
Keystore size: 2608
Keytype: ECC256
Generating key (type: ECC256)
Associated key file:   /workspaces/stm32-cpp-project-template/wolfBoot/build/wolfboot_signing_private_key.der
Partition ids mask:   ffffffff
Key type   :           ECC256
Public key slot:       0
Done.
[ 14%] Building C object CMakeFiles/public_key.dir/keystore.c.o
[ 16%] Linking C static library libpublic_key.a
[ 19%] Built target public_key
[ 21%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/integer.c.o
[ 23%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/tfm.c.o
[ 26%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/ecc.c.o
[ 28%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/memory.c.o
[ 30%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/wc_port.c.o
[ 33%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/wolfmath.c.o
[ 35%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/hash.c.o
[ 38%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/sha256.c.o
[ 40%] Linking C static library libwolfcrypt.a
[ 40%] Built target wolfcrypt
[ 42%] Building C object CMakeFiles/wolfboot.dir/src/libwolfboot.c.o
[ 45%] Linking C static library libwolfboot.a
[ 45%] Built target wolfboot
[ 47%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/string.c.o
[ 50%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/image.c.o
[ 52%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/loader.c.o
[ 54%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/boot_arm.c.o
[ 57%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/update_flash.c.o
[ 59%] Linking C executable wolfboot_stm32h7
[ 59%] Built target wolfboot_stm32h7
[ 61%] Generating wolfboot_stm32h7.bin
[ 64%] Generating wolfboot_stm32h7.size
   text    data     bss     dec     hex filename
  42908       0      76   42984    a7e8 /workspaces/stm32-cpp-project-template/wolfBoot/build/test-app/wolfboot_stm32h7
[ 64%] Built target wolfboot_stm32h7_outputs
[ 66%] Building C object test-app/CMakeFiles/image.dir/app_stm32h7.c.o
[ 69%] Building C object test-app/CMakeFiles/image.dir/led.c.o
[ 71%] Building C object test-app/CMakeFiles/image.dir/system.c.o
[ 73%] Building C object test-app/CMakeFiles/image.dir/timer.c.o
[ 76%] Building C object test-app/CMakeFiles/image.dir/startup_arm.c.o
/workspaces/stm32-cpp-project-template/wolfBoot/test-app/startup_arm.c:463:5: error: 'isr_tim2' undeclared here (not in a function)
  463 |     isr_tim2,               // TIM2_IRQ 28
      |     ^~~~~~~~
make[2]: *** [test-app/CMakeFiles/image.dir/build.make:135: test-app/CMakeFiles/image.dir/startup_arm.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:452: test-app/CMakeFiles/image.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I made the following change in to lines 31-38 of startup_arm.c to get the example to compile successfully:

#ifdef TARGET_stm32h5
extern void isr_usart3(void);
#elif (defined(TARGET_stm32l5) || defined(TARGET_stm32u5) || defined(LM3S))
// no declarations needed
#elif defined(STM32) /* For STM32 */
extern void isr_tim2(void);
#endif

Compiler details:

vscode ➜ /workspaces/stm32-cpp-project-template/wolfBoot/build (h757) $ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for STM32 13.3.rel1.20240926-1715) 13.3.1 20240614
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions