Update libopencm3: WIP + help needed

TL;DR:
I want to help to update libopencm3; it works on my system but I need little help to propose clean patches.

The libopencm3 is a “light” library that supports several hundreds of MCUs of different families. It looks promising but it is poorly supported by PlatformIO.

For example, its support is set on only 28 boards of the STM32 family listed by PlatformIO while it covers (at least) 142 of them with the current version. Also, it has not been updated in PlatformIO since 2016 (according to bintray) while the library evolved a lot.

I already talked about this on IRC and in github issues last week, but I had no answer.
I try again here, in hope that the community is more active in this forum.

This is a 3 steps plan:

  1. Update builder-framework-libopencm3 to support both current version distributed by platformIO and the up-to-date code in git repository of the library
  2. Update the bintray version
  3. Update support status for the boards listed in PlatformIO

Step 1
I have a first (ugly) code that is able to generate the linker script needed to create the final binary. The core snippet is published in the issue #1 Support for more variants of the builder-framework-libopencm3 repository.
The missing parts are listed in the issue, but I will repeat it here (and precise a bit) later in this post for the ease of discussion.

Step 2
It is probably only a matter of doing the snapshot of the library, adding an appropriate package.json and publishing it to the bintray platform, but I do not know who can do that.

Step 3
After step 2, the users would already be able to use this library on their custom boards, but it would be better to have it enabled for vendor demonstration boards as well.
As mcu support is testable by a script, and mcu name is available in boards files (at least in the STM32 platform in which I checked), it would not be too hard to have an exhaustive coverage for existing boards.

What is needed for cleaner patch:

  1. The build has to generate the linker script
    For this, we have to know the path of the toochain in the builder script, or alternatively add a rule to generate the linker script during the build so that it is generated before link stage.
    I do not know hos to do that. It works with hardcoded path.
  2. The generated linker script should be in the build directory
    For this, we have to know the path of the build directory in the builder script. The alternate of (1) could work as well. It works by generating it at arbitrary place.

Is there someone here that can help to unlock these points?

Please file an issue on Issues · platformio/platform-ststm32 · GitHub and put a link to this topic. Thanks!

I created the issue. Hope it will help.

2 Likes

I made a local install of the last version (last push in the libopencm3’s github repo) and name it as 1.year.month => 1.20.4 (las push was 04/2020). If you want you can unzip it in the .platformio/packages/ folder and edit .platformio/platforms/ststm32/platform.json line 158 to 1.20.4, it works for me.

https://www.mediafire.com/file/e7vyhoruylochnx/framework-libopencm3@1.20.4.zip/file

A few days ago, the framework was updated in the official repo.
We do not need fancy tweaks anymore.