Skip to content

STM32L4 Not Supported in CMake #585

Closed

Description

@kwalker-plxs

I was looking to build the example app for the STM32L4 using CMake, but noticed that the stm32l4 is not listed in the ARM_TARGETS variable. Is there a particular reason it is missing?

Activity

  1. kareem-wolfssl commented on Aug 5, 2025

    @kareem-wolfssl
    Contributor

    Hi @kwalker-plxs ,

    Based on what I'm seeing in CMakeLists.txt, I don't see a reason for stm32l4 to be omitted, in fact it is listed later in the file under SPI_DRV_STM32_TARGETS. I've included my colleague @danielinux who added this support originally to confirm.

    Can you try adding stm32l4 to ARM_TARGETS and confirm if it works for you?

  2. kwalker-plxs commented on Aug 5, 2025

    @kwalker-plxs
    ContributorAuthor

    Hi @kareem-wolfssl,

    This did not work for me. I ended up getting a different error complaining about a missing header file

    vscode ➜ /workspaces/stm32-cpp-project-template/wolfboot/build (master) $ cmake -DWOLFBOOT_TARGET=stm32l4 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x0800A000 -DWOLFBOOT_SECTOR_SIZE=0x1000 -DWOLFBOOT_PARTITION_SIZE=0x7A000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x08084000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x080FE000 ..
    -- The C compiler identification is GNU 14.2.0
    -- The CXX compiler identification is GNU 14.2.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Building for stm32l4
    -- Cross-compiling using GNU arm-none-eabi toolchain
    -- Signing image using ECC256
    -- Using SHA256 hash
    -- Using C Keytools
    -- Using fast math
    -- Configuring done (0.6s)
    -- Generating done (0.0s)
    -- Build files have been written to: /workspaces/stm32-cpp-project-template/wolfboot/build
    vscode ➜ /workspaces/stm32-cpp-project-template/wolfboot/build (master) $ make
    [  5%] Building C object CMakeFiles/wolfboothal.dir/hal/stm32l4.c.o
    /workspaces/stm32-cpp-project-template/wolfboot/hal/stm32l4.c:24:10: fatal error: stm32l4xx_hal.h: No such file or directory
       24 | #include "stm32l4xx_hal.h"
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    make[2]: *** [CMakeFiles/wolfboothal.dir/build.make:79: CMakeFiles/wolfboothal.dir/hal/stm32l4.c.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:152: CMakeFiles/wolfboothal.dir/all] Error 2
    make: *** [Makefile:91: all] Error 2
    

    Note that I did also just try building the example using the Makefile (copying config/examples/stm32l4-cube.config and then running make). This reaches the same error.

  3. kareem-wolfssl commented on Aug 5, 2025

    @kareem-wolfssl
    Contributor

    Hi @kwalker-plxs ,

    Thanks for the followup and sorry to hear that didn't work. I've reviewed this with the team.

    Our CMake support is a work in progress and isn't complete or officially supported yet, so we would recommend sticking with Makefiles if possible.

    The "stm32l4xx_hal.h" header is a generated STM32 header, it should come from your STM32Cube IDE project. Can you confirm if you've set up a project for your platform, and whether this header is present anywhere? You may need to adjust your include paths.

    Are you able to share any information on your project? Are you using wolfBoot in a personal or commercial project?

  4. kwalker-plxs commented on Aug 13, 2025

    @kwalker-plxs
    ContributorAuthor

    Hi @kareem-wolfssl,

    I was able to update paths to link to the necessary file. I was able to get things compiling then. It does seem like stm32l4 can be added to ARM_TARGETS.

    This is for a personal project. I am mainly looking to just experiment some with wolfBoot to gain some experience.

  5. gojimmypi commented on Oct 3, 2025

    @gojimmypi
    Contributor

    Hi @kwalker-plxs -

    I'm going to be making some improvements to the CMake process for wolfBoot. I'd like to know more about your initial interaction and any suggestions you may have. Can you share the specific problem you encountered, how you resolved it, and what I can do to help make the process easier and more intuitive?

    One of the first things I'll be looking at is ensuring the features and capabilities are on-par with the make builds: in particular processing the .config file.

    I have my own STM32L4, specifically the B-L475E-IOT01A Discovery kit IoT node that I'll be working with initially. To help with the path testing: I have both the STM32Cube IDE installed, as well as the VisualGDB extension for Visual Studio - where I do most of my development.

  6. kwalker-plxs commented on Oct 7, 2025

    @kwalker-plxs
    ContributorAuthor

    Hi @gojimmypi ,

    This issue was pretty straightforward, where I just needed to add stm32l4 under the definition for ARM_TARGETS. Everything else seemed to work successfully, so I think it may just be a missed option when support was added for this ST target.

    Shortly after running into this, I saw this comment. I then switched over to using Makefiles since that is the officially supported configuration.

    I think the main thing that would help me out with CMake and wolfBoot is a good example on how one would integrate wolfBoot with an existing CMake project. The main emphasis here would be integrating building of the bootloader and library into the existing system and demonstrating hooks to generate the required factory and upgrade images.

    Thanks!

  7. self-assigned this
    on Oct 9, 2025
  8. gojimmypi commented on Oct 9, 2025

    @gojimmypi
    Contributor

    Hi @kwalker-plxs -

    I'm glad you were able to resolve the immediate problem.

    There's definitely some room for improvement. Particularly as you mentioned: some better guidance on integration with an existing project. I assume you've seen the test-app collection? There are also some indirect "examples" in our .github/workflows.

    I think what we might need is an examples directory. Do you have a basic example of your project, perhaps whittled down to just a blinky for the main app - that you could share?

    In the meantime, I'm making good progress on cmake improvements. Now is a great time for suggestions! :)

    Cheers.

  9. danielinux commented on Nov 10, 2025

    @danielinux
    Member

    Closing -- addressing this issue in #598

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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