Forum Discussion
Altera_Forum
Honored Contributor
12 years agoNewbie memory question
Hi, I got a Terasic DE0-nano board with a Cyclone IV FPGA. My design is writing data in the memory. I use a NIOS II softcore too and I'd like it to read the FPGA memory and the data I wrote in a h...
Altera_Forum
Honored Contributor
12 years agoSo for now:
I use Eclipse because the tutorials I found tell me to do that and I don't know how to do it otherwise but I don't think it's relevant. I don't really understand what is wrong: I have a hardware part that is writing the memory. I know it's correct as I'm writing "01010101" and the LEDs of my DE0-NANO board are ok when reading the memory. But when using this code:#include <stdio.h>
# define ONCHIP_MEM_BASE 0x10000
int main()
{
int *pmem=(int*)(0x80000000|ONCHIP_MEM_BASE);
printf("Hello from Nios II!\n");
usleep(1000000);
printf("%04x\n",*pmem);
return 0;
}
the console is printing: --- Quote Start --- Hello from Nios II! 820014 --- Quote End --- Please tell me what is wrong in my code. Another question: the system.h file is not read, I have to write the# define line so it's correct. How could I include that automatically?