Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12435 Discussions

How to solve NIOS and C++ problem with alt_remap_uncached

Altera_Forum
Honored Contributor II
1,153 Views

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 II
192 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 II
192 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 II
192 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