New in 107-Arduino-Cyphal on platformio with Raspberry pi pico

Hi, I am new to this 107-Arduino-Cyphal Arduino library.
And I am trying to compile the code just purely to include the header of “107-Arduino-Cyphal.h”
image
And it keeps failing to compile


This is my platformio.ini
image

std::span is not available until C++20 while you appear to be using an older version of the standard. It could be that your compiler is too old.

How could I upgrade the compiler? I searched around the internet and can’t find a way suitable for platformio

No idea. Maybe ask the platformio team.

General Embedded pro tip: start learning how to compile without relying on crutches (like platformIO): it won’t work (I’ve tried).

Now, now, let’s not be hasty :wink: . The success of the Arduino platform is based exactly on this fact, that it works out of the box without requiring the arcane knowledge that’s required to build embedded systems. Naturally there are trade-offs but - as the success of Arduino shows - there’s a value being provided here by making stuff simple.

That being said, 107-Arduino-Cyphal works with vanilla arduino-pico - and I would encourage you to use just that, without whatever markup and mangling platformIO provides.

arduino-cli compile -b pico:pico:rp2040 -v MySketch

arduino-pico runs -std=gnu++17 and provided you use the right compiler (see discussion here) everything including register API should work. I’ll do a check if they’ve shipped a new default compiler with the arduino-pico platform that may be causing this issue, but otherwise I believe its a platformIO problem.

2 Likes

Update: 107-Arduino-Cyphal/main/HEAD still works for arduino-pico:3.3.1.

Thank you for the help!
By default, the platformio is using -std=gnu++14 or -std=gnu++11 which what is needed is -std=gnu++17
After applying the platformio.ini with exactly like this:

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico
framework = arduino
lib_deps = 
	107-systems/107-Arduino-MCP2515@^1.4.1
	107-systems/107-Arduino-Cyphal@^3.2.1
	107-systems/107-Arduino-CriticalSection@^1.0.0

The platformio switch its c++ Standard to gnu++17 and everything works:
Maybe it’s better to mention it on the Github of 107-Arduino-Cyphal, just to help anyone new to this to have an easier start.

Well, @Kevin I’m happy to receive a pull request :wink: .

EDIT: I also see that the examples header description should be updated, since the referenced boards are no longer supported. That would be another great opportunity to earn some GitHub street credentials (just sayin) :grin: .

I stand corrected. :saluting_face:

Perhaps regarding Arduino I have this one traumatic experience where some Serial port was randomly (once every 10 minutes or so) dropping out and for the life of me I couldn’t figure out why. :sob:

I hope you were not using fake hardware sold via Alibaba :stuck_out_tongue_winking_eye: . Note: I’m not talking about clones (which are copies of the actual designs not claiming to be from Arduino) but about products that claim to be authentically made by Arduino, but are in fact cheap knock-offs that often barely work. The internet is full of them.