- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I have used sdram controller provided by SOPC builder(custom). the sdram part I am using is IS42S16400D. It is 8MB sdram. In the system library properties I have given .text, .rodata, .rwdata, heap and stack as sdram. I am not able to read or write into first few locations of sdram, as this part of memory is used to store the code.This I can understand. But I am also not able to write into last few locations(2K) of SDRAM. When I continuously write into these locations using a for loop, the data which I get after reading is wrong. When I do a write to single location and read back, then I am getting proper data. The same C code works for all other locations but not for last 2K locations. I am not able to understand this behaviour. I have tried this on simulation and on board. In both the cases continous write to last 2K locations is failing and if I perform write and read individually then it is passing. Please help me in debugging this issue. Is this a timing issue? if so why is it failing only for last 2K locations? Thank you...Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by shilpa v.prabhu@Mar 23 2007, 04:50 AM hi all,
i have used sdram controller provided by sopc builder(custom). the sdram part i am using is is42s16400d. it is 8mb sdram. in the system library properties i have given .text, .rodata, .rwdata, heap and stack as sdram. i am not able to read or write into first few locations of sdram, as this part of memory is used to store the code.this i can understand.
but i am also not able to write into last few locations(2k) of sdram. when i continuously write into these locations using a for loop, the data which i get after reading is wrong. when i do a write to single location and read back, then i am getting proper data. the same c code works for all other locations but not for last 2k locations. i am not able to understand this behaviour. i have tried this on simulation and on board. in both the cases continous write to last 2k locations is failing and if i perform write and read individually then it is passing.
please help me in debugging this issue. is this a timing issue? if so why is it failing only for last 2k locations?
thank you...
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=22452)
--- quote end ---
--- Quote End --- Hi, I'm using a similar SDRAM (IS42S16100C1), which has 16MBit. Somehow I kept in mind that .text, .rodata and .rwdata is stored at the beginning of the memory and heap and stack at the end of memory. Sorry, but I really can't remember where I read that and please, somebody correct me if I'm wrong. What I do is, I store .text, .rodata and .rwdata in the SDRAM and heap and stack in onchip_memory. I'm not totally done with testing that, but until now, this seems to work. Maybe try to declare 2K (or 4K) as onchip memory and use it for heap and stack.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi again,
found what I meant, I guess: http://www.altera.com/literature/lit-nio2.jsp (http://www.altera.com/literature/lit-nio2.jsp) -> Nios II Software Developer's Handbook In chapter 4 'Developing Programs using the HAL' under 'Memory Usage' -> 'Placement of Heap and Stack': 'By default, the heap and stack are placed in the same memory partition as the .rwdata section. the stack grows downwards (toward loweraddresses) from the end of the section. The heap grows upwards from the last used memory within the .rwdata section. You can control the placement of the heap and stack as a system library property in the Nios II IDE.' (right now page 3-38) So if I got it right, heap and stack are not placed at the end of memory, just stack grows downwards from end of .rwdata section (check also Figure 4-3 'Sample HAL Link Map' on page 4-34). Then maybe I've been wrong, sorry. Still I didn't get it in total.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by ellis@Mar 26 2007, 03:59 AM hi again,
found what i meant, i guess:
http://www.altera.com/literature/lit-nio2.jsp (http://www.altera.com/literature/lit-nio2.jsp)
-> nios ii software developer's handbook
in chapter 4 'developing programs using the hal' under 'memory usage' -> 'placement of heap and stack':
'by default, the heap and stack are placed in the same memory partition
as the .rwdata section. The stack grows downwards (toward lower addresses) from the end of the section[/b]. The heap grows upwards from the last used memory within the .rwdata section. You can control the placement of the heap and stack as a system library property in the Nios II IDE.' (right now page 3-38) So if I got it right, heap and stack are not placed at the end of memory, just stack grows downwards from end of .rwdata section (check also Figure 4-3 'Sample HAL Link Map' on page 4-34). Then maybe I've been wrong, sorry. Still I didn't get it in total. <div align='right'><{post_snapback}> (index.php?act=findpost&pid=22505) --- Quote End --- [/b] --- Quote End --- Thanks Elli for the reply. We dont have enough resource in FPGA to place an on-chip memory. Just for the sake of testing I instantaited one more sdram. used first sdram to place .rodata, rwdata stack and heap., so that one sdram is totally free. I was able to test the full sdram in simualtions. I contacted altera my support regarding this issue. They have also replied telling that stack and heap are placed at the end of the memory. Then I asked them where can I find the memory allocation done for rodata, rwdata, stack and heap? They suggested me to generate .objdump file which will give the placement details. We can generate this file from NIOS II window. goto nios II IDE -> window -> preferences -> NIOS II -> generate objdump file. I generated this file. I could see the address allocation done for .rwdata, .rodata, .text etc.. But did not find exact allocation done for stack and heap. I am waiting for the reply from mysupport. Also during mass production of the boards we want to check the complete SDRAM i.e each and every location of SDRAM. We dont have any other memory in our project except Flash and SDRAM. So if we place rodata, rwdata, stack and heap in the SDRAM then we wont be able to test the complete SDRAM.So give me some suggestions on this. Thanks Shilpa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by shilpa v.prabhu@Mar 29 2007, 07:21 AM thanks elli for the reply.
we dont have enough resource in fpga to place an on-chip memory. just for the sake of testing i instantaited one more sdram. used first sdram to place .rodata, rwdata stack and heap., so that one sdram is totally free. i was able to test the full sdram in simualtions. i contacted altera my support regarding this issue. they have also replied telling that stack and heap are placed at the end of the memory. then i asked them where can i find the memory allocation done for rodata, rwdata, stack and heap? they suggested me to generate .objdump file which will give the placement details. we can generate this file from nios ii window. goto nios ii ide -> window -> preferences -> nios ii -> generate objdump file.
i generated this file. i could see the address allocation done for .rwdata, .rodata, .text etc.. but did not find exact allocation done for stack and heap. i am waiting for the reply from mysupport. also during mass production of the boards we want to check the complete sdram i.e each and every location of sdram. we dont have any other memory in our project except flash and sdram. so if we place rodata, rwdata, stack and heap in the sdram then we wont be able to test the complete sdram.so give me some suggestions on this.
thanks
shilpa
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=22608)
--- quote end ---
--- Quote End --- Hi Shilpa, thanks for the explanation of that .objdump file. Until now I didn't need it, but I wanted to check, where this sections are located befor I finish the project. Therefor this will be very useful. If I understood it right, the answer of where your .rwdata address allocation is, answers the question where your heap and stack is allocated, because they are inside the .rwdata section. As I wrote already, the stack grows downwards (toward lower addresses) from the end of the .rwdata address allocation. The heap grows upwards from the last used memory within the .rwdata section. So maybe for you it is interesting how big your heap and stack is. I remember, that I read a post about that here in the forum and they suggested to check the sp (Stack Pointer) and fp (Frame Pointer) registers. There was even a small program, that saved the lowest address inside the sp register which is related to the maximum size of stack and things like that. Anyway, I think you are right, you can't test a memory in which the test program is located. Why don't you put your program (.rwdata, .rodata, .text etc.) inside the flash? You could use the "Flash Programmer" for doing that. Then you can test the whole sdram, right? If it's a speed problem, maybe you should really use two sdrams, one could be your program memory and the other one your device under test. Correct me if I'm wrong, but as far as I know, sdram is faster then flash. On the other hand, sdram is volatile, it needs to be reloaded after every power up, flash is non-volatile. Hope that helped a bit, Elli
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by ellis+mar 30 2007, 02:18 am--><div class='quotetop'>quote (ellis @ mar 30 2007, 02:18 am)</div>
--- quote start ---
<!--quotebegin-shilpa v.prabhu@Mar 29 2007, 07:21 AM thanks elli for the reply.
we dont have enough resource in fpga to place an on-chip memory. just for the sake of testing i instantaited one more sdram. used first sdram to place .rodata, rwdata stack and heap., so that one sdram is totally free. i was able to test the full sdram in simualtions. i contacted altera my support regarding this issue. they have also replied telling that stack and heap are placed at the end of the memory. then i asked them where can i find the memory allocation done for rodata, rwdata, stack and heap? they suggested me to generate .objdump file which will give the placement details. we can generate this file from nios ii window. goto nios ii ide -> window -> preferences -> nios ii -> generate objdump file.
i generated this file. i could see the address allocation done for .rwdata, .rodata, .text etc.. but did not find exact allocation done for stack and heap. i am waiting for the reply from mysupport. also during mass production of the boards we want to check the complete sdram i.e each and every location of sdram. we dont have any other memory in our project except flash and sdram. so if we place rodata, rwdata, stack and heap in the sdram then we wont be able to test the complete sdram.so give me some suggestions on this.
thanks
shilpa
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=22608)
--- quote end ---
--- Quote End --- Hi Shilpa, thanks for the explanation of that .objdump file. Until now I didn't need it, but I wanted to check, where this sections are located befor I finish the project. Therefor this will be very useful. If I understood it right, the answer of where your .rwdata address allocation is, answers the question where your heap and stack is allocated, because they are inside the .rwdata section. As I wrote already, the stack grows downwards (toward lower addresses) from the end of the .rwdata address allocation. The heap grows upwards from the last used memory within the .rwdata section. So maybe for you it is interesting how big your heap and stack is. I remember, that I read a post about that here in the forum and they suggested to check the sp (Stack Pointer) and fp (Frame Pointer) registers. There was even a small program, that saved the lowest address inside the sp register which is related to the maximum size of stack and things like that. Anyway, I think you are right, you can't test a memory in which the test program is located. Why don't you put your program (.rwdata, .rodata, .text etc.) inside the flash? You could use the "Flash Programmer" for doing that. Then you can test the whole sdram, right? If it's a speed problem, maybe you should really use two sdrams, one could be your program memory and the other one your device under test. Correct me if I'm wrong, but as far as I know, sdram is faster then flash. On the other hand, sdram is volatile, it needs to be reloaded after every power up, flash is non-volatile. Hope that helped a bit, Elli <div align='right'><{post_snapback}> (index.php?act=findpost&pid=22655)</div> [/b] --- Quote End --- Thank you ellis http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page