- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello people!
I have followed the tutorial "Introduction to Qsys" from the ALTERA University program where a very small VHDL system is created plus an instantiation of the Nios II and some switches as inputs and some LEDs as outputs assigned at the pins. I wrote and compiled the program that justs propagates the switch values to the LEDs using the ALTERA Monitor program and it works fine. When I try to do the same using the Nios EDS in Eclipse it compiles perfectly but when the program gets downloaded into the device the LEDS not only do they not follow the switch values but they do not light up at all. In order to do the example in Eclipse EDS I just created an application and BSP from the template small Hello world and added the AVALON-MM addresses of the swithes and the LEDs plus the propagation command.# include "sys/alt_stdio.h"
# define switches (volatile char *) 0x2010# define leds (char *) 0x2000
int main()
{
alt_putstr("Hello from Nios II!\n");
/* Event loop never exits. */
while (1) *leds = *switches;
return 0;
}
What is the problem? Why isn't it working in Eclipse EDS? Regards
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PROBLEM SOLVED
Hello For those who have the same problem with me, the issue was that I haven't included the header files
system.h
altera_avalon_pio_regs.h
which describe the compiled Qsys system and let me access defined structures like my parallel ports as well as the function IOWR_ALTERA_AVALON_PIO_DATA that writes at the parallel ports. So the simple program described in the Introduction to the Qsys system tutorial:
# define switches (volatile char *) 0x0002000
# define leds (char *) 0x0002010
void main()
{ while (1)
*leds = *switches;
}
Should be in the Nios II EDS:
# include "system.h"
# include "altera_avalon_pio_regs.h"
int main()
{
/* Event loop never exits. */
while (1) {
IOWR_ALTERA_AVALON_PIO_DATA(LEDS_BASE, *((char*)SWITCHES_BASE));
}
return 0;
}
cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much polychronakis, your code helped me a lot!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page