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: 
Visitor vinuta
Visitor
4,496 Views
Registered: ‎09-26-2011

How to auto-run applications from Platform-flash-XL on ML605 board

Jump to solution

Is there a tutorial on how to auto-run applications from Platform-flash-XL on ML605 board?

 

On-boot up I would like to have my application(simple hello-world program) that I have programmed in the SDK running. 

From all the documentation I have read so far, I came across all articles that describe how to make an MCS file from a BIT file and load that into the flash.

 

When and where does the the elf file get downloaded to flash and auto-run?  Or am I just missing something obvious here.

 

-V

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
5,516 Views
Registered: ‎04-09-2008

Re: How to auto-run applications from Platform-flash-XL on ML605 board

Jump to solution

Does your program use external memory?  If so, you need to store both your download.bit and .elf in Flash and use a bootloader to load your program from Flash into the external memory.  There's an example bootloader program that comes with EDK.

 

In general, your download.bit will start at the bottom of Flash (address 0), and your .elf will be stored somewhere above that.  If possible, put the two far enough apart they don't share Flash pages so you don't need to rewrite both when you want to change one.

 

So you compile a very small bootloader app in SDK that can run completely from your ilmb BlockRAM.  Modify the bootloader source to reflect the offset where your program is stored in Flash (0x900000 for instance).  You use the SDK to run data2mem and initialize the BlockRAM with the bootloader. When this bootloader runs, it's going to read your .elf file, stored in an .srec format, from Flash and initialize all of the memory in your system, which is  exactly what XMD does over JTAG when you hit the "Run" button in SDK.

 

Use Impact to program that .bit to the Flash.  It sounds like you've already figured that part out.

 

Finally, you need to load your .elf into that upper area of Flash which the bootloader will read from.  I find it's easiest to do this using the "Program Flash" dialog in SDK.  You can select your .elf and check a box to automatically convert it to an .srec file format.

 

There is one caveat with this approach - since you are executing your bootloader program from the ilmb, you cannot use ilmb memory for your application.  If the bootloader attempts to load your program into the ilmb, it will essentially overwrite itself and stop running.  I modify my main program's linker script to execute everything from external memory - it makes it easier.

 

EDIT: One other piece of advice...  It looks like you are using the xps_emc in asynchronous mode to connect to the PlatformFlash.  If that's true, you will need to add a few statements to the beginning of the bootloader to switch the Platformflash from synchronous mode (which it boots up in) to asynchronous mode.  I'm pretty sure you can do this with 2 lines of code copy/pasted from the XilFlash library.  I seem to remember including the whole xilflash library broke my BRAM budget - but try it both ways.

4 Replies
Visitor vinuta
Visitor
4,484 Views
Registered: ‎09-26-2011

Re: How to auto-run applications from Platform-flash-XL on ML605 board

Jump to solution

Below is how my MHS settings for xps_mch_emc looks:

---------------------------------------------------------------------------------------------------------------------

PORT fpga_0_FLASH_Mem_A_pin = fpga_0_FLASH_Mem_A_pin_vslice_8_30_concat, DIR = O, VEC = [8:30]
PORT fpga_0_FLASH_Mem_OEN_pin = fpga_0_FLASH_Mem_OEN_pin, DIR = O
PORT fpga_0_FLASH_Mem_WEN_pin = fpga_0_FLASH_Mem_WEN_pin, DIR = O
PORT fpga_0_FLASH_Mem_DQ_pin = fpga_0_FLASH_Mem_DQ_pin, DIR = IO, VEC = [0:15]

PORT fpga_0_FLASH_CE_inverter_Res_pin = 0, DIR = O
PORT fpga_0_FLASH_Mem_FPGA_FCS_pin = net_bsbassign0, DIR = O
PORT fpga_0_FLASH_Mem_LEN_pin = fpga_0_FLASH_Mem_ADV_LDN, DIR = O

 

BEGIN xps_mch_emc
PARAMETER INSTANCE = FLASH
PARAMETER C_NUM_BANKS_MEM = 1
PARAMETER C_NUM_CHANNELS = 0
PARAMETER C_MEM0_WIDTH = 16
PARAMETER C_MAX_MEM_WIDTH = 16
PARAMETER C_INCLUDE_DATAWIDTH_MATCHING_0 = 1
PARAMETER C_SYNCH_MEM_0 = 0
PARAMETER C_TCEDV_PS_MEM_0 = 110000
PARAMETER C_TAVDV_PS_MEM_0 = 110000
PARAMETER C_THZCE_PS_MEM_0 = 35000
PARAMETER C_TWC_PS_MEM_0 = 11000
PARAMETER C_TWP_PS_MEM_0 = 70000
PARAMETER C_TLZWE_PS_MEM_0 = 35000
PARAMETER HW_VER = 3.01.a
PARAMETER C_MEM0_BASEADDR = 0x86000000
PARAMETER C_MEM0_HIGHADDR = 0x860FFFFF
BUS_INTERFACE SPLB = mb_plb
PORT RdClk = clk_50_0000MHz
PORT Mem_A = 0b00000000 & fpga_0_FLASH_Mem_A_pin_vslice_8_30_concat & 0b0
PORT Mem_CEN = net_bsbassign0
PORT Mem_OEN = fpga_0_FLASH_Mem_OEN_pin
PORT Mem_WEN = fpga_0_FLASH_Mem_WEN_pin
PORT Mem_ADV_LDN = fpga_0_FLASH_Mem_ADV_LDN
PORT Mem_DQ = fpga_0_FLASH_Mem_DQ_pin
END

---------------------------------------------------------------------------------------------------------------------

Below is a snippet from my UCF file:

Net fpga_0_FLASH_Mem_A_pin<30> LOC=AL8 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<29> LOC=AK8 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<28> LOC=AC9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<27> LOC=AD10 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<26> LOC=C8 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<25> LOC=B8 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<24> LOC=E9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<23> LOC=E8 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<22> LOC=A8 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<21> LOC=A9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<20> LOC=D9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<19> LOC=C9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<18> LOC=D10 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<17> LOC=C10 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<16> LOC=F10 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<15> LOC=F9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<14> LOC=AH8 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<13> LOC=AG8 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<12> LOC=AP9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<11> LOC=AN9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<10> LOC=AF10 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<9> LOC=AF9 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_A_pin<8> LOC=AL9 | IOSTANDARD=LVCMOS25;

Net fpga_0_FLASH_Mem_OEN_pin LOC=AA24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_WEN_pin LOC=AF23 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<0> LOC=M23 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<1> LOC=L24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<2> LOC=F24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<3> LOC=F23 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<4> LOC=N23 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<5> LOC=N24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<6> LOC=H23 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<7> LOC=G23 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<8> LOC=R24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<9> LOC=P24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<10> LOC=H25 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<11> LOC=H24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<12> LOC=V24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<13> LOC=W24 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<14> LOC=AF25 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_DQ_pin<15> LOC=AF24 | IOSTANDARD=LVCMOS25;

 

Net fpga_0_FLASH_CE_inverter_Res_pin LOC=AJ12 | IOSTANDARD=LVCMOS25;
Net fpga_0_FLASH_Mem_LEN_pin LOC=AC23 | IOSTANDARD=LVCMOS25;

Net fpga_0_FLASH_Mem_FPGA_FCS_pin LOC=Y24 | IOSTANDARD=LVCMOS25;

---------------------------------------------------------------------------------------------------------------------

 

I generated the bitstream using XPS(13.2). I exported my design to SDK(*.bit and *.bmm files).

 

Using SDK 13.2 I wrote a simple hello_world program. 

  • Generated a linker script for Hello World with all the sections assigned to ilmb_cntlr_dlmb_cntlr. I have also attached my linker file.
  • I used the "Program FPGA" function in SDK, which will configured the FPGA directly over JTAG and also produced the FPGA bitstream, download.bit. This is the hardware platform with the BRAM initialized.
  • Using the download.bit file inside the iMPACT tool I generated the Platform Flash XL file (.mcs file).
  • Using the this .mcs file, I programmed the Flash.

----------------------------------------------------------------------------------------------------------------

 

On the ML605 board, Switch S1 (1 to 4) are all 0, Switch S2.1 = 1, S2.2=0, S2.3=0, S2.4=1, S2.5=1 and S2.6=0.

 

-----------------------------------------------------------------------------------------------------------------

 

After Programming the FPGA, I pressed the FPGA_PROG_B Pushbutton SW4. 

 

I am new to the Xilinx tools and also in embedded development. Any help will be very useful.

 

 

 

 

0 Kudos
Highlighted
Explorer
Explorer
5,517 Views
Registered: ‎04-09-2008

Re: How to auto-run applications from Platform-flash-XL on ML605 board

Jump to solution

Does your program use external memory?  If so, you need to store both your download.bit and .elf in Flash and use a bootloader to load your program from Flash into the external memory.  There's an example bootloader program that comes with EDK.

 

In general, your download.bit will start at the bottom of Flash (address 0), and your .elf will be stored somewhere above that.  If possible, put the two far enough apart they don't share Flash pages so you don't need to rewrite both when you want to change one.

 

So you compile a very small bootloader app in SDK that can run completely from your ilmb BlockRAM.  Modify the bootloader source to reflect the offset where your program is stored in Flash (0x900000 for instance).  You use the SDK to run data2mem and initialize the BlockRAM with the bootloader. When this bootloader runs, it's going to read your .elf file, stored in an .srec format, from Flash and initialize all of the memory in your system, which is  exactly what XMD does over JTAG when you hit the "Run" button in SDK.

 

Use Impact to program that .bit to the Flash.  It sounds like you've already figured that part out.

 

Finally, you need to load your .elf into that upper area of Flash which the bootloader will read from.  I find it's easiest to do this using the "Program Flash" dialog in SDK.  You can select your .elf and check a box to automatically convert it to an .srec file format.

 

There is one caveat with this approach - since you are executing your bootloader program from the ilmb, you cannot use ilmb memory for your application.  If the bootloader attempts to load your program into the ilmb, it will essentially overwrite itself and stop running.  I modify my main program's linker script to execute everything from external memory - it makes it easier.

 

EDIT: One other piece of advice...  It looks like you are using the xps_emc in asynchronous mode to connect to the PlatformFlash.  If that's true, you will need to add a few statements to the beginning of the bootloader to switch the Platformflash from synchronous mode (which it boots up in) to asynchronous mode.  I'm pretty sure you can do this with 2 lines of code copy/pasted from the XilFlash library.  I seem to remember including the whole xilflash library broke my BRAM budget - but try it both ways.

Explorer
Explorer
3,840 Views
Registered: ‎02-17-2013

Re: How to auto-run applications from Platform-flash-XL on ML605 board

Jump to solution

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
Visitor pranay@9
Visitor
194 Views
Registered: ‎09-17-2018

Re: How to auto-run applications from Platform-flash-XL on ML605 board

Jump to solution

Hi pcurt,

Thanks for helping, people who looks out for help.

I know, its a very old thread but facing the same issue as a lot people have faced already. I got the download.bit converted to .mcs and programmed 32 bit on board flash of ML605. In the bootloader i turned on few LED to see if the bootloader program is working from BRAM.

As you described to program the .elf(.srec), i too did the same, but the application did not start from the Flash memory. Initially i was facing some trouble, i.e. when i download the elf from Program Flash utility on SDK, i used to lose the Bootloader which is running from BRAM.

From your post, i check the application linker script and modified with only DDR. Now after downloading the .elf, i still see my LED glowing, which i turned on from the bootloader. But still i am not successful running the MB application from the 32MB flash memory.

In your last paragraph you mentioned to use some line of code from XilFlash library. Can you please give some hint or example on this. It would be of great help.

I am using 14.7 version of SDK/XPS. My DDR3 base address is 0xC0000000 , stack size -0xA000, heap size-0xA000.

My FLASH base Address is 0x42000000 and i used 0x42600000 ( 0x4200000 + 0x00600000).

While programming the Flash from the SDK's Program Flash, i have given the offset as 0X00600000.

The mcs file, which i created from download.bit file consumes till  0x00500000 location of the flash ( 32 MB flash address 0x0000_0000 to 0x00FF_FFFF

Please guide, what else i need to do to run my application from the same flash.

 

0 Kudos