开发者

Design Flow to create a bootable SPI Flash (PROM File) for a Xilinx Spartan-6 containing Configuration bitsream AND Microblaze software

I would like to know the proper procedure to cr开发者_C百科eate a PROM file (.MCS) for a serial SPI Flash that include BOTH the FPGA configuration bitstream and the software to be used by the Microblaze processor. This is assuming my hardware and software design is all done.

I am using a Xilinx Spartan-6 evaluation board, the SP605, which has several non-volatile memory devices and I wish to use the serial SPI Flash to store BOTH the FPGA bitstream AND the Microblaze's software that needs to be loaded into memory. I am able to achieve this only if the Microblaze's code is to reside in the internal BRAMs. If I create my link script such that it places the code or data sections in the external DDR3 RAM, it fails.

-- EDIT --

OK, so I have tried a couple of different things and I have a better understanding of what I need to do, but still no success (which, btw, thanks for your reply Andy). So, I have tried 2 different things. For both of them I first merge the system bitstream with the bootloader program to generate a new .bit (download.bit) file that runs just fine (when you hit program in SDK and choose the bootloader to load the BRAM, it calls data2mem to generate the new download.bit file).

FIRST APPROACH - BIN FILE

Once my main program is done (with a linker script targeting the DDR RAM and all) I call mb-objcopy to generate a bin file from the .elf one:

mb-objcopy -O binary program -R .vectors_reset -R .vectors.sw_exception -R vectors.interrupt -R .vectors.hw_exception dummy.elf dummy.b

Then I use iMPACT to create and MCS file using download.bit and dummy.b. I place download.bit at the starting address of the SPI Flash and dummy.b further down (the bootloader already points to that address). Then I burn the MCS to the serial SPI FLash, restart and the bootloader runs and supposedly copies everything to DDR RAM, but, the main program doesn't work. Am I missing something here? If I try to use iMPACT without changing the main program from .elf to BIN, the PC hangs (sometimes I even have to completely reset the computer) and I have a very fast and memory-equipped PC.

The bootloader I used was the same one linked in the Xilinx XAPP1146 document.

SECOND APPROACH - SREC FILE

The steps are pretty much the same, except that I use the same mb-objcopy command to generate an SREC instead of a BIN file (this time I don't remove any of the sectors, which I needed to do for the BIN file otherwise it would generate an enormous file).

The bootloader I used is the one that the SDK software has.

Please anyone let me know if you have successfully created a bootloader for the Microblaze.

Thanks in advance, Erick


I have built bootloaders, but with two differences from yours:

  • They don't take the program from the same flash device as the bitstream comes from.
  • I use custom code to program the flash rather than using impact.

In case it gives you any ideas, here's what I do:

I have a separate SPI flash device from which I read an ELF file, which I then parse on the fly and transfer the relevant code/initialisation sections into the DRAM. There's no reason that your bootloader couldn't load from the same flash device as the config though.

It's not a completely flexible ELF parser as it assumes that the sections come in the same order as the section header table reports them, but that's how the Microblaze tools produce the files, so it works out OK.

(And don't forget to strip the debugging information from the file before programming it to flash!)


It's waaaay easier than all that.

  1. From the SDK, create a bootloader (srec_bootloader)
  2. Program the FPGA w/ the system bit file and the srec bootloader.
  3. Take the download.bit file from the hardware platform
  4. Run the following commands

impact -batch make_bpi_up.impact

xmcsutil -accept_notice -18 pi outfile.hex -o bootloader.bin

(The last command above creates a bootable image w/ your FPGA bit file and the bootloader)

Then program your application @ the offset specified by your bootloader using XSDK Next, program the bootloader @ 0x0 using XSDK - note, when you're selecting "Program Flash" from XSDK, you'll need to browse to the bootloader.bin and select * as opposed to .bin;.elf;*.srec in the file type filter in the browser window so you'll be able to select the bootloader.bin

Let me know if you need me to clarify any of the steps. In the process of adding this to my blog w/ screenshots over the next week.

The make_bpi_up.impact file consists of the following

setMode -pff                                  
setSubmode -pffparallel                        
setPreference -pref StartupClock:Auto_Correction
addPromDevice -p 1 -size 32768
addDesign -version 0 -startaddress 000000
addDeviceChain -index 0
addDevice -p 1 -file download.bit 
generate -format hex -fillvalue FF -output outfile
quit

MacGyverQue


right click on microblaze ,click on associate ELF file add your .elf file and configure mode .generate bitstream. and convert .bit to .mcs and download the file .. the both the .elf and .mcs file is stored into flash

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜