In general, boards with some form of networking stack use an RTOS to deal the the asynchronicity of networking. Arduino picked MBED.
Theoretically you can use some other OS, but it's likely to be "fussy."
If you use the Earl Philhower core for RP2040 Connect, I believe you'd start out with no RTOS (although, I'm not sure what it does for networking on boards with WiFi.)
(Note that the rp2040 Connect's WiFi module is a whole separate ESP32, which I believe uses FreeRTOS to run IT'S network stack, so I'm not really clear on why MBED is also involved.)
For the most part. Arduino has applied some patches to Mbed OS:
They are mostly adding new targets for the Arduino boards. They would generally avoid making any changes to the Mbed OS API, and so don't affect the applicability of the documentation.
This, and add the mbed:: scoping operator to references to objects in the global Mbed OS namespace.
Here is an example of how you can use the Mbed OS API in an Arduino sketch to blink the built-in LED on the Nano RP2040 Connect board:
#include <mbed.h>
mbed::DigitalOut myled(LED1);
void setup() {
Serial.begin(9600);
while (!Serial) {} // Wait for serial port to be opened.
delay(750); // Give Serial Monitor some time to initialize.
Serial.println("Enter the pin state to set the built-in LED (0/1).");
}
void loop() {
if (Serial.available()) {
char state = Serial.read();
rtos::ThisThread::sleep_for(100); // Allow the full message to arrive.
while (Serial.available()) {
Serial.read(); // Clear the receive buffer.
}
Serial.print("Setting pin to state ");
Serial.println(state);
switch (state) {
case '0':
{
myled.write(0);
break;
}
case '1':
{
myled.write(1);
break;
}
default:
{
Serial.println("error: State is not valid");
}
}
}
}
However, you do need to keep in mind that there can be conflicts between resources used by different parts of your code. That is even the case when you are only using the Arduino API and libraries though.