STM32 support in pwrforge

Creating a project

pwrforge new --target stm32 --chip <stm32...> [project_name]

Configure STM32 project

To configure your project for chosen STM32 chipset use –chip when initializing the project. It’s also possible to change it in pwrforge.toml file in [stm32] section and run pwrforge update.

Add and use the external dependencies

Some of the external dependencies such as CMSIS or HAL are added to the project configuration by default. They will be managed by conan. Please check the stm32-cmake project to get knowledge how to use HAL and CMSIS dependencies (https://github.com/ObKo/stm32-cmake#hal) To use it in your cmake libraries please add proper includes in target_link_libraries to your CMakeLists.txt file as in the following example:

target_link_libraries(${PROJECT_NAME}
    CMSIS::STM32::${STM32_TYPE}
    HAL::STM32::${STM32_FAMILY}::PWREx
    HAL::STM32::${STM32_FAMILY}::RCC
    HAL::STM32::${STM32_FAMILY}::RCCEx
    HAL::STM32::${STM32_FAMILY}::CORTEX
    bsp
)

STM32Cube fetch cache

The devcontainer image preloads the selected STM32Cube family into /opt/pwrforge-cache/stm32cube. The runtime cache path ~/.cache/pwrforge/stm32cube is backed by a named Docker volume, so the cache is reused by subsequent builds and is not removed by pwrforge clean or container recreation.

Generate a certs

Generate certs needed by azure base on dev id

pwrforge gen --certs <dev id as string>

It will generate certs in build/certs/fs dir. This cert should be used in two-way authentication with azure IoTHub.