|
|
|
@ -1,13 +1,11 @@
|
|
|
|
|
Tutorial 03 - UART1, Auxilary mini UART
|
|
|
|
|
=======================================
|
|
|
|
|
# Tutorial 03 - UART1, Auxilary mini UART
|
|
|
|
|
|
|
|
|
|
It is time for the famous Hello World example. We're going to write on the UART1
|
|
|
|
|
first, as it's easier to program as it has a fixed clocked frequency.
|
|
|
|
|
|
|
|
|
|
NOTE: qemu does not redirect UART1 to terminal by default, only UART0!
|
|
|
|
|
|
|
|
|
|
gpio.rs
|
|
|
|
|
------
|
|
|
|
|
## gpio.rs
|
|
|
|
|
|
|
|
|
|
We have a new header file. This defines the base MMIO address, and the GPIO
|
|
|
|
|
controller's addresses. This file going to be very popular, as many device needs
|
|
|
|
@ -19,8 +17,7 @@ UART registers.
|
|
|
|
|
|
|
|
|
|
[volatile_register]: https://docs.rs/volatile-register/0.2.0/volatile_register/
|
|
|
|
|
|
|
|
|
|
uart.rs
|
|
|
|
|
--------------
|
|
|
|
|
## uart.rs
|
|
|
|
|
|
|
|
|
|
A very minimal implementation.
|
|
|
|
|
|
|
|
|
@ -34,8 +31,7 @@ will be converted into a newline character (10).
|
|
|
|
|
`MiniUart::puts(&self, string: &str)` prints out a string. On newline, a carrige
|
|
|
|
|
return character will also be sent (13 + 10).
|
|
|
|
|
|
|
|
|
|
Main
|
|
|
|
|
----
|
|
|
|
|
## main.rs
|
|
|
|
|
|
|
|
|
|
First we have to call the uart initialization code. Then we wait for the first
|
|
|
|
|
keypress from the user before we say "Hello Rustacean!". If you've purchased an
|
|
|
|
|