- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are two memory section in my Nios system, one external chip SDRAM and another onchip memory:a 16K byte ram which is generated by the SOPC tool. Our project need to put one function code in the ram section, all other codes are put in SDRAM. So I use the code like this:
int DataChange(int data) __attribute__ ((section (".onchip_mem"))); int DataChange(int data) { return (data+10);//This is just an example and it doesn't mean that my function is as simple as this } When I refer to the objdump file, it actually stays in the onchip_mem(the base address is 0x08004000). However, when I run the program it doesn't work at all. I try to debug the program, when DataChange is needed, program seems to fly away. What's wrong with this?How should I resolve this problem? I am a greenhand and looking forward to your reply, thank you very much!Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
How are your code sections being initialised? It may be that your on-chip memory has not been loaded. In my system I use flash to store the code images, which are then loaded into RAM by the bootloader at startup. My main code is loaded into an external RAM and I have an ISR which is loaded into on-chip RAM (specified using the __attribute__ keyword as you have described). I'm not 100% sure, but your setup may require you to re-compile your Quartus project (or update RAM contents at least) so that your on-chip RAM is initialised by the FPGA configuration. You should find that the IDE has created a file called onchip_mem.hex in your hardware folder which is used to set the initial contents of your on-chip RAM. I hope this helps. Cheers
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