- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 scopeLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page