Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

am I a complete noob?!

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?

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your reply!

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

    thanks again!