Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,069 Views

How to solve NIOS and C++ problem with alt_remap_uncached

I'm using NIOSII eds for an app in my SOC. I'd like to use C++, but I'm having problems even getting it started. 

 

What am I missing here? 

 

extern "C" {# include <stdio.h># include "system.h"# include "adxl.h" 

 

 

int main() 

{ unsigned char *padxl = (unsigned char*)alt_remap_uncached((void*)(ADXL_BASE),sizeof(unsigned char)); 

printf("Hello from Nios II!!!!\r\n"); 

return 0; 

 

gives me the following error: 

'alt_remap_uncached' was not declared in this scope
0 Kudos
3 Replies
Altera_Forum
Honored Contributor I
108 Views

Have a look at this document (http://www.altera.com/literature/hb/nios2/n2sw_nii52010.pdf) page 14-47. You need to include <sys/alt_cache.h>

Altera_Forum
Honored Contributor I
108 Views

Many thanks. That fixed it. 

 

alt_remap_uncached must have been getting included somewhere else without the alt_cache.h in the .c version because it worked fine without it. It only presented a problem when I changed it to .cpp. But when I add the sys/alt_cache that made it all work. 

 

Many thanks again.
Altera_Forum
Honored Contributor I
108 Views

In C it isn't necessary to have a function prototype in scope in order to call it, C++ does need one. 

It is a good idea to enable a lot more of the C 'warnings' and to make them fatal by adding -Wall -Werror to the command line. Some of the warnings are a bit pedantic and can be turned off individually.
Reply