08-11-2009 11:49 AM
I have been trying to add an elf file to my mcs file. I can add a bitstream and load it in my PROM, when i turn on my board the FPGA gets loaded, but I must load my elf file using XMD - this defeats the purpose of using a PROM in the first place. Xilinx says you can add an elf file by checking the "add data files" box in Impact. I do this, but when I add my elf file - Impact crashes when trying to generate the mcs file. If I rename the elf file to .mem then Impact does not crash but fails to generate the file.
I have enough space in the PROM and I have even tried adding both PROMS that I have in case there was any space issue. I am using and ML507 board which features two xcf32p parts. I am using EDK and Impact 10.1.
Xilinx has once again provided almost no documentation on how to use their tools.
I have tried to find anyone having a similar issue and I can barely even find any posts of people even doing this successfully, let alone unsucessfully
Am I doing this properly, but Impact just has some issue? Or do I need to do this differently?
Has anyone done this successfullly that can share how they did it?
I have done this very simply using the CompactFlash card, but I do not have room for this in my design. Generating a SysACE file require a tcl script - is there some script to make an mcs file from a bit and elf file with teh proper settings for the PROM? I tried to pull the scripts from a design for the UltraControlle, but ti was too concoluded and specific to that design for me to get it working.
It seems that this would be a very common thing that people would want to do if using an embedded system.
08-11-2009 12:50 PM - edited 08-11-2009 12:55 PM
The general purpose method of adding data to a bitstream to initialize BlockRAMs with specific contents is data2mem:
http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/data2mem.pdf (Data2MEM User Guide)
EDK uses bitinit:
http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/est_rm.pdf (Embedded System Tools Reference Manual)
That would be used if your entire application could fit into available BRAM.
If not, a common approach is to use a bootloader in BRAM to copy the program code from non-volatile storage to SRAM (ZBT, DDR, DDR2, etc.)
These are some good resources:
http://www.xilinx.com/support/documentation/application_notes/xapp1106.pdf (Using and Creating Flash Files for the MicroBlaze Development Kit - Spartan-3A DSP 1800A Starter Platform)
http://www.xilinx.com/support/documentation/application_notes/xapp978.pdf (FPGA Configuration from Flash PROMs on the Spartan-3E 1600E Board)
http://www.xilinx.com/products/boards/s3a_sd1800a_ref_designs/xapp1053.pdf (Flash Memory Bootloading Using SPI with Spartan-3A DSP 1800A Starter Platform)
http://www.xilinx.com/support/documentation/application_notes/xapp963.pdf (Using and Creating Flash Files for the MicroBlaze Development Kit - Spartan-3E Edition)
http://www.xilinx.com/support/documentation/application_notes/xapp482.pdf (MicroBlaze Platform Flash/PROM Boot Loader and User Data Storage)
http://www.xilinx.com/support/documentation/application_notes/xapp983.pdf (Executing and Debugging Software From Flash Memory)
http://www.xilinx.com/support/documentation/application_notes/xapp642.pdf (Relocating Code and Data for Embedded Systems)
http://forums.xilinx.com/xlnx/board/message?board.id=EDK&message.id=262#M262 (How to implement a bootloader in edk/sdk)
I should have also mentioned it is possible to run directly from Flash but this is less common because of performance:
http://forums.xilinx.com/xlnx/board/message?board.id=EDK&message.id=7720 (Executing uBlaze code from flash)
10-23-2009 06:52 AM - edited 10-23-2009 07:10 AM
I have successfully appended an image to an .mcs file by using the opensource srec_cat tool from the srecord package. Impact was able to load the extended .mcs file to the program flash, and I then loaded the image into RAM from the progam flash using a bootloader imbedded in a BRAM in the FPGA image.
My hardware is the Spartan3E starter kit. Its Program flash is a xcf04 (512KiB), but its FPGA , an xcs500e, needs only about 270KiB, leaving about 240KiB free. I documented this here:
To append the info from a .srec file that starts at: 0x1000000, the actual commands are:
If the data you wish to append is not in srec format, then you can read the srecord documentation to determine what to do: srecord reads most common binary formats plus a bunch of formats I had never heard of.
I used this successfully as part of my experiment with the plasma project:
Andthe maintainer of that project kindly added my Linux makefile to the project.
11-02-2009 10:16 AM
11-03-2009 11:36 AM
Thanks for posting this here, Dan. It is good to see this type of information posted.
04-28-2010 12:58 PM
That srec_cat is a great utility .... saved me a lot of work programming in C.
05-21-2013 05:16 AM
When I execute this command I have a leak of memory.
/home/mayotte/Xilinx/14.4/ISE_DS/ISE/bin/lin64/data2mem -bm system.bmm -bt system.bit -bd boot_esssai.elf output.bit
I place an examle of error that I can see in the console this is the latest. Do you have an idea why I have a leak of memory.
INTERNAL_ERROR:Data2MEM:45 - Memory allocation leak of 8 bytes at 0x019B15F8 for 'CharPtrArrayType' data.
Total memory in use at allocation was 7605 bytes.
Source file "StringUtils.c", line number 901.
019B15F8: 00 00 00 00 00 00 00 00
I have spartan 6 and I want programme the flash with a file who contains the .elf and the .bit. I think that with the impact 14.4 I load the file output.bit in the cable SPI. Unfortunately the file output.bit did'nt generate.
05-21-2013 05:27 AM
Hey Xilinx barriet
Do you have latest document I use the tools 14.4 of Xilinx the presentation is different it'snt like in this old documents of Xilinx.
05-21-2013 08:03 AM
The 14.4 data2mem user guide is here:
http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_4/data2mem.pdf (Data2MEM User Guide)
Also perhaps useful:
http://www.xilinx.com/support/answers/46945.htm (Data2Mem Usage and Debugging Guide)
05-21-2013 11:33 PM
I want know if in my c programm I must add function point that is set to point to the address of PROG_START_ADDR like in the documentation xapp482.zip of Xilinx. If in my project I create a project hello world and a file system.bit it will work ? Or I need add lines code in order to specify the start adress of the application.
08-26-2014 03:52 AM
For future references... i think the easiest way to generate a mcs programming file for spi flash is using this method
Using Vivado 14.2 + SDK:
SDK: Select Xilinx tools-> Program FPGA. The download.bit is generated in wrapper_hw_platform subdirectory.
It's also possible to use cmd line:
data2mem -bm \ design_1_wrapper_hw_platform_0/design_1_wrapper_bd.bmm -bt design_1_wrapper_hw_platform_0/design_1_wrapper.bit -bd Debug/detect.elf tag design_1_i_uB_microblaze_0 -o b design_1_wrapper_hw_platform_0/download.bit
Then go to Vivado and use TCL write_cfgmem function:
write_cfgmem -force -format MCS -size 16 -interface SPIx1 -loadbit "up 0x0 design_1_wrapper_hw_platform_0/download.bit" -verbose download.mcs
The download.mcs file is perfect for SPI Flash:-)
09-09-2014 05:23 AM