Altera_Forum
Honored Contributor
16 years agoHow to read and write value in two different systems?
Dear everyone,
I am now working on a multicore system. cpu_0 runs uclinux, cpu_1 runs a piece of program, the base address of led_red( pio ) in the SOPCBuilder is 0x00400000, the base address of led_red in nios2_system.h in uclinux is 0x80400000. I have succeed in writing a value onto the led_red through program in uclinux, however, when I tried to read the written value through a program( cpu_1 ) without a system, it always appears the same value "-1". Here's the small program in cpu_0(uclinux).# define LEDR_BASE 0x80400000 int main(){ int *led_red = (int *) LEDR_BASE; *(led_red) = 128; return 0; } after running it in the uclinux, the 8th led_red lights on. Here's the small program in cpu_1.# include <stdio.h># define LEDR_BASE 0x00400000 int main() { printf("Hello from Nios II!\n"); int *red_red = (int *)LEDR_BASE; printf("%d",*red_red); return 0; } after running it the console always shows the value of -1 I don't know why,could somebody help me? Thanks. Yours sincerely, babysnow