Altera Embedded Peripherals IP User Manual
Page 63
![background image](https://www.manualsdir.com/files/763637/content/doc063.png)
For Nios II processor users, the HAL system library API provides complete access to the JTAG UART
core's features. Nios II programs treat the JTAG UART core as a character mode device, and send and
receive data using the ANSI C standard library functions, such as
getchar()
and
printf()
.
The Printing Characters to a JTAG UART core as stdout example demonstrates the simplest possible
usage, printing a message to
stdout
using
printf()
. In this example, the Qsys system contains a JTAG
UART core, and the HAL system library is configured to use this JTAG UART device for
stdout
.
Table 7-1: Example: Printing Characters to a JTAG UART Core as stdout
#include
int main ()
{
printf("Hello world.\n");
return 0;
}
The Transmitting characters to a JTAG UART Core example demonstrates reading characters from and
sending messages to a JTAG UART core using the C standard library. In this example, the Qsys system
contains a JTAG UART core named
jtag_uart
that is not necessarily configured as the
stdout
device. In
this case, the program treats the device like any other node in the HAL file system.
7-6
HAL System Library Support
UG-01085
2014.24.07
Altera Corporation
JTAG UART Core