Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Git Source Tree
Root/
| 1 | #!/usr/bin/perl |
| 2 | # |
| 3 | # mkboot - generate a bitstream (in .bit format) that boots an M1 |
| 4 | # with the "regular" bitstream, using UrJTAG |
| 5 | # |
| 6 | # Hacked 2011 by Werner Almesberger |
| 7 | # |
| 8 | |
| 9 | # |
| 10 | # bitstream file magic, copied from xilinx_bitstream.c:xlx_bitstream_load_bit |
| 11 | # |
| 12 | |
| 13 | print pack("C*", |
| 14 | 0x00, 0x09, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 0xf0, |
| 15 | 0x0f, 0xf0, 0x00, 0x00, 0x01); |
| 16 | |
| 17 | # |
| 18 | # The 0xffff dummy and the 0x2000 NOP seem to be unnecessary in this case, |
| 19 | # so we omit them. |
| 20 | # |
| 21 | # To boot the rescue bitstream instead of the regular bitstream, change |
| 22 | # the value of GENERAL2 from 0x0037 to 0x0005. |
| 23 | # |
| 24 | |
| 25 | @seq = ( |
| 26 | # 0xffff, # DUMMY |
| 27 | 0xaa99, # Sync(1) |
| 28 | 0x5566, # Sync(2) |
| 29 | 0x3261, # write GENERAL1 |
| 30 | 0x0000, # start address 15:0 |
| 31 | 0x3281, # write GENERAL2 |
| 32 | 0x0037, # start address 23:16 |
| 33 | 0x30a1, # write CMD |
| 34 | 0x000e); # IPROG |
| 35 | # 0x2000); # NOP |
| 36 | |
| 37 | # |
| 38 | # "e" section in bitstream file, with the length in bytes. |
| 39 | # |
| 40 | |
| 41 | print pack("aN", "e", 2*@seq); |
| 42 | |
| 43 | # |
| 44 | # the actual bitstream |
| 45 | # |
| 46 | |
| 47 | print pack("n*", @seq); |
| 48 |
Branches:
master
