Permalink
Browse files

mkboot integration in the board flash Makefile

  • Loading branch information...
1 parent bdfed2a commit 2e8e6b55e09a7615124efdae3c52da02c2e2ffa2 @kristianpaul committed Nov 27, 2011
@@ -5,7 +5,7 @@ SERIAL?=/dev/ttyUSB0
all: $(TARGETS)
clean:
- rm -f $(TARGETS)
+ rm -f $(TARGETS) boot.bit
standby.fpg:
$(MAKE) -C $(MMDIR)/tools
@@ -55,4 +55,14 @@ connect:
stty -F $(SERIAL) raw 115200
while : ; do cat $(SERIAL) ; done & cat > $(SERIAL)
-.PHONY: flash clean connect
+boot: boot.jtag boot.bit
+ jtag -q boot.jtag
+
+standby: standby.jtag
+ jtag -q standby.jtag
+
+boot.bit: mkboot
+ ./mkboot >$@ || { rm -rf $@; exit 1; }
+
+
+.PHONY: flash clean connect boot standby clean
@@ -0,0 +1,5 @@
+cable milkymist
+detect
+instruction CFG_OUT 000100 BYPASS
+instruction CFG_IN 000101 BYPASS
+pld load boot.bit
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+#
+# mkboot - generate a bitstream (in .bit format) that boots an M1
+# with the "regular" bitstream, using UrJTAG
+#
+# Hacked 2011 by Werner Almesberger
+#
+
+#
+# bitstream file magic, copied from xilinx_bitstream.c:xlx_bitstream_load_bit
+#
+
+print pack("C*",
+ 0x00, 0x09, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 0xf0,
+ 0x0f, 0xf0, 0x00, 0x00, 0x01);
+
+#
+# The 0xffff dummy and the 0x2000 NOP seem to be unnecessary in this case,
+# so we omit them.
+#
+# To boot the rescue bitstream instead of the regular bitstream, change
+# the value of GENERAL2 from 0x0037 to 0x0005.
+#
+
+@seq = (
+# 0xffff, # DUMMY
+ 0xaa99, # Sync(1)
+ 0x5566, # Sync(2)
+ 0x3261, # write GENERAL1
+ 0x0000, # start address 15:0
+ 0x3281, # write GENERAL2
+ 0x0037, # start address 23:16
+ 0x30a1, # write CMD
+ 0x000e); # IPROG
+# 0x2000); # NOP
+
+#
+# "e" section in bitstream file, with the length in bytes.
+#
+
+print pack("aN", "e", 2*@seq);
+
+#
+# the actual bitstream
+#
+
+print pack("n*", @seq);
@@ -0,0 +1,3 @@
+cable milkymist
+detect
+pld reconfigure

0 comments on commit 2e8e6b5

Please sign in to comment.