Skip to content

Latest commit

 

History

History
103 lines (71 loc) · 3.26 KB

icoboard.mkdn

File metadata and controls

103 lines (71 loc) · 3.26 KB

The Icoboard Demo

Note: this reflects the state of the demo on 2018-01-22. If you want to check out code that behaves the way this document describes, I suggest checking out the commit where this doc was last modified.

The Icoboard demo boots to a Forth environment, with support for VGA output, PS/2 keyboard, serial port, and SD card modules.

Connections

The demo is designed around the following PMOD attachments.

In addition, an optional serial port can be used with any Pmod UART module with the Pmod Interface Type 4 pinout, such as Digilent's USBUART module.

Connections are as follows:

  • VGA STK1 connector to Icoboard Pmod 3 (STK2 connector not used).
  • PS/2 on Icoboard Pmod 4.
  • SD on Icoboard Pmod 2.
  • Serial on Icoboard Pmod 1 TOP ROW. This helps it clear Digilent's ridiculously oversized SD PCB on port 2.

The pin mapping is set by rtl/syn/icoboard.pcf together with rtl/syn/ico-top.v. If you want to rearrange things, that's where to start.

Build and Flash

To build, you will need recent (as of late 2017) versions of

All further commands should be run from the cfm checkout.

First, invoke Stack to set up an isolated environment with the right version of GHC and dependencies:

$ stack setup
$ stack build

(The makefile does that, but it hides the output -- if something fails it's much easier to see with the commands above.)

Now, run synthesis:

$ make -j all-ico

Connect your Icoboard (I have only tested it using the USB base board).

Write the Forth boot image into SPI flash:

$ make program-ico-boot

Now send the circuit and bootloader bitstream to the FPGA:

$ make program-ico-fpga

The system should boot into Forth. If you want to flash the bitstream, so that it survives power cycles:

$ make program-ico-fpga-flash

Easily upload a new Forth image

Burning a Forth image to SPI flash isn't ideal for iterative development. I'm currently carrying a set of words around that allow XMODEM image download. Here's a snapshot if you're curious.

( Reloader for rebooting from high mem image                   )
here  $3B00 DP ! ]
$3B00 begin 2 - dup $4000 + @ swap !a dup 0 = until >r ; DP !
: reload $3B00 >r ;

( XMODEM himem loader )
: xhi  $15 tx
  begin rx!
    4 over = if drop $06 tx exit then
    1 <> if 1 throw then
    rx! rx! over 255 swap - <> if 2 throw then
    1- dup . 7 lshift $4000 + 128 bounds 0 >r begin
      over over xor
    while rx! 2dup swap c! r> + >r 1+ repeat 2drop
    rx! r> $FF and <> if '?' emit $15 tx else $06 tx then again
;

As you can probably infer from the horrible horizontal formatting of that code, I've stashed those words into two blocks on an SD card so I can easily call them up if required.