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 soso1
Visitor
2,750 Views
Registered: ‎04-02-2010

Why my program runs well on BRAM but not on the DDR?

Hello everyone, I'm a newbie using FPGA

 

so if I'm asking something too simple, please forgive me :)

 

I'm using EDK to  run my C program with PowerPC440

 

The program reads files(small video files) from  CF card, after some processing, and then write back to CF card(new file)

 

I have found that the program runs well on BRAM(use Linker script to set everything on the BRAM including HEAP and STACK)

 

But it failed if I use linker script to put everything on the DDR2 SDRAM

 

I found out that program stops at "sysace_fread"instruction,

 

XMD shows "Info:Processor Stop Condition UnKnown"

 

belowing is part of the code

 

 

//////////////////////////////////////////////////////////////////////////////////////////

 

 

SYSACE_FILE * L;

SYSACE_FILE * R; 

unsigned char *LY, *RY;

 

LY  = (unsigned char *)malloc(sizeof(unsigned char)*video_width * video_height);

RY = (unsigned char *)malloc(sizeof(unsigned char)*video_width * video_height);

 

L       = sysace_fopen("L.y", "r");

R      = sysace_fopen("R.y", "r");

 

sysace_fread(LY, sizeof(unsigned char), (video_width * video_height) , L);

sysace_fread(RY, sizeof(unsigned char), (video_width * video_height) , R);

 

//////////////////////////////////////////////////////////////////////////////////////////

 

the files L.y and R.y are on the CF card

 

I have increased the space of HEAP and  STACK,  but it still didn't work

 

can everyone give me some suggestions on this problem?

 

Thanks you guys for helping me on this!

Message Edited by soso1 on 04-02-2010 02:49 AM
Message Edited by soso1 on 04-02-2010 02:56 AM
0 Kudos
2 Replies
Participant n5ac
Participant
2,735 Views
Registered: ‎10-29-2008

Re: Why my program runs well on BRAM but not on the DDR?

I'm not using mallocs in my code, but it is possible that there is no memory to grab.  I know there are some settings on where the memory allocation pool resides, but I'm sorry I don't know right where they are.  If this is the problem, though, you may be able to figure it out by using the debugger and stepping into the malloc routine and watching where in memory it is trying to grab memory and then look at your linker script and see what you have there.

 

Not a great answer, but maybe it will get you down the debugging path...

 

Steve 

0 Kudos
Explorer
Explorer
2,714 Views
Registered: ‎01-25-2008

Re: Why my program runs well on BRAM but not on the DDR?

Hi,

 

Just check the stack and heap setting values in your linker script.

 

If you are running from DDR, make these values fairly large.  I have 128Mb of External DDR and my linker script settings look like:

 

 

_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x40000; _HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x40000;

 

Regards

Lachlan.

 

 

Lachlan Grogan
CEO, SIL3 Pty Ltd
Melbourne, Australia
http://sil3.com.au
0 Kudos