Compiler doesn't find function definition [libopencm3]

I have a problem that is probably a newbie thing but I can’t figure this out:
I want to write some code for a B-G431B-ESC1 board using libopencm3. Since the default board file does not have libopencm3 listed as framework, I made a copy of the file in my projects directory, renamed it, and added libopencm3 to the list of possible frameworks. I could then compile and flash a simple “blnky” program and saw the led on the board flashing.
Now I’d like to change the clock config (I suspect it’s running from the internal HSI oscillator) to the external oscillator on the board and set the clock speed a bit higher. But including the file #include <libopencm3/stm32/rcc.h> and calling the function rcc_clock_setup_pll() gives the compiler error ‘implicit declaration of rcc_clock_setup_pll()’.
I went through the chain of includes and couldn’t find a header file with a declaration but a c file with a definition.
What am I doing wrong?

Thanks for your help :slight_smile:

Per PlatformIO Registry the last PlatformIO package update to libopencm3 was 2 years ago, while the git blame shows that the function you want to call was only added 16 months (so ~1.33 years) ago. PlatformIO’s version just seems outdated. You should file an issue at Issues · platformio/platform-ststm32 · GitHub to hint at an update.

1 Like

Thanks for your help, I opened an issue here.

Is there a way to copy the libopencm3 source files somewhere to start working with the newest version until the framework is updated in PIO?

Yes, you can arbitrarily source framework-libopencm3 from say a Github repo using platform_packages. Note that PlatformIO requires that the package contains a package.json declaring the package name and version. The default current is

  "name": "framework-libopencm3",
  "version": "1.10000.211103",
  "description": "Open source ARM Cortex-M microcontroller library",
  "keywords": [
  "homepage": "",
  "license": "GPL-3.0-or-later",
  "repository": {
    "type": "git",
    "url": ""

For internals see e.g. here.

1 Like

Thanks a lot!
I made a fork of libopencm3, modified the readme a bit and added a package.json similar to your pio-libopencm3-repackage repositiory but also tried to set up the GitHub App Pull (cannot post a link, sorry) to keep the fork up-to-date automatically. Not sure it works but I’ll see as soon as there’s a new commit upstream.
Might be helpful for anyone finding this. Unfortunately I cannot post a link (for whatever reason), so here is what you need to append to the github homepage address to find it (with a forward slash in between) : qosch libopencm3