-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libraries: "SoftwareSerial" does not work. #346
Comments
This seems related to a problem I had earlier with I can't recall how I fixed that one, but this comment is my "note to self". |
The main question here is what the official project will try to do if you list |
"SoftwareSerial" is a platform bundled library. It is distributed as a component of some (but not all) boards platforms such as https://github.com/arduino/ArduinoCore-avr/tree/master/libraries/SoftwareSerial The |
In practice that means I have to disable the compile tests for examples using SWS for those boards. Thanks @per1234 for this insight |
Thanks @per1234, that's extremely helpful information here. I was thinking about how my library should approach this, because if I were to maintain my own mapping of "platform bundled libraries" in this project, I am in danger of being perpetually out of sync with the "ground truth" known by the Arduino environment itself. Still, is there any information I might be able to use from the configuration (e.g. @RobTillaart, you might also be able to just provide an example-specific override using an |
@ianfixes See https://github.com/RobTillaart/MHZCO2/tree/master/examples/MHZCO2_sw_serial platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
# - due // has no SoftwareSerial
# - zero // has no SoftwareSerial
- leonardo
# - m4 // has no SoftwareSerial
# - esp32 // has no SoftwareSerial
- esp8266
- mega2560
- rpipico
# external libraries
libraries:
# - "SoftwareSerial" does not work as it is build in.
|
I'm still not grasping what the proper configuration might be in this case. On one hand, per1234 says that If that's the case, then it would imply that this is a problem of configuration and not something that If there isn't a straightforward test that I can do from the library to determine whether a library is possibly builtin (like |
SWS is build in so the platforms that have it will compile. (we also not include "Arduino Lib" )
Now if I add an "external library" that does not exist as ext. lib in the yml file, I get an error. full stop. Is not the solution, but will help users a lot. |
You can get the list of installed platforms using The platform will be installed at this location:
The platform bundled libraries are installed in the You can also get the location of the libraries directly using
Yes. "Platform bundled libraries" are typically architecture-specific fundamental libraries. A better example of a platform bundled library is the "Wire" library. Most boards platform have a bundled "Wire" library. Each platform's Wire library uses a compatible standardized API, but the implementation code can be very different from one platform to the next due to it being architecture specific. For this reason, it would not make sense to try to maintain a single global "Wire" library that is compatible with all of the ever increasing number of architectures people have created boards platforms for. "SoftwareSerial" didn't attain the same level of universal adoption by the boards platform developers as "Wire" and "SPI". Some of the newer target microcontrollers have multiple hardware serial ports, in some cases even multiplexed (example), so the developers might have felt it was not worth the effort to write a variant of the library for their architecture. There is another wrinkle here, which is that some platforms bundle a variant of a library that is available from the Arduino Library Manager. They typically do this in cases where the code of the commonly used library is not compatible with their architecture. For example, Arduino maintains a popular library named "SD". The esp8266 boards platform has a platform bundled SD library written for use on the ESP8266 microcontroller: https://github.com/esp8266/Arduino/tree/master/libraries/SD
"Built-in" is the wrong term. The correct term for libraries like "SoftwareSerial" is "platform bundled": https://arduino.github.io/arduino-cli/latest/platform-specification/#platform-bundled-libraries The "built-in" term is used to refer to a separate class of libraries that are included as part of the Arduino IDE installation, such as "Servo", "Mouse", "Ethernet". Although they are installed by default with Arduino IDE, the "built-in" libraries are also in the Library Manager index, so you can use Library Manager to install the "built-in" libraries. In fact, the Library Manager infrastructure is even used by Arduino IDE 2.x to install the "built-in" libraries on the first run after a new installation. |
Also running into this. https://github.com/probonopd/TAPController/actions/runs/5705624580/job/15460490942#step:3:155 Is there a solution? |
It's been a while since I looked at this. I can see that there are a few things I need to clean up terminology-wise ("built-in" -> "platform-bundled"), and then I think there is some work to figure out exactly what is and isn't platform-bundled and react to it somehow. In truth, I'm currently one of the least knowledgeable people in this thread about how everything works. I lean on the experts for how to make decisions at config/compile time, and work from that. There may be a workaround in the configuration for now by messing with the compiler flags on a platform to force |
Repo: https://github.com/RobTillaart/MHZCO2
Has an example that uses SoftwareSerial and it compiles well on the desktop.
However in the build they fail to build
I have added the following in the yml file but it still
Note that software serial is one of the "built-in" libraries
So for now I just commented the SoftwareSerial line, so that the other things are build/tested.
error output - https://github.com/RobTillaart/MHZCO2/actions/runs/3950260138/jobs/6762557012
The text was updated successfully, but these errors were encountered: