Portenta and RPC: missing `asio.hpp` header; `framework-arduino-mbed` not latest

Hi,

While my first steps using portenta and platformIO (with VIM) were motivating and encouraging, I quickly faced a bottleneck.

I am trying to run the example code dot151-print-from-m4-core-rpc here.

My platformio.ini is straightforward, created with pio init --board=portenta_h7_m7:


[env:portenta_h7_m7]
platform = ststm32
board = portenta_h7_m7
framework = arduino

But when compiling the code (pio run) I get:

PACKAGES: 
 - framework-arduino-mbed 2.6.1 
 - tool-dfuutil 1.9.200310 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
[...]
Dependency Graph
|-- <RPC> 1.0
|   |-- <rpclib> 1.0.0
|   |-- <openamp> 1.0
Building in release mode
Compiling .pio/build/portenta_h7_m7/src/main.cpp.o
Generating LD script .pio/build/portenta_h7_m7/cpp.linker_script.ld
Compiling .pio/build/portenta_h7_m7/lib661/rpclib/format.cpp.o
Compiling .pio/build/portenta_h7_m7/lib661/rpclib/rpc/client.cc.o
Compiling .pio/build/portenta_h7_m7/lib661/rpclib/rpc/detail/client_error.cpp.o
~/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src/rpc/client.cc:13:10: fatal error: **asio.hpp: No such file or directory**

The code compiles fine when I use the arduino IDE (v. 1.8.19).

I searched for this asio.hpp in the PIO registery web page (nothing besides a ChirpSDK).
I didn’t find the header anywhere in ~/.platformio/packages/framework-arduino-mbed, it is not either located in the the original ArduinoCore-mbed, which at first sight seems to be what is installed in my ~/.platformio/packages.

But I could trace the header in the original github /rpclib/rpclib, asio.hpp is located in under rpclib/tree/master/dependencies/include.

I couldn’t find anything more about asio.hpp besides its own repository.

And now I’m in a dead-end, slowing down my enthusiasm to use PlatformIO.

Could it be that the official ArduinoCore-mbed is now at v 3.0.0 while the one installed in my PIO is 2.6.1 (automatically installed this version when I did pio run, but I notice the one in the registry page of framework-arduino-mbed is said to be 2.7.2)?

The Readme at the registry page of framework-arduino-mbed is similar to that in the ofifical ArduinoCore-mbed but is kind of obscure to me as it doesn’t seem relevant to PlatformIO (it’s only for the Arduino IDE isn’t it?) and the Installation instructions don’t help much either.

Am I missing another dependency (that I couldn’t find…)?

Ludo

PS: new user can only put 2 links in a post, I wished I could put more to make the post clearer and more convenient!

The latest commit in GitHub - platformio/platform-ststm32: ST STM32: development platform for PlatformIO updates the mbed core to 2.7.2. Have you tried using the upstream version per documentation?

Thanks for the idea but I get the same error after using the upstream version:

My platformio.ini:

[env:upstream_develop]
platform = https://github.com/platformio/platform-ststm32.git
board = portenta_h7_m7
framework = arduino

Then pio run:

processing upstream_develop (platform: https://github.com/platformio/platform-ststm32.git; board: portenta_h7_m7; framework: arduino)
Platform Manager: Installing git+https://github.com/platformio/platform-ststm32.git
[...]
Platform Manager: ststm32 @ 15.2.0+sha.5ee07da has been installed!
The platform 'https://github.com/platformio/platform-ststm32.git' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.
Tool Manager: Installing platformio/framework-arduino-mbed @ ~2.7.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%    
Tool Manager: framework-arduino-mbed @ 2.7.2 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/portenta_h7_m7.html
PLATFORM: ST STM32 (15.2.0+sha.5ee07da) > Arduino Portenta H7 (M7 core)
HARDWARE: STM32H747XIH6 480MHz, 511.35KB RAM, 768KB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduino-mbed 2.7.2 
 - tool-dfuutil 1.9.200310 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <RPC> 1.0
|   |-- <rpclib> 1.0.0
|   |-- <openamp> 1.0
Building in release mode
Compiling .pio/build/upstream_develop/src/main.cpp.o
Generating LD script .pio/build/upstream_develop/cpp.linker_script.ld
Compiling .pio/build/upstream_develop/lib9bb/rpclib/format.cpp.o
Compiling .pio/build/upstream_develop/lib9bb/rpclib/rpc/client.cc.o
Compiling .pio/build/upstream_develop/lib9bb/rpclib/rpc/detail/client_error.cpp.o
/home/ludozb/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src/rpc
/client.cc:13:10: fatal error: asio.hpp: No such file or directory

Are you able to compile the dot151-print-from-m4-core-rpc script without any error?

My bad, I did not read that properly. So even though the bleeding-edge platform gets you to 2.7.2, that’s still not 3.0.0. The right is to fork GitHub - arduino/ArduinoCore-mbed, add a package.json (and in this case the Arduino API folder which the repo does not have the final distributed package has) and reference it via platform_packages to replace the old version of framework-arduino-mbed.

I’ve just done that in my repo.

[env:portenta_h7_m7]
platform = https://github.com/platformio/platform-ststm32.git
board = portenta_h7_m7
framework = arduino
; pull 3.0.0 core in PlatformIO-compatible packaging
; from a repo
platform_packages =
  framework-arduino-mbed@https://github.com/maxgerhardt/ArduinoCore-mbed

But magically, there is still no asio.hpp file. In fact the entire repo GitHub - arduino/ArduinoCore-mbed has no asio.hpp. It may be auto-generated by a process and included in the distributed Arduino board manager zip file and thus doesn’t appear in the Git repo, I yet have to take a look…

Aha. The Arduino IDE compiles this sketch but all .cc files inside the RPC library are never compiled, which is where asio.hpp is included. I will try to reproduce this in PlatformIO…

I have added a source filter, can you try the platformio.ini

[env]
platform = https://github.com/platformio/platform-ststm32.git
framework = arduino
; pull 3.0.0 core in PlatformIO-compatible packaging
; from a repo
platform_packages =
  framework-arduino-mbed@https://github.com/maxgerhardt/ArduinoCore-mbed

; for the Cortex-M7 part of the sketch
[env:portenta_h7_m7]
board = portenta_h7_m7

; for the Cortex-M4 part of the sketch
; build and upload both.
[env:portenta_h7_m4]
board = portenta_h7_m4

Works for me with src/main.ino being that example file you posted.

CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/portenta_h7_m7.html
PLATFORM: ST STM32 (15.2.0+sha.5ee07da) > Arduino Portenta H7 (M7 core)
HARDWARE: STM32H747XIH6 480MHz, 511.35KB RAM, 768KB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduino-mbed 3.0.0+sha.5847408 
 - tool-dfuutil 1.9.200310 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Converting main.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 36 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <RPC> 1.0
|   |-- <rpclib> 1.0.0
|   |-- <openamp> 1.0
Building in release mode
Compiling .pio/build/portenta_h7_m7/src/main.ino.cpp.o
Checking size .pio/build/portenta_h7_m7/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  12.2% (used 63856 bytes from 523624 bytes)
Flash: [==        ]  19.9% (used 156408 bytes from 786432 bytes)
===== [SUCCESS] Took 24.49 seconds =====
2 Likes

Hi Maximilian, Excellent thanks!
it compiles successfully (with some warnings) using your platformio.ini settings, fetching your package. It seems it compiles also several sources from e.g. FrameworkArduinoVariant, FrameworkArduino, lib44d…

So …if I may, would you mind explaining briefly what was the issue: what did you add in your version of the package that makes compiling code using RPC (and rpclib) doesn’t complain about asio.hpp missing? I still can’t locate any asio.hpp in my ~/.platformio or in my project’s directory .pio folder.

In any case, I’m back with platformIO!

Again, thanks a lot.

Ludo

I just did what the Arduino IDE does, as I said it does not compile the .cc files inside the rpclib library, and only in these files asio.hpp is needed. So the Arduino IDE does also not need or have asio.hpp (I searched my entire Arduino packages too). The fix is in

, adding a library.json that ignores the .cc files, like the Arduino IDE does. In PlatformIO, .cc files are apparently seen as valid to be compiled C++ files, but not so in the Arduino IDE (?).

1 Like

Interesting… On my side, before posting here, I had started to comment out the include<asio.hpp> in various places of rpclib in my local ~/.platformio/, suspecting asio.hpp simply wasn’t used but then other headers came about “not found”.

Seems like not many people use platformIO to develop on the portenta (or that few use platformIO + portenta + RPC).

See Update Arduino-mbed core to v3.0.1 · platformio/platform-ststm32@7679fc5 · GitHub

This code should work:

[env:upstream_develop]
platform = https://github.com/platformio/platform-ststm32.git
board = portenta_h7_m7
framework = arduino
1 Like

Fixed in the latest v3.0.1 version, the cc files were removed from the sources.

1 Like

Thanks Ivan, the code compiles all right.
So your modifications aren’t taken into account when one does a pio update, modifications are only applied via a local platformio.ini, right?
Because doing a pio update, the platformio/framework-arduino-mbed remains at 2.6.1:

$ pio update
[...]
Platform ststm32
[...]
Updating platformio/framework-arduino-mbed    2.6.1 @ ~2.6.0                     [Up-to-date]
[...]

Ludo

We have not released support for v3.0.1. You have to use the development branch of the STM32 dev platform. See my comment Portenta and RPC: missing `asio.hpp` header; `framework-arduino-mbed` not latest - #10 by ivankravets

1 Like

You’d have to do pio platform update https://github.com/platformio/platform-ststm32.git

Edit: Since the stable platform was released you can again do pio platform update ststm32 and then just use platform = ststm32 in your platformio.ini.

1 Like

There is a stable release with a new Arduino core. Please just re-run pio platform update.

1 Like

Hey guys, I don’t get it. Here on my setup asio.hpp is still missing. I’ve updated everything: pio Core 6.0.2.
I tried VSCode and Clion.
Update: Arduino IDE works fine…

Any ideas? :slight_smile:

Thank you!!

Processing portenta_h7_m7 (platform: ststm32; board: portenta_h7_m7; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/portenta_h7_m7.html
PLATFORM: ST STM32 (15.4.0+sha.f4a4a9e) > Arduino Portenta H7 (M7 core)
HARDWARE: STM32H747XIH6 480MHz, 511.35KB RAM, 768KB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduino-mbed @ 3.1.1 
 - tool-dfuutil @ 1.11.0 
 - tool-openocd @ 2.1100.211028 (11.0) 
 - tool-stm32duino @ 1.0.1 
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 37 compatible libraries
Scanning dependencies...
Dependency Graph
|-- RPC @ 1.0
|   |-- rpclib @ 1.0.0
|   |-- openamp @ 1.0
Building in release mode
Compiling .pio/build/portenta_h7_m7/src/main.cpp.o
Generating LD script .pio/build/portenta_h7_m7/cpp.linker_script.ld
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/format.cpp.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/client.cc.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/detail/client_error.cpp.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/detail/response.cpp.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/detail/server_session.cc.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/dispatcher.cpp.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/nonstd/optional.cpp.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/rpc_error.cpp.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/server.cc.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/this_handler.cpp.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/this_server.cpp.o
Compiling .pio/build/portenta_h7_m7/lib051/rpclib/rpc/this_session.cpp.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/condition.c.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/device.c.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/generic_device.c.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/generic_init.c.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/generic_io.c.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/init.c.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/io.c.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/irq.c.o
Compiling .pio/build/portenta_h7_m7/liba8e/openamp_arduino/log.c.o
/home/benjo/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src/rpc/client.cc:13:10: fatal error: asio.hpp: No such file or directory
[env:portenta_h7_m7]
platform = ststm32
board = portenta_h7_m7
framework = arduino
upload_port = /dev/ttyACM1

[env:portenta_h4_m4]
platform = ststm32
board = portenta_h7_m4
framework = arduino
upload_port = /dev/ttyACM1

ArduinoCore-mbed/libraries/rpclib at master · arduino/ArduinoCore-mbed · GitHub doesn’t have a library.json at all which could fix this like I’ve done in Ignore noncompilable files · maxgerhardt/ArduinoCore-mbed@5847408 · GitHub.

Can you locally

wget -O ~/.platformio/packages/framework-arduino-mbed/libraries/rpclib/library.json https://raw.githubusercontent.com/maxgerhardt/ArduinoCore-mbed/5847408bd987985ab792988685f0a0cd8dd1fd89/libraries/rpclib/library.json

to put the file in there?

1 Like

Okay now I understand the point. After putting your library.json into the rpclib directory it works super fine.

Thank you!

1 Like

Then I think that the updated package had my fix in there one time, but it didn’t make it in the next package version because it wasn’t there at the source… I will try and PR this library.json back to ArduinoCore-mbed.

1 Like

Hello I just installed a fresh VScode + platform IO and tried it and got the exact same error…


|-- Wire
|-- RPC @ 1.0
|   |-- openamp @ 1.0
|   |-- rpclib @ 1.0.0
Building in debug mode
Compiling .pio\build\myproj\src\pHsensor.cpp.o
Compiling .pio\build\myproj\src\pHsensor.ino.cpp.o
Compiling .pio\build\myproj\lib959\rpclib\rpc\detail\server_session.cc.o
Archiving .pio\build\myproj\libFrameworkArduino.a
In file included from C:\Users\name\.platformio\packages\framework-arduino-mbed\libraries\rpclib\src/rpc/detail/server_session.h:13:0,
                 from C:\Users\name\.platformio\packages\framework-arduino-mbed\libraries\rpclib\src\rpc\detail\server_session.cc:1:
C:\Users\name\.platformio\packages\framework-arduino-mbed\libraries\rpclib\src/rpc/detail/async_writer.h:6:10: fatal error: asio.hpp: No such file or directory

and it was the same after I installed the latest version of ststm32:

PS C:\Users\name\Documents\PlatformIO\Projects\230125-110218-portenta_h7_m7> pio pkg install --platform "https://github.com/platformio/platform-ststm32.git"
Resolving myproj dependencies...
Platform Manager: ststm32@15.4.1+sha.f5408ad is already installed
Tool Manager: toolchain-gccarmnoneeabi@1.70201.0 is already installed
Tool Manager: framework-arduino-mbed@3.1.1 is already installed
Tool Manager: tool-dfuutil@1.11.0 is already installed
Already up-to-date.
PS C:\Users\name\Documents\PlatformIO\Projects\230125-110218-portenta_h7_m7> pio --help
Usage: pio [OPTIONS] COMMAND [ARGS]...

I also tried changing my platformio.ini:
platform = GitHub - platformio/platform-ststm32: ST STM32: development platform for PlatformIO
board = portenta_h7_m7
framework = arduino

thank you for you help