Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Contributor
dtheodor
Posts: 41
Registered: ‎06-03-2008
0

Initialize DDR SDRAM with data

Hello everyone,

 

I would like to ask if it's possible to initialize an SDRAM with some data as soon as my FPGA is configured. I.e. I want some data to be already stored in the SDRAM before the main function of the PPC starts. 

 

Any suggestions would be great.

 

Kind regards,

dtheodor

Visitor
rehnmaak
Posts: 16
Registered: ‎04-25-2009
0

Re: Initialize DDR SDRAM with data

How much is "some data"?

 

You could always use initialized static (or global) variables....

 

 

Expert Contributor
bassman59
Posts: 4,673
Registered: ‎02-25-2008

Re: Initialize DDR SDRAM with data


dtheodor wrote:

Hello everyone,

 

I would like to ask if it's possible to initialize an SDRAM with some data as soon as my FPGA is configured. I.e. I want some data to be already stored in the SDRAM before the main function of the PPC starts. 

 



It depends. I assume that the PPC can talk to the SDRAM.

 

If your PPC expects to execute out of SDRAM, you need to use a bootloader to copy a firmware image from some non-volatile storage (Flash or whatever) into the SDRAM. Once that copy is complete, the PPC jumps to the start of that image in SDRAM. So if you were to store your "some data" in your flash, you could augment the bootloader so that it copies that data to the SDRAM before it jumps to the main application program. This is essentially what you want -- you want that data available before the main application starts.

 

If your PPC application fits into BRAM and otherwise does not execute out of SDRAM, then you will need to include the code that initializes the SDRAM as part of your application. That's the easiest way to do what you want.

 

A totally insane way to do this is to have a PicoBlaze or some other logic that holds the PPC in reset, initializes the SDRAM (from flash or whatever), then releases the PPC's reset. But this is really crazy.

 

-a


----------------------------------------------------------------
Yes, I do this for a living.
Contributor
dtheodor
Posts: 41
Registered: ‎06-03-2008
0

Re: Initialize DDR SDRAM with data

Hello rehnmaak and bassman59,

 

First of all I would like to thank very much for you replies.

 

This is exactly as you said what I want: My data to be available before my main program starts. :-)

 

THe PPC can talk with the SDRAM. My "some data" are approximatelly 60 MBytes. Of course, as bassman59 said, the easiest way is to write in the beginning of my program a small piece of code that puts all data to SDRAM. But since all my data values are unique, then for 60 MBytes, this would create a very big program, which I don't know if it could fit into the program memory.

 

So the best soulution I think is to use a Compact Flash memory. Although I never did that before, I read that I have to use Xilinx's System ACE to initialize a CF with a firmware image that contains my data. I'll try to find a couple of tutorials on how to do that and I'll post back as soon as I'm done so other people can also be helped.

 

Thank you very much again.

 

Kind regards,

dtheoodr

Contributor
dtheodor
Posts: 41
Registered: ‎06-03-2008

Re: Initialize DDR SDRAM with data

[ Edited ]

Hello everyone,

 

Eventually, the easiest solution to download your data to the DDR before the program starts is to to use the XMD. There are also other topics on in but I also will post the command line here:

 

1. Under EDK, start the EDK shell and type xmd.

2. Once you are connected with the FPGA board use the usual commands to find the dierctory where your file with data resides. I have to notice that (at least in my case), in order to create a proper file that xmd wil download in DDR as is, I used in C language the fopen function to create my file in binary mode (e.g. FILE *fp=fopen("myfile.dat","wb"); ). To write data in the file I used the fwrite function. Also be careful with the endianess of the processors when you use a x86 processor to write the data and then read them with the PowerPC!

3. In XMD type dow -data myfile.dat 0x<DDR starting address> to download the file in the DDR starting address.

4. If you want, verify that all data are written in DDR, by typing in XMD mrd 0x<DDR address> to check the data.

5. Download your design normally through EDK. If everything is ok, then your design will use the data that are already written in DDR.

 

Of course this solution applies only during design process. If you want to build a standalone solution without requiring the XMD, then you should use a bootloader to copy your file from a Compact Flash memory or something by using the Xilinx System ACE. I hope that this helps.

 

I would like also to thank everyone again for their replies.

 

Kind regards,

dtheodor

 

Message Edited by dtheodor on 07-11-2009 05:59 AM
Contributor
www.moi.com
Posts: 41
Registered: ‎07-05-2011
0

Re: Initialize DDR SDRAM with data

Hi dtheodor, 

 

i found this topic useful for my issue (sending an image from pc to my Virtex 5).

but i need to ask you some thing if you don't mind: the extension of ".data" could be replaced by any other extension (for example my image's format) ??

 

thx in advance