UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
24,633 Views
Registered: ‎05-30-2008

How can I merge an elf and bit file into an mcs file using Impact?

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.

 

0 Kudos
12 Replies
Xilinx Employee
Xilinx Employee
24,626 Views
Registered: ‎08-13-2007

Re: How can I merge an elf and bit file into an mcs file using Impact?

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)

 

 

bt

 

== edit

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)

Message Edited by timpe on 08-11-2009 03:55 PM
Adventurer
Adventurer
24,090 Views
Registered: ‎12-29-2007

Re: How can I merge an elf and bit file into an mcs file using Impact?

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:

    http://www.jopwiki.com/User:DanClemmensen/Current

 To append the info from a .srec file that starts at: 0x1000000, the actual commands are:

offset=$(echo "ibase 16;45480-(10000000)"|bc)
srec_cat main-fpga.mcs -Intel kernel.srec -OF $offset -o main.mcs -Intel
 

 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:

       http://www.opencores.org/project,plasma

 Andthe maintainer of that project kindly added my Linux makefile to the project.

Message Edited by dclemmensen on 10-23-2009 07:00 AM
Message Edited by dclemmensen on 10-23-2009 07:06 AM
Message Edited by dclemmensen on 10-23-2009 07:10 AM
Explorer
Explorer
23,973 Views
Registered: ‎05-30-2008

Re: How can I merge an elf and bit file into an mcs file using Impact?

Thank you for posting your success and the details. This is a great benefit to the Xilinx community.
0 Kudos
Xilinx Employee
Xilinx Employee
23,953 Views
Registered: ‎08-13-2007

Re: How can I merge an elf and bit file into an mcs file using Impact?

Thanks for posting this here, Dan. It is good to see this type of information posted.

 

bt

0 Kudos
22,424 Views
Registered: ‎04-28-2010

Re: How can I merge an elf and bit file into an mcs file using Impact?

That srec_cat is a great utility .... saved me a lot of work programming in C.

0 Kudos
Explorer
Explorer
15,799 Views
Registered: ‎02-17-2013

Re: How can I merge an elf and bit file into an mcs file using Impact?

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.

Memory contents:

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. 

Best Regards. 

0 Kudos
Explorer
Explorer
15,794 Views
Registered: ‎02-17-2013

Re: How can I merge an elf and bit file into an mcs file using Impact?

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. 

Best Regards. 

0 Kudos
Xilinx Employee
Xilinx Employee
15,787 Views
Registered: ‎08-13-2007

Re: How can I merge an elf and bit file into an mcs file using Impact?

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)

 

Cheers,

 bt

0 Kudos
Explorer
Explorer
15,773 Views
Registered: ‎02-17-2013

Re: How can I merge an elf and bit file into an mcs file using Impact?

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.

0 Kudos
4,207 Views
Registered: ‎05-22-2012

Re: How can I merge an elf and bit file into an mcs file using Impact?

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:-)

 

0 Kudos
Explorer
Explorer
4,202 Views
Registered: ‎05-30-2008

Re: How can I merge an elf and bit file into an mcs file using Impact?

Thanks for sharing

0 Kudos
Explorer
Explorer
4,166 Views
Registered: ‎07-23-2009

Re: How can I merge an elf and bit file into an mcs file using Impact?

0 Kudos