Repository navigation
Run MicroPython On Your SoC
A Python prompt on the serial port of your SoC, with litex.leds() and your CSRs reachable
from it. The port of MicroPython lives in
litex-hub/micropython (ports/litex), runs on any
SoC with a supported CPU (the RISC-V cores, Mor1kx, LM32), and builds against the headers of
your SoC like the BIOS does. Fifteen minutes.
Any board of LiteX-Boards, here the Arty with GPIOs on a Pmod. MicroPython wants about 32 KiB of RAM and 128 KiB for the firmware: a block RAM main RAM is enough on mid-size FPGAs, otherwise a DRAM.
python3 -m litex_boards.targets.digilent_arty --with-ethernet --with-pmod-gpio --build --loadgit clone https://github.com/litex-hub/micropython && cd micropython/ports/litex
export BUILD_DIRECTORY=<path to>/build/digilent_arty # the headers and the compiler flags of your SoC
make # build/firmware.binlitex_term /dev/ttyUSB1 --kernel=build/firmware.bin # or boot.bin on the TFTP server or the SD card>>> import litex
>>> litex.leds(0b0101)
>>> import umachine; umachine.freq()Et voilà! umachine gives the basics (reset, frequency, identifier) and the litex module the
LEDs, the switches and the CSRs. The other boot methods are on the
firmware page.
The older FuPy and CircuitPython ports, and MQuickJS (the same idea with JavaScript), are on OSes ecosystem.
- Run Zephyr on your SoC: an RTOS instead of a prompt.
- Write firmware for it: the C the port is built on.
- OSes ecosystem: everything that runs on a LiteX SoC.
Have a question or want to get in touch? Join us on Discord or on IRC: #litex at irc.libera.chat. This wiki is generated from doc/wiki in the LiteX repository: edit it with a pull request.
- Start here
- Build your SoC
- Run software on it
- How LiteX works
- Reference
- Projects and community
- For AI agents