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

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



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 create 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





This might do better on electronics.se. You can flag it and ask a moderator to migrate it.
– Andy
Apr 13 '11 at 19:05





Can you update your question with detail on the way you're generating the MCS file and the errors you get? Are you using the -data_file option or its GUI equivalent? Overflow error sounds like the flash may not be big enough. Here are a few resources: AR 36210, AR 35345, Program user-data into internal flash...
– Andy
Apr 13 '11 at 20:21


-data_file




3 Answers
3



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



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.



impact -batch make_bpi_up.impact


impact -batch make_bpi_up.impact



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


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






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS