Welcome to FPGA MicroPython (FμPy)
The aim of this project is to make MicroPython run on FPGAs using the LiteX & Migen+MiSoC technologies. This allows you to do full stack development (FPGA gateware & soft CPU firmware) in Python!
Our MicroPython fork is at:
https://github.com/fupy/micropython
with the port files in ports/fupy
.
Gateware
Gateware
is the name we use for the hardware code that is loaded onto the FPGA that MicroPython runs on.
For MicroPython development we use a the TimVideos
litex-buildenv
from the
TimVideos Project, which also produces
HDMI2USB.
Getting Started
-
Aug 2018 - HowTo FμPy on Digilent Arty A7
-
Jan 2018 – long blog post with instructions for Numato Mimas v2 and Digilent Arty A7, using
timvideos/litex-buildenv
.
Developing in MicroPython environment
- get lm32 toolchain
- git clone https://github.com/fupy/micropython.git
- cd litex
- Download prebuilt gateware + headers using
get-gateware.sh
- Compile micropython
- Load micropython
Developing in the litex-buildenv
environment
- Follow getting started instructions to setup gateware environment.
- Enter the gateware environment with ./scripts/enter-env.sh
- Set PLATFORM and TARGET correctly - eg “export PLATFORM=mimasv2” if using the MimasV2
- Build the gateware with
make gateware
- Run
./scripts/build-micropython.sh
This will give you an image for your target at ./build/$PLATFORM_$TARGET_lm32/micropython.bin
which you can then flash to your board.
Running MicroPython inside QEmu environment
The litex-buildenv
LiteX environment provides some limited QEmu emulation of the FPGA gateware, this means you can test your code without needing hardware.
It can be used with the MicroPython image by running ./scripts/build-qemu.sh
and then replacing -kernel qemu.bin
with -kernel micropython.bin
in the last command.
See the TimVideos’ QEmu for LiteX GitHub Repo
More Information
Contact
Current Targets
Hardware Targets
-
Arty A7 – $100 USD, Artix 7 board with DDR memory
-
MimasV2 - $50 USD, Spartan 6 board with DDR memory.
-
Future FPGA MicroPython targets are documented in this spreadsheet.
Software Targets
These targets don’t need any physical hardware and are good for testing / developing.
- LiteX QEmu emulation (see MicroPython on FPGAs Wiki Page for notes on getting started)
- Verilator Verilog Simulator