04-02-2010 02:48 AM - edited 04-02-2010 02:56 AM
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!
04-02-2010 09:00 AM
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...
04-02-2010 05:34 PM
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;