Skip to content

Instantly share code, notes, and snippets.

@SuperThunder
Last active December 19, 2021 09:55
Show Gist options
  • Save SuperThunder/4f5f8848e8f4fa11e635b2a3e6070faf to your computer and use it in GitHub Desktop.
Save SuperThunder/4f5f8848e8f4fa11e635b2a3e6070faf to your computer and use it in GitHub Desktop.
Compiling mbed-os programs for RP2040 / Pi Pico in Mbed Studio

As of December 2021, support for RP2040 still doesn't seem to have been included in mbed mainline. Discussion from August suggests some form of test executable isn't building and this means it can't be merged. However, mbedos is used as the base for the Arduino Nano RP2040 Connect, which presumably does work, so there must be some basic level of functionality working. The PR indicates everything except RTC, LPTICKER, and PIO is supported.

However, if you want to try it anyway, I have been able to compile the mbed os 6 blinky program (not tested, though)

  1. Switch to using GCC in mbed studio by following these instructions. Restart mbed studio.
  2. Clone Arduino's mbed-os repo that includes RP2040 support to a convenient directory. You can use the branch they submitted for PR, or use a branch labelled extrapatches-<mbedosversion>
  3. Create a new mbedos6 project (eg the blink example), and use the 'shared mbedos location' option to use the mbed-os contained within the cloned repo with RP2040 support
  4. Set the target to RASPBERRY_PI_PICO
  5. Build

This should get you to a bin / elf file. I haven't tested if the blink example actually works, since I don't have any programmers for RP2040 except the UF2 bootloader. It looks it like it may be possible to make a picoprobe and then upload the generated .elf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment