Adapt tutorial numbers

pull/110/head
Andre Richter 3 years ago
parent 2432c0d283
commit f81eb7428d
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -1,4 +1,4 @@
# Tutorial 05 - Safe Globals # Tutorial 04 - Safe Globals
## tl;dr ## tl;dr
@ -54,9 +54,9 @@ $ make qemu
## Diff to previous ## Diff to previous
```diff ```diff
diff -uNr 04_zero_overhead_abstraction/src/bsp/raspberrypi/console.rs 05_safe_globals/src/bsp/raspberrypi/console.rs diff -uNr 03_hacky_hello_world/src/bsp/raspberrypi/console.rs 04_safe_globals/src/bsp/raspberrypi/console.rs
--- 04_zero_overhead_abstraction/src/bsp/raspberrypi/console.rs --- 03_hacky_hello_world/src/bsp/raspberrypi/console.rs
+++ 05_safe_globals/src/bsp/raspberrypi/console.rs +++ 04_safe_globals/src/bsp/raspberrypi/console.rs
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
//! BSP console facilities. //! BSP console facilities.
@ -176,9 +176,9 @@ diff -uNr 04_zero_overhead_abstraction/src/bsp/raspberrypi/console.rs 05_safe_gl
+ } + }
} }
diff -uNr 04_zero_overhead_abstraction/src/console.rs 05_safe_globals/src/console.rs diff -uNr 03_hacky_hello_world/src/console.rs 04_safe_globals/src/console.rs
--- 04_zero_overhead_abstraction/src/console.rs --- 03_hacky_hello_world/src/console.rs
+++ 05_safe_globals/src/console.rs +++ 04_safe_globals/src/console.rs
@@ -10,10 +10,22 @@ @@ -10,10 +10,22 @@
/// Console interfaces. /// Console interfaces.
@ -208,12 +208,12 @@ diff -uNr 04_zero_overhead_abstraction/src/console.rs 05_safe_globals/src/consol
+ pub trait All = Write + Statistics; + pub trait All = Write + Statistics;
} }
diff -uNr 04_zero_overhead_abstraction/src/main.rs 05_safe_globals/src/main.rs diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs
--- 04_zero_overhead_abstraction/src/main.rs --- 03_hacky_hello_world/src/main.rs
+++ 05_safe_globals/src/main.rs +++ 04_safe_globals/src/main.rs
@@ -109,6 +109,7 @@ @@ -109,6 +109,7 @@
#![feature(format_args_nl)] #![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
+#![feature(trait_alias)] +#![feature(trait_alias)]
#![no_main] #![no_main]
@ -227,27 +227,28 @@ diff -uNr 04_zero_overhead_abstraction/src/main.rs 05_safe_globals/src/main.rs
/// Early init code. /// Early init code.
/// ///
@@ -126,8 +128,15 @@ @@ -126,7 +128,15 @@
/// ///
/// - Only a single core must be active and running this function. /// - Only a single core must be active and running this function.
unsafe fn kernel_init() -> ! { unsafe fn kernel_init() -> ! {
- println!("[0] Hello from Rust!");
+ use console::interface::Statistics; + use console::interface::Statistics;
+
println!("[0] Hello from pure Rust!");
- println!("[1] Stopping here."); - panic!("Stopping here.")
+ println!("[0] Hello from pure Rust!");
+
+ println!( + println!(
+ "[1] Chars written: {}", + "[1] Chars written: {}",
+ bsp::console::console().chars_written() + bsp::console::console().chars_written()
+ ); + );
+ +
+ println!("[2] Stopping here."); + println!("[2] Stopping here.");
cpu::wait_forever() + cpu::wait_forever()
} }
diff -uNr 04_zero_overhead_abstraction/src/synchronization.rs 05_safe_globals/src/synchronization.rs diff -uNr 03_hacky_hello_world/src/synchronization.rs 04_safe_globals/src/synchronization.rs
--- 04_zero_overhead_abstraction/src/synchronization.rs --- 03_hacky_hello_world/src/synchronization.rs
+++ 05_safe_globals/src/synchronization.rs +++ 04_safe_globals/src/synchronization.rs
@@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//

@ -1,4 +1,4 @@
# Tutorial 06 - Drivers: GPIO and UART # Tutorial 05 - Drivers: GPIO and UART
## tl;dr ## tl;dr
@ -108,9 +108,9 @@ Miniterm 1.0
## Diff to previous ## Diff to previous
```diff ```diff
diff -uNr 05_safe_globals/Cargo.toml 06_drivers_gpio_uart/Cargo.toml diff -uNr 04_safe_globals/Cargo.toml 05_drivers_gpio_uart/Cargo.toml
--- 05_safe_globals/Cargo.toml --- 04_safe_globals/Cargo.toml
+++ 06_drivers_gpio_uart/Cargo.toml +++ 05_drivers_gpio_uart/Cargo.toml
@@ -9,8 +9,8 @@ @@ -9,8 +9,8 @@
[features] [features]
@ -133,9 +133,9 @@ diff -uNr 05_safe_globals/Cargo.toml 06_drivers_gpio_uart/Cargo.toml
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "5.x.x" } cortex-a = { version = "5.x.x" }
diff -uNr 05_safe_globals/Makefile 06_drivers_gpio_uart/Makefile diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile
--- 05_safe_globals/Makefile --- 04_safe_globals/Makefile
+++ 06_drivers_gpio_uart/Makefile +++ 05_drivers_gpio_uart/Makefile
@@ -7,6 +7,12 @@ @@ -7,6 +7,12 @@
# Default to the RPi3 # Default to the RPi3
BSP ?= rpi3 BSP ?= rpi3
@ -186,9 +186,9 @@ diff -uNr 05_safe_globals/Makefile 06_drivers_gpio_uart/Makefile
@RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD)
diff -uNr 05_safe_globals/src/_arch/aarch64/cpu.rs 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs diff -uNr 04_safe_globals/src/_arch/aarch64/cpu.rs 05_drivers_gpio_uart/src/_arch/aarch64/cpu.rs
--- 05_safe_globals/src/_arch/aarch64/cpu.rs --- 04_safe_globals/src/_arch/aarch64/cpu.rs
+++ 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs +++ 05_drivers_gpio_uart/src/_arch/aarch64/cpu.rs
@@ -17,6 +17,17 @@ @@ -17,6 +17,17 @@
// Public Code // Public Code
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -208,9 +208,9 @@ diff -uNr 05_safe_globals/src/_arch/aarch64/cpu.rs 06_drivers_gpio_uart/src/_arc
#[inline(always)] #[inline(always)]
pub fn wait_forever() -> ! { pub fn wait_forever() -> ! {
diff -uNr 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs diff -uNr 04_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 05_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
--- 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs --- 04_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
+++ 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs +++ 05_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
@@ -0,0 +1,221 @@ @@ -0,0 +1,221 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -434,9 +434,9 @@ diff -uNr 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 06_drivers_g
+ } + }
+} +}
diff -uNr 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs diff -uNr 04_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 05_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
--- 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs --- 04_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
+++ 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ 05_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
@@ -0,0 +1,403 @@ @@ -0,0 +1,403 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -842,9 +842,9 @@ diff -uNr 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 06_dri
+ } + }
+} +}
diff -uNr 05_safe_globals/src/bsp/device_driver/bcm.rs 06_drivers_gpio_uart/src/bsp/device_driver/bcm.rs diff -uNr 04_safe_globals/src/bsp/device_driver/bcm.rs 05_drivers_gpio_uart/src/bsp/device_driver/bcm.rs
--- 05_safe_globals/src/bsp/device_driver/bcm.rs --- 04_safe_globals/src/bsp/device_driver/bcm.rs
+++ 06_drivers_gpio_uart/src/bsp/device_driver/bcm.rs +++ 05_drivers_gpio_uart/src/bsp/device_driver/bcm.rs
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -858,9 +858,9 @@ diff -uNr 05_safe_globals/src/bsp/device_driver/bcm.rs 06_drivers_gpio_uart/src/
+pub use bcm2xxx_gpio::*; +pub use bcm2xxx_gpio::*;
+pub use bcm2xxx_pl011_uart::*; +pub use bcm2xxx_pl011_uart::*;
diff -uNr 05_safe_globals/src/bsp/device_driver/common.rs 06_drivers_gpio_uart/src/bsp/device_driver/common.rs diff -uNr 04_safe_globals/src/bsp/device_driver/common.rs 05_drivers_gpio_uart/src/bsp/device_driver/common.rs
--- 05_safe_globals/src/bsp/device_driver/common.rs --- 04_safe_globals/src/bsp/device_driver/common.rs
+++ 06_drivers_gpio_uart/src/bsp/device_driver/common.rs +++ 05_drivers_gpio_uart/src/bsp/device_driver/common.rs
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -901,9 +901,9 @@ diff -uNr 05_safe_globals/src/bsp/device_driver/common.rs 06_drivers_gpio_uart/s
+ } + }
+} +}
diff -uNr 05_safe_globals/src/bsp/device_driver.rs 06_drivers_gpio_uart/src/bsp/device_driver.rs diff -uNr 04_safe_globals/src/bsp/device_driver.rs 05_drivers_gpio_uart/src/bsp/device_driver.rs
--- 05_safe_globals/src/bsp/device_driver.rs --- 04_safe_globals/src/bsp/device_driver.rs
+++ 06_drivers_gpio_uart/src/bsp/device_driver.rs +++ 05_drivers_gpio_uart/src/bsp/device_driver.rs
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -918,9 +918,9 @@ diff -uNr 05_safe_globals/src/bsp/device_driver.rs 06_drivers_gpio_uart/src/bsp/
+#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))] +#[cfg(any(feature = "bsp_rpi3", feature = "bsp_rpi4"))]
+pub use bcm::*; +pub use bcm::*;
diff -uNr 05_safe_globals/src/bsp/raspberrypi/console.rs 06_drivers_gpio_uart/src/bsp/raspberrypi/console.rs diff -uNr 04_safe_globals/src/bsp/raspberrypi/console.rs 05_drivers_gpio_uart/src/bsp/raspberrypi/console.rs
--- 05_safe_globals/src/bsp/raspberrypi/console.rs --- 04_safe_globals/src/bsp/raspberrypi/console.rs
+++ 06_drivers_gpio_uart/src/bsp/raspberrypi/console.rs +++ 05_drivers_gpio_uart/src/bsp/raspberrypi/console.rs
@@ -4,113 +4,34 @@ @@ -4,113 +4,34 @@
//! BSP console facilities. //! BSP console facilities.
@ -1054,9 +1054,9 @@ diff -uNr 05_safe_globals/src/bsp/raspberrypi/console.rs 06_drivers_gpio_uart/sr
+ &super::PL011_UART + &super::PL011_UART
} }
diff -uNr 05_safe_globals/src/bsp/raspberrypi/driver.rs 06_drivers_gpio_uart/src/bsp/raspberrypi/driver.rs diff -uNr 04_safe_globals/src/bsp/raspberrypi/driver.rs 05_drivers_gpio_uart/src/bsp/raspberrypi/driver.rs
--- 05_safe_globals/src/bsp/raspberrypi/driver.rs --- 04_safe_globals/src/bsp/raspberrypi/driver.rs
+++ 06_drivers_gpio_uart/src/bsp/raspberrypi/driver.rs +++ 05_drivers_gpio_uart/src/bsp/raspberrypi/driver.rs
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -1108,9 +1108,9 @@ diff -uNr 05_safe_globals/src/bsp/raspberrypi/driver.rs 06_drivers_gpio_uart/src
+ } + }
+} +}
diff -uNr 05_safe_globals/src/bsp/raspberrypi/memory.rs 06_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs diff -uNr 04_safe_globals/src/bsp/raspberrypi/memory.rs 05_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs
--- 05_safe_globals/src/bsp/raspberrypi/memory.rs --- 04_safe_globals/src/bsp/raspberrypi/memory.rs
+++ 06_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs +++ 05_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs
@@ -17,6 +17,38 @@ @@ -17,6 +17,38 @@
} }
@ -1151,9 +1151,9 @@ diff -uNr 05_safe_globals/src/bsp/raspberrypi/memory.rs 06_drivers_gpio_uart/src
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
diff -uNr 05_safe_globals/src/bsp/raspberrypi.rs 06_drivers_gpio_uart/src/bsp/raspberrypi.rs diff -uNr 04_safe_globals/src/bsp/raspberrypi.rs 05_drivers_gpio_uart/src/bsp/raspberrypi.rs
--- 05_safe_globals/src/bsp/raspberrypi.rs --- 04_safe_globals/src/bsp/raspberrypi.rs
+++ 06_drivers_gpio_uart/src/bsp/raspberrypi.rs +++ 05_drivers_gpio_uart/src/bsp/raspberrypi.rs
@@ -6,4 +6,33 @@ @@ -6,4 +6,33 @@
pub mod console; pub mod console;
@ -1189,9 +1189,9 @@ diff -uNr 05_safe_globals/src/bsp/raspberrypi.rs 06_drivers_gpio_uart/src/bsp/ra
+ } + }
+} +}
diff -uNr 05_safe_globals/src/bsp.rs 06_drivers_gpio_uart/src/bsp.rs diff -uNr 04_safe_globals/src/bsp.rs 05_drivers_gpio_uart/src/bsp.rs
--- 05_safe_globals/src/bsp.rs --- 04_safe_globals/src/bsp.rs
+++ 06_drivers_gpio_uart/src/bsp.rs +++ 05_drivers_gpio_uart/src/bsp.rs
@@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
//! Conditional reexporting of Board Support Packages. //! Conditional reexporting of Board Support Packages.
@ -1202,9 +1202,9 @@ diff -uNr 05_safe_globals/src/bsp.rs 06_drivers_gpio_uart/src/bsp.rs
mod raspberrypi; mod raspberrypi;
diff -uNr 05_safe_globals/src/console.rs 06_drivers_gpio_uart/src/console.rs diff -uNr 04_safe_globals/src/console.rs 05_drivers_gpio_uart/src/console.rs
--- 05_safe_globals/src/console.rs --- 04_safe_globals/src/console.rs
+++ 06_drivers_gpio_uart/src/console.rs +++ 05_drivers_gpio_uart/src/console.rs
@@ -14,8 +14,25 @@ @@ -14,8 +14,25 @@
/// Console write functions. /// Console write functions.
@ -1247,9 +1247,9 @@ diff -uNr 05_safe_globals/src/console.rs 06_drivers_gpio_uart/src/console.rs
+ pub trait All = Write + Read + Statistics; + pub trait All = Write + Read + Statistics;
} }
diff -uNr 05_safe_globals/src/cpu.rs 06_drivers_gpio_uart/src/cpu.rs diff -uNr 04_safe_globals/src/cpu.rs 05_drivers_gpio_uart/src/cpu.rs
--- 05_safe_globals/src/cpu.rs --- 04_safe_globals/src/cpu.rs
+++ 06_drivers_gpio_uart/src/cpu.rs +++ 05_drivers_gpio_uart/src/cpu.rs
@@ -13,4 +13,7 @@ @@ -13,4 +13,7 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
// Architectural Public Reexports // Architectural Public Reexports
@ -1260,9 +1260,9 @@ diff -uNr 05_safe_globals/src/cpu.rs 06_drivers_gpio_uart/src/cpu.rs
+#[cfg(feature = "bsp_rpi3")] +#[cfg(feature = "bsp_rpi3")]
+pub use arch_cpu::spin_for_cycles; +pub use arch_cpu::spin_for_cycles;
diff -uNr 05_safe_globals/src/driver.rs 06_drivers_gpio_uart/src/driver.rs diff -uNr 04_safe_globals/src/driver.rs 05_drivers_gpio_uart/src/driver.rs
--- 05_safe_globals/src/driver.rs --- 04_safe_globals/src/driver.rs
+++ 06_drivers_gpio_uart/src/driver.rs +++ 05_drivers_gpio_uart/src/driver.rs
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -1309,9 +1309,9 @@ diff -uNr 05_safe_globals/src/driver.rs 06_drivers_gpio_uart/src/driver.rs
+ } + }
+} +}
diff -uNr 05_safe_globals/src/main.rs 06_drivers_gpio_uart/src/main.rs diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs
--- 05_safe_globals/src/main.rs --- 04_safe_globals/src/main.rs
+++ 06_drivers_gpio_uart/src/main.rs +++ 05_drivers_gpio_uart/src/main.rs
@@ -106,6 +106,8 @@ @@ -106,6 +106,8 @@
//! //!
//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html
@ -1385,9 +1385,9 @@ diff -uNr 05_safe_globals/src/main.rs 06_drivers_gpio_uart/src/main.rs
+ } + }
} }
diff -uNr 05_safe_globals/src/panic_wait.rs 06_drivers_gpio_uart/src/panic_wait.rs diff -uNr 04_safe_globals/src/panic_wait.rs 05_drivers_gpio_uart/src/panic_wait.rs
--- 05_safe_globals/src/panic_wait.rs --- 04_safe_globals/src/panic_wait.rs
+++ 06_drivers_gpio_uart/src/panic_wait.rs +++ 05_drivers_gpio_uart/src/panic_wait.rs
@@ -4,15 +4,35 @@ @@ -4,15 +4,35 @@
//! A panic handler that infinitely waits. //! A panic handler that infinitely waits.

@ -1,4 +1,4 @@
# Tutorial 07 - UART Chainloader # Tutorial 06 - UART Chainloader
## tl;dr ## tl;dr
@ -118,12 +118,12 @@ IN:
## Diff to previous ## Diff to previous
```diff ```diff
Binary files 06_drivers_gpio_uart/demo_payload_rpi3.img and 07_uart_chainloader/demo_payload_rpi3.img differ Binary files 05_drivers_gpio_uart/demo_payload_rpi3.img and 06_uart_chainloader/demo_payload_rpi3.img differ
Binary files 06_drivers_gpio_uart/demo_payload_rpi4.img and 07_uart_chainloader/demo_payload_rpi4.img differ Binary files 05_drivers_gpio_uart/demo_payload_rpi4.img and 06_uart_chainloader/demo_payload_rpi4.img differ
diff -uNr 06_drivers_gpio_uart/Makefile 07_uart_chainloader/Makefile diff -uNr 05_drivers_gpio_uart/Makefile 06_uart_chainloader/Makefile
--- 06_drivers_gpio_uart/Makefile --- 05_drivers_gpio_uart/Makefile
+++ 07_uart_chainloader/Makefile +++ 06_uart_chainloader/Makefile
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
READELF_BINARY = aarch64-none-elf-readelf READELF_BINARY = aarch64-none-elf-readelf
LINKER_FILE = src/bsp/raspberrypi/link.ld LINKER_FILE = src/bsp/raspberrypi/link.ld
@ -176,9 +176,9 @@ diff -uNr 06_drivers_gpio_uart/Makefile 07_uart_chainloader/Makefile
clippy: clippy:
@RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD)
diff -uNr 06_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.s 07_uart_chainloader/src/_arch/aarch64/cpu/boot.s diff -uNr 05_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.s 06_uart_chainloader/src/_arch/aarch64/cpu/boot.s
--- 06_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.s --- 05_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.s
+++ 07_uart_chainloader/src/_arch/aarch64/cpu/boot.s +++ 06_uart_chainloader/src/_arch/aarch64/cpu/boot.s
@@ -22,20 +22,31 @@ @@ -22,20 +22,31 @@
and x1, x1, _core_id_mask and x1, x1, _core_id_mask
ldr x2, BOOT_CORE_ID // provided by bsp/__board_name__/cpu.rs ldr x2, BOOT_CORE_ID // provided by bsp/__board_name__/cpu.rs
@ -218,9 +218,9 @@ diff -uNr 06_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.s 07_uart_chainloader/
.size _start, . - _start .size _start, . - _start
.type _start, function .type _start, function
diff -uNr 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs diff -uNr 05_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 06_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
--- 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs --- 05_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
+++ 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs +++ 06_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
@@ -144,7 +144,7 @@ @@ -144,7 +144,7 @@
// Make an educated guess for a good delay value (Sequence described in the BCM2837 // Make an educated guess for a good delay value (Sequence described in the BCM2837
// peripherals PDF). // peripherals PDF).
@ -231,9 +231,9 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 07_uart
// //
// So lets try to be on the safe side and default to 2000 cycles, which would equal 1 µs // So lets try to be on the safe side and default to 2000 cycles, which would equal 1 µs
diff -uNr 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs diff -uNr 05_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 06_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
--- 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs --- 05_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
+++ 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ 06_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
@@ -279,7 +279,7 @@ @@ -279,7 +279,7 @@
} }
@ -275,9 +275,9 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 0
{} {}
} }
diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/link.ld 07_uart_chainloader/src/bsp/raspberrypi/link.ld diff -uNr 05_drivers_gpio_uart/src/bsp/raspberrypi/link.ld 06_uart_chainloader/src/bsp/raspberrypi/link.ld
--- 06_drivers_gpio_uart/src/bsp/raspberrypi/link.ld --- 05_drivers_gpio_uart/src/bsp/raspberrypi/link.ld
+++ 07_uart_chainloader/src/bsp/raspberrypi/link.ld +++ 06_uart_chainloader/src/bsp/raspberrypi/link.ld
@@ -16,7 +16,8 @@ @@ -16,7 +16,8 @@
SECTIONS SECTIONS
@ -311,9 +311,9 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/link.ld 07_uart_chainloader/s
__bss_start = .; __bss_start = .;
*(.bss*); *(.bss*);
diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs 07_uart_chainloader/src/bsp/raspberrypi/memory.rs diff -uNr 05_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs 06_uart_chainloader/src/bsp/raspberrypi/memory.rs
--- 06_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs --- 05_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs
+++ 07_uart_chainloader/src/bsp/raspberrypi/memory.rs +++ 06_uart_chainloader/src/bsp/raspberrypi/memory.rs
@@ -23,9 +23,10 @@ @@ -23,9 +23,10 @@
/// The board's physical memory map. /// The board's physical memory map.
#[rustfmt::skip] #[rustfmt::skip]
@ -343,9 +343,9 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs 07_uart_chainloader
/// # Safety /// # Safety
/// ///
diff -uNr 06_drivers_gpio_uart/src/main.rs 07_uart_chainloader/src/main.rs diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs
--- 06_drivers_gpio_uart/src/main.rs --- 05_drivers_gpio_uart/src/main.rs
+++ 07_uart_chainloader/src/main.rs +++ 06_uart_chainloader/src/main.rs
@@ -107,6 +107,7 @@ @@ -107,6 +107,7 @@
//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html
@ -425,17 +425,17 @@ diff -uNr 06_drivers_gpio_uart/src/main.rs 07_uart_chainloader/src/main.rs
+ kernel() + kernel()
} }
diff -uNr 06_drivers_gpio_uart/update.sh 07_uart_chainloader/update.sh diff -uNr 05_drivers_gpio_uart/update.sh 06_uart_chainloader/update.sh
--- 06_drivers_gpio_uart/update.sh --- 05_drivers_gpio_uart/update.sh
+++ 07_uart_chainloader/update.sh +++ 06_uart_chainloader/update.sh
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
+#!/usr/bin/env bash +#!/usr/bin/env bash
+ +
+cd ../06_drivers_gpio_uart +cd ../05_drivers_gpio_uart
+BSP=rpi4 make +BSP=rpi4 make
+cp kernel8.img ../07_uart_chainloader/demo_payload_rpi4.img +cp kernel8.img ../06_uart_chainloader/demo_payload_rpi4.img
+make +make
+cp kernel8.img ../07_uart_chainloader/demo_payload_rpi3.img +cp kernel8.img ../06_uart_chainloader/demo_payload_rpi3.img
+rm kernel8.img +rm kernel8.img
``` ```

@ -0,0 +1,8 @@
#!/usr/bin/env bash
cd ../05_drivers_gpio_uart
BSP=rpi4 make
cp kernel8.img ../06_uart_chainloader/demo_payload_rpi4.img
make
cp kernel8.img ../06_uart_chainloader/demo_payload_rpi3.img
rm kernel8.img

@ -1,4 +1,4 @@
# Tutorial 08 - Timestamps # Tutorial 07 - Timestamps
## tl;dr ## tl;dr
@ -43,12 +43,12 @@ Minipush 1.0
## Diff to previous ## Diff to previous
```diff ```diff
Binary files 07_uart_chainloader/demo_payload_rpi3.img and 08_timestamps/demo_payload_rpi3.img differ Binary files 06_uart_chainloader/demo_payload_rpi3.img and 07_timestamps/demo_payload_rpi3.img differ
Binary files 07_uart_chainloader/demo_payload_rpi4.img and 08_timestamps/demo_payload_rpi4.img differ Binary files 06_uart_chainloader/demo_payload_rpi4.img and 07_timestamps/demo_payload_rpi4.img differ
diff -uNr 07_uart_chainloader/Makefile 08_timestamps/Makefile diff -uNr 06_uart_chainloader/Makefile 07_timestamps/Makefile
--- 07_uart_chainloader/Makefile --- 06_uart_chainloader/Makefile
+++ 08_timestamps/Makefile +++ 07_timestamps/Makefile
@@ -25,7 +25,6 @@ @@ -25,7 +25,6 @@
READELF_BINARY = aarch64-none-elf-readelf READELF_BINARY = aarch64-none-elf-readelf
LINKER_FILE = src/bsp/raspberrypi/link.ld LINKER_FILE = src/bsp/raspberrypi/link.ld
@ -93,9 +93,9 @@ diff -uNr 07_uart_chainloader/Makefile 08_timestamps/Makefile
clippy: clippy:
@RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD) @RUSTFLAGS="$(RUSTFLAGS_PEDANTIC)" $(CLIPPY_CMD)
diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu/boot.s 08_timestamps/src/_arch/aarch64/cpu/boot.s diff -uNr 06_uart_chainloader/src/_arch/aarch64/cpu/boot.s 07_timestamps/src/_arch/aarch64/cpu/boot.s
--- 07_uart_chainloader/src/_arch/aarch64/cpu/boot.s --- 06_uart_chainloader/src/_arch/aarch64/cpu/boot.s
+++ 08_timestamps/src/_arch/aarch64/cpu/boot.s +++ 07_timestamps/src/_arch/aarch64/cpu/boot.s
@@ -22,31 +22,20 @@ @@ -22,31 +22,20 @@
and x1, x1, _core_id_mask and x1, x1, _core_id_mask
ldr x2, BOOT_CORE_ID // provided by bsp/__board_name__/cpu.rs ldr x2, BOOT_CORE_ID // provided by bsp/__board_name__/cpu.rs
@ -135,9 +135,9 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu/boot.s 08_timestamps/src/_ar
.size _start, . - _start .size _start, . - _start
.type _start, function .type _start, function
diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/aarch64/cpu.rs diff -uNr 06_uart_chainloader/src/_arch/aarch64/cpu.rs 07_timestamps/src/_arch/aarch64/cpu.rs
--- 07_uart_chainloader/src/_arch/aarch64/cpu.rs --- 06_uart_chainloader/src/_arch/aarch64/cpu.rs
+++ 08_timestamps/src/_arch/aarch64/cpu.rs +++ 07_timestamps/src/_arch/aarch64/cpu.rs
@@ -19,15 +19,6 @@ @@ -19,15 +19,6 @@
pub use asm::nop; pub use asm::nop;
@ -155,9 +155,9 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/a
#[inline(always)] #[inline(always)]
pub fn wait_forever() -> ! { pub fn wait_forever() -> ! {
diff -uNr 07_uart_chainloader/src/_arch/aarch64/time.rs 08_timestamps/src/_arch/aarch64/time.rs diff -uNr 06_uart_chainloader/src/_arch/aarch64/time.rs 07_timestamps/src/_arch/aarch64/time.rs
--- 07_uart_chainloader/src/_arch/aarch64/time.rs --- 06_uart_chainloader/src/_arch/aarch64/time.rs
+++ 08_timestamps/src/_arch/aarch64/time.rs +++ 07_timestamps/src/_arch/aarch64/time.rs
@@ -0,0 +1,118 @@ @@ -0,0 +1,118 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -278,9 +278,9 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/time.rs 08_timestamps/src/_arch/
+ } + }
+} +}
diff -uNr 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs diff -uNr 06_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 07_timestamps/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
--- 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs --- 06_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
+++ 08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs +++ 07_timestamps/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs
@@ -139,25 +139,19 @@ @@ -139,25 +139,19 @@
/// Disable pull-up/down on pins 14 and 15. /// Disable pull-up/down on pins 14 and 15.
#[cfg(feature = "bsp_rpi3")] #[cfg(feature = "bsp_rpi3")]
@ -314,9 +314,9 @@ diff -uNr 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 08_times
self.registers.GPPUD.write(GPPUD::PUD::Off); self.registers.GPPUD.write(GPPUD::PUD::Off);
self.registers.GPPUDCLK0.set(0); self.registers.GPPUDCLK0.set(0);
diff -uNr 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs diff -uNr 06_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 07_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
--- 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs --- 06_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
+++ 08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ 07_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
@@ -279,7 +279,7 @@ @@ -279,7 +279,7 @@
} }
@ -358,9 +358,9 @@ diff -uNr 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 08
{} {}
} }
diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/link.ld 08_timestamps/src/bsp/raspberrypi/link.ld diff -uNr 06_uart_chainloader/src/bsp/raspberrypi/link.ld 07_timestamps/src/bsp/raspberrypi/link.ld
--- 07_uart_chainloader/src/bsp/raspberrypi/link.ld --- 06_uart_chainloader/src/bsp/raspberrypi/link.ld
+++ 08_timestamps/src/bsp/raspberrypi/link.ld +++ 07_timestamps/src/bsp/raspberrypi/link.ld
@@ -16,8 +16,7 @@ @@ -16,8 +16,7 @@
SECTIONS SECTIONS
@ -394,9 +394,9 @@ diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/link.ld 08_timestamps/src/bsp/
__bss_start = .; __bss_start = .;
*(.bss*); *(.bss*);
diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/memory.rs 08_timestamps/src/bsp/raspberrypi/memory.rs diff -uNr 06_uart_chainloader/src/bsp/raspberrypi/memory.rs 07_timestamps/src/bsp/raspberrypi/memory.rs
--- 07_uart_chainloader/src/bsp/raspberrypi/memory.rs --- 06_uart_chainloader/src/bsp/raspberrypi/memory.rs
+++ 08_timestamps/src/bsp/raspberrypi/memory.rs +++ 07_timestamps/src/bsp/raspberrypi/memory.rs
@@ -23,10 +23,9 @@ @@ -23,10 +23,9 @@
/// The board's physical memory map. /// The board's physical memory map.
#[rustfmt::skip] #[rustfmt::skip]
@ -426,9 +426,9 @@ diff -uNr 07_uart_chainloader/src/bsp/raspberrypi/memory.rs 08_timestamps/src/bs
/// # Safety /// # Safety
/// ///
diff -uNr 07_uart_chainloader/src/cpu.rs 08_timestamps/src/cpu.rs diff -uNr 06_uart_chainloader/src/cpu.rs 07_timestamps/src/cpu.rs
--- 07_uart_chainloader/src/cpu.rs --- 06_uart_chainloader/src/cpu.rs
+++ 08_timestamps/src/cpu.rs +++ 07_timestamps/src/cpu.rs
@@ -14,6 +14,3 @@ @@ -14,6 +14,3 @@
// Architectural Public Reexports // Architectural Public Reexports
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -437,9 +437,9 @@ diff -uNr 07_uart_chainloader/src/cpu.rs 08_timestamps/src/cpu.rs
-#[cfg(feature = "bsp_rpi3")] -#[cfg(feature = "bsp_rpi3")]
-pub use arch_cpu::spin_for_cycles; -pub use arch_cpu::spin_for_cycles;
diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs
--- 07_uart_chainloader/src/main.rs --- 06_uart_chainloader/src/main.rs
+++ 08_timestamps/src/main.rs +++ 07_timestamps/src/main.rs
@@ -107,7 +107,6 @@ @@ -107,7 +107,6 @@
//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html
@ -531,9 +531,9 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs
+ } + }
} }
diff -uNr 07_uart_chainloader/src/print.rs 08_timestamps/src/print.rs diff -uNr 06_uart_chainloader/src/print.rs 07_timestamps/src/print.rs
--- 07_uart_chainloader/src/print.rs --- 06_uart_chainloader/src/print.rs
+++ 08_timestamps/src/print.rs +++ 07_timestamps/src/print.rs
@@ -36,3 +36,71 @@ @@ -36,3 +36,71 @@
$crate::print::_print(format_args_nl!($($arg)*)); $crate::print::_print(format_args_nl!($($arg)*));
}) })
@ -607,9 +607,9 @@ diff -uNr 07_uart_chainloader/src/print.rs 08_timestamps/src/print.rs
+ }) + })
+} +}
diff -uNr 07_uart_chainloader/src/time.rs 08_timestamps/src/time.rs diff -uNr 06_uart_chainloader/src/time.rs 07_timestamps/src/time.rs
--- 07_uart_chainloader/src/time.rs --- 06_uart_chainloader/src/time.rs
+++ 08_timestamps/src/time.rs +++ 07_timestamps/src/time.rs
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
@ -649,17 +649,17 @@ diff -uNr 07_uart_chainloader/src/time.rs 08_timestamps/src/time.rs
+ } + }
+} +}
diff -uNr 07_uart_chainloader/update.sh 08_timestamps/update.sh diff -uNr 06_uart_chainloader/update.sh 07_timestamps/update.sh
--- 07_uart_chainloader/update.sh --- 06_uart_chainloader/update.sh
+++ 08_timestamps/update.sh +++ 07_timestamps/update.sh
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
-#!/usr/bin/env bash -#!/usr/bin/env bash
- -
-cd ../06_drivers_gpio_uart -cd ../05_drivers_gpio_uart
-BSP=rpi4 make -BSP=rpi4 make
-cp kernel8.img ../07_uart_chainloader/demo_payload_rpi4.img -cp kernel8.img ../06_uart_chainloader/demo_payload_rpi4.img
-make -make
-cp kernel8.img ../07_uart_chainloader/demo_payload_rpi3.img -cp kernel8.img ../06_uart_chainloader/demo_payload_rpi3.img
-rm kernel8.img -rm kernel8.img
``` ```

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save