Forum Discussion
Altera_Forum
Honored Contributor
21 years agoI think the best thing you can do now is open the system library that the Nios II IDE should have generated for you. If you look in there, you'll see the alt_sys_init code, and the system.h file that defines all the stuff you need to know about your SOPC design.
If you look at the properties of your system library, you'll find a page which shows which UART that stdin/out/err are connected to. If that's the UART you want to talk to, then you can just use the standard POSIX routines printf, scanf, putc, getc, etc. to talk to the UART. If that's not the UART you want to talk to, you can get its name from system.h. There should be a line like:#define MY_UART_NAME "/dev/my_uart"and you would then use MY_UART_NAME as a filename to pass to open(), close(), read(), write(), etc. If you're dead set on reinventing the wheel, and absolutely must write your own interrupt handlers/drivers/everything else, you want to name your main function as "alt_main" and not "main". This skips all the interrupt setup, alt_sys_init, etc. and it becomes your problem to write.