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++
Announcements
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
12583 Discussions

How to solve NIOS and C++ problem with alt_remap_uncached

Altera_Forum
Honored Contributor II
1,469 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
508 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>

0 Kudos
Altera_Forum
Honored Contributor II
508 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.
0 Kudos
Altera_Forum
Honored Contributor II
508 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.
0 Kudos
Reply