Altera_Forum
Honored Contributor
16 years agoquestion about __attribute__
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!