The Raspberry Pi RP2040 is now supported by the Arduino Core mbed 2.0!

 Recently TheMagPi Magazine & Arduino Tweeted "Official support for Raspberry Pi Pico and other RP2040-based boards now in the Arduino IDE!"

The Raspberry Pi RP2040 is now supported by the Arduino Core mbed 2.0!

The Arduino Nano RP2040 Connect module, a port of the Raspberry Pi Pico, has been announced by Arduino. They've also agreed to port the Arduino core to the Raspberry Pi Pico, adding the Arduino IDE, libraries, and more!

Check Github ArduinoCore-mbed

Changes:

Following a broad community request, we targeted two pain point of existing core:

  • installation speed
  • compilation speed

They are both very noticeable on Windows platforms, where file access is much slower and the antivirus can potentially check every file being compiled.

To fix the first, we removed debugging information from libmbed.a (to make the final library much smaller) and we split the core into different packages. This only happens at release time, if you are developing nothing changes.
Debugging information are being added back when compiling the user sketch, so IDE 2.0 users will be able to debug proficiently.
If you are interested in debugging the mbed internals, just run
./mbed-os -a TARGET_BOARD:TARGET_BOARD after removing 0001-PACKAGING-remove-gdb-exta-information-to-slim-librar.patch from patches folder and this will recreated a debuggable (and bigger) libmbed.a

To fix the slow compilation, we invested some time in profiling what was going on when g++ was called. It turns out that most of the time was spent parsing and resolving Callback.h from mbed-os. Since most of the drivers are including it, Arduino.h was "tainted". The solution we applied involves not including directly the headers, but only "stubs", and provide the object definition in a cpp file. This way, only that file will be compiled slowly and not the whole core.
This creates, however, a bunch of incompatibilities with older code, notably:

  • SerialUSB does not inherit from mbed::FileHandle anymore
    • you can't call printf or redirect stdout to it directly
      FIX: use REDIRECT_STDOUT_TO(Serial) macro as usual
  • Using mbed internal APIs may result in compile time errors
    FIX: always explicitely include mbed headers when using an mbed class

As always, feel free to report any bug you may find!


Also Check: