An Arduino UNO compatible implementation for the iCE40 FPGAs
Currently oriented to the Kefir I board (iCE40HX4K + Arduino/ChipKit connectors and MCP3008 A/D)
A reduced version (only I/O pins and RS-232, with a small ammount of flash and RAM) is available for the iCEStick and IceZum Alhambra is available (iCE40HX1K).
What's needed to synthesize the IP core
You need to install the Lattice iCECube2 tool.
You should also install some of the FPGA Libre tools. The lattuino-tools package will pull all the needed dependencies.
usuario@ubuntu$ curl -sSL http://fpgalibre.sf.net/debian/go | sudo sh usuario@ubuntu$ sudo apt-get install lattuino-tools
root@debian# curl -sSL http://fpgalibre.sf.net/debian/go | sh root@debian# apt-get install lattuino-tools
How to run the synthesis
Once installed you'll find a script called synth_lattuino_1.sh. Modify the XIL_TOOLS_ICE_DIR variable to point to your iCECube2 installation. Then run the script.
For the iCEStick/IceZum the script is called synth_lattuino_stick.sh. Note that we included a pre-generated bitstream: lattuino/FPGA/lattuino_stick/pre-gen/Lattuino_Stick_bitmap.bin. Also note that the core fits very tightly, so you could have issues if using an iCEcube2 different than version 2017.01.
How to add Lattuino support to the Arduino IDE
You'll need a modern version of Arduino's IDE, I used 1.8.1 (works on 1.8.2 and also on 1.6.13, not in 1.6.9)
- Go to File/Preferences menu
- Add the following URL http://fpgalibre.sf.net/Lattuino/package_lattuino_index.json as source of additional boards
- Now enter to the Tool/Board menu and choose the Boards manager option.
- Scroll down to bottom and look for the Lattuino 1 by FPGA Libre entry.
- Click on More info and press the Install button.
- Once installed you'll get a new section under Tool/Board named Lattuino.
How to configure the core
You can manually edit FPGA/lattuino_1/cpuconfig.vhdl or you can use the configuration tool.
To run the configuration tool you need TCL/Tk installed (UNIX wish command or Cygwin's cygwish80). Then run:
make -C tools/tkconfig/ xconfig
Note that this will most probably try to rebuild some tools. If you don't have the GCC compiler installed you can just run:
touch tools/tkconfig/tkparse.o tools/tkconfig/tkcond.o tools/tkconfig/tkgen.o tools/tkconfig/tkparse touch tools/tkconfig/lattuino.tk touch tools/tkconfig/lconfig.tk make -C tools/tkconfig/ xconfig