Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

function with "attribute"

Altera_Forum
Honored Contributor II
1,026 Views

Hi all, 

Quartus 4.2 Nios 1.2 

I want to place the fuction "prova()" in the memory named "onchip_memory": 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

void prova  __attribute__ ((section ( ".onchip_memory"))) (void) { 

while(1){} 

} [/b] 

--- Quote End ---  

 

I get the compilation error: 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

../hello_world.c:99: error: parse error before &#39;(&#39; token[/b] 

--- Quote End ---  

 

the line 99 is the line quoted. 

Any suggestions?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
341 Views

Hi Soin, 

 

Put the &#39;attribute&#39; in the declaration rather than the definition: 

 

extern void prova (void)  __attribute__ ((section ( ".onchip_memory"))); void prova (void) { while(1){} } 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
341 Views

Yes it works! 

Thank u very much! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
Reply