Mojo - Microcontrollers
Mojo code on Raspberry Pi Pico/Arduino instead of MicroPython? It would bring significant speed ups and could be fairly easy to work with and would be amazing in performance critical applications.
6 Replies
Mojo on Arduinos would be so cool.
Yeah in the future,
arm64
Linux will come at some point after native Windows.Wrong thread maybe? Also, now that you’re here ;), what do you think of arduino/microcontroller targeted compiling?
I'm not familiar, thought they had arm64 Linux boards. More esoteric compilation targets like that aren't a priority right now, but will come eventually.
Many modern microcontrollers are ARM Cortex-M cores. (arm64 is more often the single board computer (SBC) space that Raspberry Pi started.) Microcontrollers are the space that "embedded" Rust lives. There isn't usually an operating system at all.
I'm interested in Mojo on microcontrollers as a replacement for C. I work on CircuitPython which, like CPython, uses C for the fast bits. I'd love to move these portions to memory safe Mojo code. I'd need the compiler backed to produce Cortex-M elf object files I could link to. That way we could mix C and Mojo as we migrate.
I am interested in a step up from running on the metal (no OS) - my interest is running on an RTOS - FreeRTOS, ThreadX or Zephyr. There are multiple hurdles before that could happen. IMO, the biggest hurdle is memory image size. I note that HelloWorld.mojo compiles to 256KB on macOS. With a stripped down libc, that can be less than 10K on an Arm Cortex-M when written in C.