Skip to content

Commit 22fd96b

Browse files
committed
root commit
0 parents  commit 22fd96b

File tree

9 files changed

+8544
-0
lines changed

9 files changed

+8544
-0
lines changed

firmware/.vscode/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
3+
!.gitignore
4+
!launch.json
5+
!tasks.json

firmware/.vscode/tasks.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Build",
8+
"type": "shell",
9+
"command": "make",
10+
"group": {
11+
"kind": "build",
12+
"isDefault": true
13+
}
14+
},
15+
{
16+
"label": "Rebuild",
17+
"type": "shell",
18+
"command": "make clean; make"
19+
},
20+
{
21+
"label": "Clean",
22+
"type": "shell",
23+
"command": "make clean"
24+
}
25+
]
26+
}

firmware/Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
TARGET_NAME = ice40-dev
2+
3+
# Directories
4+
TARGETDIR = bin
5+
SOURCEDIR = src
6+
7+
# flags
8+
# lp384 set device type to iCE40LP384
9+
# lp1k set device type to iCE40LP1K
10+
# lp8k set device type to iCE40LP8K
11+
# hx1k set device type to iCE40HX1K
12+
# hx8k set device type to iCE40HX8K
13+
# up5k set device type to iCE40UP5K
14+
# u4k set device type to iCE5LP4K
15+
DEVICE = lp384
16+
PACKAGE = SG32
17+
TOPVFILE = top
18+
19+
# Sources
20+
SRCFILES := $(addsuffix /*, $(SOURCEDIR))
21+
SRCFILES := $(wildcard $(SRCFILES))
22+
23+
VSOURCES := $(filter %.v, $(SRCFILES))
24+
PCFILE := $(filter %.pcf, $(SRCFILES))
25+
26+
# Targets
27+
TARGETBIN = $(addsuffix .bin, $(TARGETDIR)/$(TARGET_NAME))
28+
TARGETASC = $(addsuffix .asc, $(TARGETDIR)/$(TARGET_NAME))
29+
TARGETBLIF = $(addsuffix .blif, $(TARGETDIR)/$(TARGET_NAME))
30+
TARGETJSON = $(addsuffix .json, $(TARGETDIR)/$(TARGET_NAME))
31+
32+
synthesize: make-dir $(TARGETBIN)
33+
34+
$(TARGETBLIF): $(VSOURCES)
35+
@echo Synthesizing blif file...
36+
@yosys -q -p "synth_ice40 -top $(TOPVFILE) -asc $@" $(VSOURCES)
37+
38+
$(TARGETJSON): $(VSOURCES)
39+
@echo Synthesizing json file...
40+
@yosys -q -p "synth_ice40 -top $(TOPVFILE) -json $@" $(VSOURCES)
41+
42+
$(TARGETASC): $(TARGETJSON) $(PCFILE)
43+
@echo Runing place and route...
44+
@nextpnr-ice40 -q --$(DEVICE) --json $(TARGETJSON) --pcf $(PCFILE) --asc $@
45+
46+
$(TARGETBIN): $(TARGETASC)
47+
@echo Packing bin file...
48+
@icepack $< $@
49+
50+
run: $(TARGETBIN)
51+
@iceprog -S $<
52+
53+
flash: $(TARGETBIN)
54+
@iceprog $<
55+
56+
#burn: $(TARGETBIN)
57+
58+
#erase: iceprog -b -c $<
59+
60+
timing: $(TARGETASC)
61+
icetime -tmd $(DEVICE) -r $(TARGETDIR)/$@.txt $<
62+
63+
make-dir:
64+
@mkdir -p $(TARGETDIR)
65+
66+
clean:
67+
@rm -rf $(TARGETDIR)/*
68+
69+
.PHONY: clean make-dir timing flash run synthesize

0 commit comments

Comments
 (0)