- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,everyone!:p
i am using one altera board with a 16mbits SDRAM, I am practicing DMA transfer when this question came to me : there are some part of the memory is used(in fact a lot of it, my program is just 21kbytes), some are not, so can i figure out which part is not used ? can i know the address of the block ? or, to figure out which part is not used, which handbook should i read? thanks! liuxin,Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I guess you are doing a NIOS II design ...? And you mean your software program is 21KB? You can perform an object dump on your compiled program ".elf" file. This will give you the mapping of where things are located in memory. Aside from this, you can monitor your stack pointer to see how large your stack grows.
Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you considered using malloc to allocate space in the SDRAM for the DMA transfer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks!today i found the answer! nios provided some HAL API to manipulate the cache.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you Jack!
sorry for my bad english and bad description。 I have another problem when i am practicing DMA transfer。 I was trying to transfer 20 byte data from my sdram to one uart rs232 port. my baud rate is 115200, but i can just receive 5 of the 20 data. I don't konw what is the problem. maybe it's because the IRQ problem? i use quartus 8.1, nios ii IDE 8.1, EP2C20, i enable the stream control and i have one nios ii/s in my system. the SDRAM's is 16 bits. THANKS AGAIN FOR YOUR ANSWER! liuxin 2009,11,7- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- thanks!today i found the answer! nios provided some HAL API to manipulate the cache. --- Quote End --- Hi, I also met same problem. Could you please tell me how to solve this problem? Which functions are used for cache? Can you recommend some documents for reference? Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
some reference :
nios ii software developer's hand book ( chaper 6: Developing Programs Using the Hardware Abstraction Layer) chapter 9 : Cache and Tightly-Coupled Memory) some functions: Advanced Placement Options In your program source code, you can specify a target memory section for each piece of code. In C or C++, you can use the section attribute. This attribute must be placed in a function prototype; you cannot place it in the function declaration itself. The code in Example 6–16 places a variable foo in the memory named ext_ram, and the function bar() in the memory named sdram. In assembly you do this using the .section directive. For example, all code after the following line is placed in the memory device named ext_ram: .section .ext_ram.txt Example 6–16. Manually Assigning C Code to a Specific Memory Section /* data should be initialized when using the section attribute */ int foo __attribute__ ((section (".ext_ram.rwdata"))) = 0; void bar (void) __attribute__ ((section (".sdram.txt"))); void bar (void) { foo++; } you can use a function malloc By default, the HAL performs no stack or heap checking. This makes function calls and memory allocation faster, but it means that malloc() (in C) and new (in C++) are unable to detect heap exhaustion. You can enable run-time stack checking by manipulating BSP settings. With stack checking on, malloc() and new() can detect heap exhaustion if you use HAL,The HAL application program interface (API) provides the following functions for managing cache memory: ■ alt_dcache_flush() ■ alt_dcache_flush_all() ■ alt_icache_flush() ■ alt_icache_flush_all() ■ alt_uncached_malloc() ■ alt_uncached_free() ■ alt_remap_uncached() ■ alt_remap_cached() hope this will help you. because i just want to know which part is placed at which ,so i don't try this ! hope this will help u!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi liuxin,
May I know what method you used to determine which part of SDRAM is used or not used? It seems like you never mentioned it in your post. Please help. Thank you.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also met the same problem. I used twice the function "alt_dma_txchan_ioctl()" to makesure the data transferring in units of 8 bits and set a DMA receiver into streaming mode.
array:volatile char chr[20] = "abcdefghihklmnopqrsq" ;//数据源 And I can just receive five datas: aeimq When the data type of the array is alt_u32,and the transfer length is 80, I can receive all the letters from the UART. Who can tell me why?
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