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++

Run and Debug Problem

Altera_Forum
Honored Contributor II
1,226 Views

Hi Everyone! 

 

I have a problems. Please help me: 

 

I have a SOPC (Nios CPU + SRAM +JTAG UART + SW[7:0] +LEDG[7:0]+Timer) on DE2 board. The C code: 

 

// This code display the value of SW on LEDG# include <stdio.h># include <stdlib.h># define SW (volatile char *) 0x00011000 # define LEDG (char *) 0x00011010 

void main() 

{ while (1) 

*LEDG = *SW; 

 

When I run this code, nothing happen (LEDG do not display the value of SW). But when debug this code (step by step), It work correctly.  

Please tell me why? 

 

 

 

Thanks.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
218 Views

You probably need to bypass the data cache

0 Kudos
Altera_Forum
Honored Contributor II
218 Views

I would recommend to use the PIO IOWR macros instead of pointers.

0 Kudos
Reply