Skip to content

Commit f5ddfaa

Browse files
pallerolofk
authored andcommitted
Add iCESugar-nano board
Follow the 6 steps to add support for a new target. Step 1: Locate input and output pins. Step 2: Add pin constraint file. This covers clock input, LED and UART output. Step 3: Create a clock generator. The chip has no internal clock generator so the external 12 MHz clock is used. Step 4: Add top level servant_ice40_cm36 which connects the one-wire output of servant to the LED pin. Step 5: Add fileset including the new top level and pin constraints. Step 6: Add target icesugar-nano.
1 parent 64e475c commit f5ddfaa

4 files changed

Lines changed: 79 additions & 0 deletions

File tree

data/icesugar_nano.pcf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 12 MHz external clock
2+
set_io i_clk D1
3+
4+
# LED
5+
set_io o_led B6
6+
7+
# UART
8+
set_io i_uart_rx A3
9+
set_io o_uart_tx B3

doc/servant.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ serial console will show up.
155155

156156
fusesoc run --target=icesugar servant
157157

158+
iCESugar-nano
159+
^^^^^^^^^^^^^
160+
161+
Pin B3 is used for LED output. As the default clock of 12 MHz is rather slow
162+
the LED only toggles every 9 seconds with the default blinky example.
163+
164+
Thanks to the onboard debugger, you can just connect the USB Type-C connector
165+
to the PC, and a serial console will show up. However, the device doesn't have
166+
enough RAM to run the Zephyr hello-world example so the UART pins are not
167+
connect but they are defined in the PCF for easy reference.
168+
169+
fusesoc run --target=icesugar-nano servant
170+
158171
ICE-V Wireless
159172
^^^^^^^^^^^^^^
160173

servant.core

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ filesets:
157157

158158
icesugar : {files: [data/icesugar.pcf : {file_type : PCF}]}
159159

160+
icesugar_nano:
161+
files:
162+
- data/icesugar_nano.pcf : {file_type : PCF}
163+
- servant/servant_ice40_cm36.v : {file_type : verilogSource}
164+
160165
icev_wireless : {files: [data/icev_wireless.pcf : {file_type : PCF}]}
161166

162167
gmm7550:
@@ -441,6 +446,17 @@ targets:
441446
pnr: next
442447
toplevel : service
443448

449+
icesugar-nano:
450+
default_tool : icestorm
451+
description : iCE40LP1K Development Board by MuseLab
452+
filesets : [mem_files, soc, icesugar_nano]
453+
parameters : [memfile=blinky.hex, memsize=7168]
454+
tools:
455+
icestorm:
456+
nextpnr_options: [--lp1k, --package, cm36, --freq, 12]
457+
pnr: next
458+
toplevel : servant_ice40_cm36
459+
444460
icev_wireless:
445461
default_tool : icestorm
446462
description: ICE-V Wireless

servant/servant_ice40_cm36.v

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
`default_nettype none
2+
module servant_ice40_cm36 (
3+
input wire i_clk,
4+
output wire o_led
5+
);
6+
7+
parameter memfile = "blinky.hex";
8+
parameter memsize = 7168;
9+
10+
wire wb_clk;
11+
reg wb_rst;
12+
13+
/* iCE40 CM36 has no PLL. Drive everything from the external clock. */
14+
assign wb_clk = i_clk;
15+
16+
/* Board has no button that can be used for reset, but blinky doesn't
17+
* work at all if the reset isn't enabled for at least 25 clocks.
18+
*
19+
* This will generate a reset signal at power on.
20+
*/
21+
reg [7:0] rst_cnt = '0;
22+
23+
always @(posedge i_clk) begin
24+
if (rst_cnt < 255) begin
25+
rst_cnt <= rst_cnt + 1;
26+
wb_rst <= 1;
27+
end else begin
28+
wb_rst <= 0;
29+
end
30+
end
31+
32+
servant #(
33+
.memfile(memfile),
34+
.memsize(memsize)
35+
) servant (
36+
.wb_clk(wb_clk),
37+
.wb_rst(wb_rst),
38+
.q (o_led)
39+
);
40+
41+
endmodule

0 commit comments

Comments
 (0)