Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21592 Discussions

am I a complete noob?!

Altera_Forum
Honored Contributor II
1,319 Views

after a lot of time, I managed to load a simple c program into the nios2 

now the problem is that when I use the NIOS IDE to load it, it just hangs(the board), and when I use the monitor program, for something to happen I have to keep switching from pause to run mode.... 

 

here is the c code: 

# define Switches (volatile char *) 0x0011000 

# define LEDs (char *) 0x0011010 

int main() 

{  

while (1) 

*LEDs = *Switches; 

 

return 0; 

 

LE: ...I fixed it!...kinda 

i was using a NiosII/f processor. After switching to a NiosII/e, everything works fine. 

 

Why did that happen?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
572 Views

How are you bypassing the d$, assuming you have some? The keyword volatile will not bypass the d$. You either have to use the IORD/IOWR macros or bypass the d$ by ORing your address value with bit 31 set high. 

 

How do you know it's hanging? Have you tried debugging it in the IDE? 

 

UPDATE: The "e" core has no d$, so you weren't (and aren't) bypassing the $, which is what you have to do when accessing hw registers. 

 

 

Best of luck! 

 

- Ura
0 Kudos
Altera_Forum
Honored Contributor II
572 Views

Thanks for your reply! 

I think I got it now...I'll get back to you if I still have some problems. 

thanks again!
0 Kudos
Reply