Installing STM32WL package for github actions

I am developing on an STM32WLE5, using the stm32cube framework. This is not yet supported out of the box by PlatformIO, as the STMicroelectronics/STM32CubeWL is not installed by default.
But by manually cloning this into c:\users<user>.platformio/packages/framework-stm32cubewl I am able to use this framework for local builds.

As I am using a CI/CD workflow to do unittest / coverage / builds through github actions, I also need to install this package from this workflow.

I am having some troubles getting the path (or other settings…) right and could use some help here.

The repository is public on GitHub - Strooom/STM32WLE_PlatformIO at develop

I have a custom board defined in the boards directory

After installing / upgrading PIO, I added another step to clone the STM32CubeWL package

      - name: Install STM32CubeWL
        uses: actions/checkout@v4
          repository: STMicroelectronics/STM32CubeWL
          path: .platformio/packages/framework-stm32cubewl
          submodules: true

The output of this action is

Run actions/checkout@v4
Syncing repository: STMicroelectronics/STM32CubeWL
Getting Git version info
Temporarily overriding HOME='/home/runner/work/_temp/f3484dfe-bde0-49e2-abc6-d26bf3266759' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add /home/runner/work/STM32WLE_PlatformIO/STM32WLE_PlatformIO/.platformio/packages/framework-stm32cubewl
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Determining the default branch
Fetching the repository
Determining the checkout info
Checking out the ref
Setting up auth for fetching submodules
Fetching submodules
Persisting credentials for submodules
/usr/bin/git log -1 --format='%H'

It looks like the repository is not cloned in the correct location, but I’m not sure…
I am a windows user, and the github actions runs on linux

The output of the build afterwards is

Run pio run -e production
Processing production (platform: ststm32; board: mumo_stm32wle5jc; framework: stm32cube)
Platform Manager: Installing ststm32
Downloading 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Platform Manager: ststm32@17.0.0 has been installed!
KeyError: Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/", line 103, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/", line 85, in invoke
    return super().invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/run/", line 145, in cli
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/run/", line 198, in process_env
    result["succeeded"] = EnvironmentProcessor(
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/run/", line 81, in process
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/package/commands/", line 132, in install_project_env_dependencies
    _install_project_env_platform(project_env, options),
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/package/commands/", line 149, in _install_project_env_platform
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/package/manager/", line 60, in install
    p.configure_project_packages(project_env, project_targets)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/platform/", line 184, in configure_project_packages
    self.configure_default_packages(options, targets or [])
  File "/home/runner/.platformio/platforms/ststm32/", line 111, in configure_default_packages
    return PlatformBase.configure_default_packages(self, variables,
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/platformio/platform/", line 196, in configure_default_packages
    self.packages[_pkg_name]["optional"] = False
KeyError: 'framework-stm32cubewl'


An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `python -m pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section

* Report this problem to the developers


I’ve found out that it also requires to add a section with

"framework-stm32cubewl": {
      "type": "framework",
      "optional": true,
      "owner": "platformio",
      "version": "~1.3.0"

to .platformio/platforms/ststm32/platform.json

but when trying this with an extra step such as

      - name: Add stm32wle to PlatformIO platforms
        run: |
          cp .github/workflows/platform.json .platformio/platforms/ststm32/platform.json

I get another error

Run cp .github/workflows/platform.json .platformio/platforms/ststm32/platform.json
cp: cannot create regular file '.platformio/platforms/ststm32/platform.json': No such file or directory
Error: Process completed with exit code 1.

Mh that should in the home path, i.e. ~/.platformio/platforms/ststm32/platform.json

That’s not sufficient because it’s missing the package.json (e.g. from here) for that package, otherwise PlatformIO won’t find it.

Also copying directly overwriting platform.json is kind of unstable with regards to future updates, this really just needs to be a forked platform-ststm32 with the platform.json modification that adds framework-stm32cubewl to the package list by means of a version field that points to a Github that has a (stable) copy of STMicroelectronics/STM32CubeWL with the package.json preadded.

The devs could (and should) do this very quickly in the official repo too.

Thank you,
Official support would be excellent, as it seems it’s not so easy to implement the workaround…
Here are the lessons learned, so far

  • I created a dummy [env:dummy] and then add pio pkg install --environment dummy
    which then triggers installation of ststm32. If the installation is triggered by the actual production build, it’s too late to add the support for stm32wl
  • then I learned you cannot clone the stm32wl folder directly into its /home/runner/.platformio/packages/framework-stm32cubewl path (the action doesn’t allow this) so I cloned it to a temp folder. then copied into the right place.
  • then as you mention package.json is still missing, so I copied it from my repository
  • finally platform.json needs an extra section, so (for the time being) I’ve overwritten that file from an updated copy in my repository.

Still, the build can’t find the stm32wl stuff…

Run pio run -e production
Processing production (platform: ststm32; board: mumo_stm32wle5jc; framework: stm32cube)
Tool Manager: Installing platformio/framework-stm32cubewl @ ~1.3.0
UnknownPackageError: Could not find the package with 'platformio/framework-stm32cubewl @ ~1.3.0' requirements for your system 'linux_x86_64'

It looks like PIO doesn’t see the workaround installation, and tries to self-install…

Ok, just as I was about to give up, it’s working :slight_smile:
There is still a small problem with the stm32wl HAL from ST, as it expects a file stm32_systime.h/.c but the repo has only stm32_systime_if_template.h/.c

But other than that the build in github action seems to work.

Again, thank you for your support @maxgerhardt