Flashing the Milkymist One
From Milkymist Wiki
|
There are several ways to flash your Milkymist One. Our goal is to make it as easy as possible.
[edit] Web update (recommended)
This is the preferred method for all users.
- Connect the M1 to the internet. DHCP is default, for manual network setup open the "System Settings" dialog.
- Click "Web Update" in the control panel.
- Update from web
- In "Update" window, click on "Update from Web"
- Update from files
- Download flickernoise.fbi, bios.bin and soc.fpg from http://www.milkymist.org/updates/current
- cd to the downlaoded files location
- Transfer files from local machine to M1 via FTP
- On local machine:
- $ ftp M1_IP_Address
- When prompt enter login name and password
- ftp> cd ssd
- ftp> put flickernoise.fbi
- ftp> put bios.bin
- ftp> put soc.fpg
- Click "Update from files"
- In "Update from files" window, browse to each file then click on "Flash" button.
- Update from web
[edit] Automated JTAG method (for developers)
this method needs recently UrJtag installed in your system, first connect your computer to Jtag-serial-daughterboard.
[edit] Reflash all
$ wget https://raw.github.com/milkymist/scripts/master/scripts/reflash_m1.sh $ chmod +x reflash_m1.sh $ sudo ./reflash_m1.sh --qi
[edit] Flash BIOS with mac address
$ sudo ./reflash_m1.sh --bios-mac 00 17 # $1 $2 is the last two mac address with Hexadecimal
[edit] Full JTAG reflash (for developers or badly bricked boards)
[edit] Flash Memory Distribution
You should be aware of this assignment before try write/erase the flash:
STANDBY BITSTREAM (0x00000000) /* 640k */ RESCUE BITSTREAM (0x000A0000) /* 1536k */ RESCUE BIOS (0x00220000) /* 128k */ MAC ADDRESS (0x002200E0) /* MAC within rescue BIOS */ RESCUE SPLASH (0x00240000) /* 640k */ RESCUE APP (0x002E0000) /* 4096k */ REGULAR BITSTREAM (0x006E0000) /* 1536k */ REGULAR BIOS (0x00860000) /* 128k */ REGULAR SPLASH (0x00880000) /* 640k */ REGULAR APP (0x00920000) /* remaining space (23424k) */
(from flash.h)
#define FLASH_SECTOR_SIZE (128*1024) #define FLASH_PARTITION_COUNT (5) #define FLASH_PARTITIONS { \ { .start_address = 0x806E0000, .length = 0x0180000 }, \ Regular BitStream { .start_address = 0x80860000, .length = 0x0020000 }, \ Regular BIOS { .start_address = 0x80880000, .length = 0x00A0000 }, \ Regular Splash { .start_address = 0x80920000, .length = 0x0400000 }, \ Regular APP(Flickernoise) { .start_address = 0x80D20000, .length = 0x12E0000 }, \ Data partition }
from c/libbsp/lm32/milkymist/include/system_conf.h
[edit] Using UrJTAG
This method uses just Free Software and the jtag-serial pod that came with your M1, This is the preferred procedure: works with the Milkymist JTAG pod, faster, and no heavy proprietary software.
[edit] pre-compile images
- Try re-using files from http://milkymist.org/updates/ for flashing your board
- Develop Snapshots http://fidelio.qi-hardware.com/~xiangfu/build-milkymist/
[edit] compile urjtag
you may need install those libs in debian
$ sudo apt-get install libftdi-dev libusb-1.0-0-dev bison flex python-dev dh-autoreconf $ git clone git://urjtag.git.sourceforge.net/gitroot/urjtag/urjtag $ cd urjtag/urjtag $ ./autogen.sh --with-libusb --with-libftdi --without-ftd2xx --disable-svf --disable-bsdl
...... jtag is now configured for Detected libusb : 1.0 Detected libftdi : yes (no async mode) Detected libftd2xx : no Detected inpout32 : no Build SVF player : no Build BSDL subsystem : no Bus drivers : arm9tdmi au1500 avr32 bcm1250 blackfin bscoach ejtag ejtag_dma fjmem ixp425 ixp435 ixp465 jopcyc h7202 lh7a400 mpc5200 mpc824x mpc837x ppc405ep ppc440gx_ebc8 prototype pxa2x0 pxa27x s3c4510 sa1110 sh7727 sh7750r sh7751r sharc_21065L sharc_21369_ezkit slsup3 tx4925 zefant_xs3 Cable drivers : arcom byteblaster dlc5 ea253 ei012 ft2232 gpio ice100 igloo jlink keithkoep lattice mpcbdm triton usbblaster vsllink wiggler xpc Lowlevel drivers : direct ftdi ppdev
$ make && sudo make install
if you hit the error below during install:
make[1]: Entering directory '/home/user/urjtag/urjtag/po' /bin/sh @MKINSTALLDIRS@ /usr/local/share /bin/sh: Can't open @MKINSTALLDIRS@ make[1]: *** [install-data-yes] Error 127
then run
$ echo install: > po/Makefile
then run command 'make sudo install' again
$ ldconfig #make jtag find the liburjtag.so.0 $ sudo ldconfig #you may also needs this for update root ldconfig
- lockflash/unlockflash commands
apply those two patches for get lockflash/unlockflash commands, usage just like "eraseflash", those patches is base on r1979
[edit] download fjmem
Get the FJMEM core for Milkymist and synthesize it (you'll need ISE Webpack) Alternatively, a pre-synthesized bitstream is available fjmem.bit.bz2
[edit] flash system
- save these commands to a batchfile, see here for more.
cable milkymist detect instruction CFG_OUT 000100 BYPASS instruction CFG_IN 000101 BYPASS pld load fjmem.bit # LED D2 flashs initbus fjmem opcode=000010 # Tells UrJTAG that a FJMEM core is present and how to address it. frequency 6000000 detectflash 0 endian big flashmem 0 standby.fpg noverify # during flash, D3 flashs flashmem 0x6E0000 soc.fpg noverify flashmem 0x860000 bios.bin noverify flashmem 0x220000 bios-rescue.bin noverify flashmem 0x880000 splash.raw noverify flashmem 0x920000 flickernoise.fbi noverify
- run UrJTAG
$ jtag batchfile
- Power cycle the board. It should boot!
[edit] flash data partition
$ wget http://fidelio.qi-hardware.com/~xiangfu/build-milkymist/milkymist-firmware-07062011-0000/data.flash5.bin
- this step will DELETE all files under /flash, backup first. then save those command to a patch file named flash.data
$ more flash.data cable milkymist detect instruction CFG_OUT 000100 BYPASS instruction CFG_IN 000101 BYPASS pld load fjmem.bit initbus fjmem opcode=000010 frequency 6000000 detectflash 0 endian big eraseflash 0xD20000 151 flashmem 0xD20000 data.flash5.bin noverify
- run UrJTAG
$ jtag flash.data
[edit] info
- You can use "pld load" for loading customs bit-streams directly.
- Consider flashing bios-rescue.bin in case you need update/fix your MAC Address (set at crt0.S)
- If you get permission problems, this udev rule might be useful:
SUBSYSTEM=="usb", ATTRS{idVendor}=="20b7", ATTRS{idProduct}=="0713", MODE="0666"
[edit] Using the Xilinx tools
Do you really want to do it this way?
This method uses both non-Free and Bloated Software plus an expensive Xilinx cable
- You need a JTAG cable supported by the Xilinx tools. The Milkymist JTAG pod is not compatible.
- Run impact -batch and enter the commands below. Flashing takes several minutes.
- Power cycle the board. It should boot!
[edit] Impact batch commands
setMode -bscan setCable -p auto identify -inferir identifyMPM attachflash -position 1 -bpi "28F256J3F" assignfiletoattachedflash -position 1 -file "bitstream.mcs" program -p 1 -dataWidth 16 -rs1 NONE -rs0 NONE -bpionly -e (repeat the two lines above for every other .mcs file you need) quit