Forum Discussion
Altera_Forum
Honored Contributor
15 years agoNIOS + MMU uClinux + PIO
Hi I'd like to add same PIO to my nios and control it from linux. In menuconfig I added PIO led and buttons but I get errors while compilling. What should I add in nios.h? And then how controll...
Altera_Forum
Honored Contributor
15 years ago --- Quote Start --- Update: Now I can set things like LED. All you have to do is write a c program, i.e. "ledtest.c"
/* ledtest.c*/
# include <stdio.h>
# include <asm/io.h>
// if you like you can also include the header file with your base addresses of the board
# define LED0 0x06 //the hex address for my first LED
int main(void)
{
// ... my html code
outl(LED0, LED_BASE) /* the first parameter of 'outl' is the value you want to set. The second is the base_address of the hardware you want to control. Either insert it manually or take the address from your included header file*/
return 0;
}
But the most important part is the makefile. I took it from the generic-cgi folder and modified it to my needs. You have to add 'O2' to the flags otherwise the header file can't be found. --- Quote End --- This will only work without MMU. And -O2 means optimize, it has nothing to do with what files are included.