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

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?

2 Likes

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

Do you see such a file in your local C:\Users\<user>\.platformio\packages\framework-arduino-mbed\[....] folder?

Nope… do you mean here:

Then likely PlatformIO staff didn’t put this fix into newly released framework versions. Can you manually add back the library.json from the link above in that folder and retry clean + compilation?

I will. thank you!! … Did you change the library.properties as well? I have a nicla that I might connect in the future.