Skip to content

IceCore Getting Started

Al edited this page Sep 13, 2019 · 26 revisions

IceCore Getting started

IceCore

Make sure you plug your usb cable into PRG USB connector nearest the corner before using this guide. Make sure you do not press any buttons when poweringup/plugging in as this may place the board in DFU mode.

Installation prerequisites for Linux

You need to install the Yosys tool chain. All software is free and open source.

The following steps are for installing software on Ubuntu 16.04 or later, and cover the building and installation of three tools, which are required for programming the myStorm board. You can use these for a laptop running Linux, or to install the tools on a Raspberry Pi. Users of other flavours of Linux will.

Downloading and installing pre-requisites

These are needed for compiling and installing the icestorm, Arachne-PNR and yosys tools later.

For Debian-based distributions, use the following command:

sudo apt-get install build-essential clang bison flex libreadline-dev gawk tcl-dev libffi-dev git mercurial graphviz xdot pkg-config python python3 libftdi-dev qt5-default python3-dev libboost-all-dev cmake libeigen3-dev 

For Fedora-based distributions, use the following command:

sudo dnf install make automake gcc gcc-c++ kernel-devel clang bison
flex readline-devel gawk tcl-devel libffi-devel git mercurial
graphviz python-xdot pkgconfig python python3 libftdi-devel
qt5-devel python3-devel boost-devel boost-python3-devel

Note that the tools work fine on RaspberryPi.

Installation prerequisites for macOS

You need to install the Yosys tool chain. All software is free and open source.

The following steps are for installing software on macOS and cover the building and installation of three tools, which are required for programming the myStorm board.

This guide assumes you have Homebrew installed.

Enabling xcode command line tools

xcode-select --install

Downloading and installing pre-requisites

These are needed for compiling and installing the icestorm, Arachne-PNR and yosys tools later.

brew install libftdi0 python3 gawk pkg-config libffi bison mercurial

Installation of IceStorm for linux and macOS

Downloading and installing IceStorm

Starting in an empty directory:

git clone https://github.com/cliffordwolf/icestorm.git icestorm
cd icestorm
make -j8
sudo make install

Downloading and installing Arachne-pnr

Starting in the same directory:

git clone https://github.com/cseed/arachne-pnr.git arachne-pnr
cd arachne-pnr
make -j8
sudo make install

Optional Installing NextPNR place&route tool, Arachne-PNR replacement

Starting in the same directory:

git clone https://github.com/YosysHQ/nextpnr nextpnr
cd nextpnr
cmake -DARCH=ice40 -DCMAKE_INSTALL_PREFIX=/usr/local .
make -j$(nproc)
sudo make install

Downloading and installing Yosys

Starting in the same directory:

git clone https://github.com/cliffordwolf/yosys.git yosys
cd yosys
make -j8
sudo make install

Installation guide for Windows

The following steps are for installing software on windows 10 and cover the installation of APIO, required to synsthesize Verilog for the myStorm board.

Downloading and installing Python

From the official python website download and install Python > 3.5

Then optionally add python to your path. With the default install locations open a command line and type below replacing 35 (V3.5) with your version, the python installer may offer you path edition:

set PATH=%PATH%;C:\Python35;C:\Python35\Lib;C:\Python35\DLLs;C:\Python35\Scripts

Downloading and installing APIO

Also refer to BlackIce Apio changes

In a command line:

pip install -U apio

Then to download all the apio packages

apio install -a

Also refer to Setting up an APIO project

Cloning the example code from GitHub

You will want to access IceCore repository:

The MyStorm tutorial

git clone https://github.com/folknology/IceCore.git

or just download files manually if you prefer

Your first design (Mac/Linux)

Completed examples are in the tutorial directory. We'll build the very simplest of these to drive the red LED on the board. First change into the directory with the completed examples

cd IceCore/Examples/blink

Then make the Blink example

make

This will synthesize the code in blink/blink.v to a bitstream in chip.bin.

Your first design (Windows)

From cheat_sheet, change to the blink directory

cd IceCore\Examples\blink

Then synthesize the Blink example with apio

apio build --size 8k --type hx --pack tq144:4k

This will synthesize the code in blink.v to a bitstream in hardware.bin.

Uploading your design (Mac/Linux)

For Linux:

In first monitor terminal:

sudo bash
usermod -a -G tty yourUserName
usermod -a -G dialout yourUserName
stty -F /dev/ttyACM0 raw -echo
cat /dev/ttyACM0

The usermod changes allow your user name to access /dev/ACM0 without root later, however, this will only work when logging into a new terminal

Then in another new programming terminal:

cat chip.bin >/dev/ttyACM0

You should see something like this in the first terminal :

<Iceboot 0.5xx> Config done
Waiting for USB serial

By leaving the first terminal open and using the 2nd to cat your bitfile you get to see the response. If you unplug the BlackIce-II (or close terminals, always close them before unplugging!) you will need to reissue:

stty -F /dev/ttyACM0 raw -echo
cat /dev/ttyACM0

For your monitor terminal and in 2nd working terminal:

cat chip.bin >/dev/ttyACM0

For Mac:

In first monitor terminal:

sudo bash
stty -f /dev/cu.usbmodem1421 raw
cat /dev/cu.usbmodem1421

Then in another programming terminal:

cat chip.bin >/dev/cu.usbmodem1421

You should see something like this in the first terminal :

<Iceboot 0.5xx> Config done
Waiting for USB serial

You may need to use a different device for SERIAL depending on your machine.

Uploading your design (Windows)

If you have setup the board in APIO (apio boards --list) to the latest BlackIce issue :

apio upload

Or via windows command line, make sure you know which COM port you device is connected to by checking under Ports (COM & LPT) in Device Manager. If in doubt unplug and plug in the device to make sure. issue the following cmd to upload your Ice40 binary image to BlackIce Mx over serial :

copy chip.bin /b COM3 /b

changing COM3 for your COM port.

Slow Coms Note. If you experience very slow download rates, unplug the device from your computer. Then plug it in again and re-check all settings above.

WSL Note

It is now possible to use WSL on Windows 10, if you enable this and install Ubuntu for WSL you can then more or less follow the linux build and install instructions. The caveat is that the serial device will be /dev/ttySx where 'x' is the com port number where BlackIce Mx appears when plugged in (look at the device manager>ports) i.e. if it appears on 'com3' then use '/dev/ttyS3'. This way you get all of the benefits of Linux commandline build along with the tools..

You can’t perform that action at this time.