diff --git a/01_bareminimum/Cargo.toml b/01_bareminimum/Cargo.toml index 8cec3a4b..26996a7f 100644 --- a/01_bareminimum/Cargo.toml +++ b/01_bareminimum/Cargo.toml @@ -2,6 +2,7 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] panic-abort = "0.3.1" diff --git a/01_bareminimum/kernel8 b/01_bareminimum/kernel8 index 10851529..9aa7b8cb 100755 Binary files a/01_bareminimum/kernel8 and b/01_bareminimum/kernel8 differ diff --git a/02_multicore_rust/Cargo.toml b/02_multicore_rust/Cargo.toml index 16212d5b..dd59a6da 100644 --- a/02_multicore_rust/Cargo.toml +++ b/02_multicore_rust/Cargo.toml @@ -2,6 +2,7 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } diff --git a/02_multicore_rust/kernel8 b/02_multicore_rust/kernel8 index 38246bf0..f267d339 100755 Binary files a/02_multicore_rust/kernel8 and b/02_multicore_rust/kernel8 differ diff --git a/02_multicore_rust/raspi3_boot/Cargo.toml b/02_multicore_rust/raspi3_boot/Cargo.toml index e080b254..1c3c1c69 100644 --- a/02_multicore_rust/raspi3_boot/Cargo.toml +++ b/02_multicore_rust/raspi3_boot/Cargo.toml @@ -2,6 +2,7 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] panic-abort = "0.3.1" diff --git a/02_multicore_rust/raspi3_boot/src/lib.rs b/02_multicore_rust/raspi3_boot/src/lib.rs index 721b75f9..d12fcc88 100644 --- a/02_multicore_rust/raspi3_boot/src/lib.rs +++ b/02_multicore_rust/raspi3_boot/src/lib.rs @@ -31,7 +31,6 @@ //! Low-level boot of the Raspberry's processor extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/02_multicore_rust/src/main.rs b/02_multicore_rust/src/main.rs index be34c210..a35bd169 100644 --- a/02_multicore_rust/src/main.rs +++ b/02_multicore_rust/src/main.rs @@ -25,10 +25,7 @@ #![no_std] #![no_main] -#[macro_use] -extern crate raspi3_boot; - -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { loop {} diff --git a/03_uart1/Cargo.lock b/03_uart1/Cargo.lock index 8f59b9c3..90f2de94 100644 --- a/03_uart1/Cargo.lock +++ b/03_uart1/Cargo.lock @@ -3,7 +3,7 @@ name = "kernel8" version = "0.1.0" dependencies = [ "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -26,19 +26,19 @@ dependencies = [ [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/03_uart1/Cargo.toml b/03_uart1/Cargo.toml index 0bc9ef3c..96119dfc 100644 --- a/03_uart1/Cargo.toml +++ b/03_uart1/Cargo.toml @@ -2,10 +2,11 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -register = "0.2.0" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/03_uart1/kernel8 b/03_uart1/kernel8 index 7b90ae5d..92f12ee2 100755 Binary files a/03_uart1/kernel8 and b/03_uart1/kernel8 differ diff --git a/03_uart1/kernel8.img b/03_uart1/kernel8.img index 266d317b..3acb27e5 100755 Binary files a/03_uart1/kernel8.img and b/03_uart1/kernel8.img differ diff --git a/03_uart1/raspi3_boot/Cargo.toml b/03_uart1/raspi3_boot/Cargo.toml index e080b254..1c3c1c69 100644 --- a/03_uart1/raspi3_boot/Cargo.toml +++ b/03_uart1/raspi3_boot/Cargo.toml @@ -2,6 +2,7 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] panic-abort = "0.3.1" diff --git a/03_uart1/raspi3_boot/src/lib.rs b/03_uart1/raspi3_boot/src/lib.rs index 721b75f9..d12fcc88 100644 --- a/03_uart1/raspi3_boot/src/lib.rs +++ b/03_uart1/raspi3_boot/src/lib.rs @@ -31,7 +31,6 @@ //! Low-level boot of the Raspberry's processor extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/03_uart1/src/gpio.rs b/03_uart1/src/gpio.rs index 9ec2bda6..408af5ab 100644 --- a/03_uart1/src/gpio.rs +++ b/03_uart1/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/03_uart1/src/main.rs b/03_uart1/src/main.rs index d82b5ebc..7e31dedf 100644 --- a/03_uart1/src/main.rs +++ b/03_uart1/src/main.rs @@ -26,18 +26,12 @@ #![no_main] #![feature(asm)] -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod gpio; mod uart; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let uart = uart::MiniUart::new(); diff --git a/03_uart1/src/uart.rs b/03_uart1/src/uart.rs index 894eca33..26cf6d79 100644 --- a/03_uart1/src/uart.rs +++ b/03_uart1/src/uart.rs @@ -23,9 +23,9 @@ */ use super::MMIO_BASE; +use crate::gpio; use core::ops; -use gpio; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; /// Auxilary mini UART registers // diff --git a/04_mailboxes/Cargo.lock b/04_mailboxes/Cargo.lock index 8f59b9c3..90f2de94 100644 --- a/04_mailboxes/Cargo.lock +++ b/04_mailboxes/Cargo.lock @@ -3,7 +3,7 @@ name = "kernel8" version = "0.1.0" dependencies = [ "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -26,19 +26,19 @@ dependencies = [ [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/04_mailboxes/Cargo.toml b/04_mailboxes/Cargo.toml index 0bc9ef3c..96119dfc 100644 --- a/04_mailboxes/Cargo.toml +++ b/04_mailboxes/Cargo.toml @@ -2,10 +2,11 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -register = "0.2.0" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/04_mailboxes/kernel8 b/04_mailboxes/kernel8 index 105f1e78..822794ab 100755 Binary files a/04_mailboxes/kernel8 and b/04_mailboxes/kernel8 differ diff --git a/04_mailboxes/kernel8.img b/04_mailboxes/kernel8.img index 1267cc86..9a7cef7a 100755 Binary files a/04_mailboxes/kernel8.img and b/04_mailboxes/kernel8.img differ diff --git a/04_mailboxes/raspi3_boot/Cargo.toml b/04_mailboxes/raspi3_boot/Cargo.toml index e080b254..1c3c1c69 100644 --- a/04_mailboxes/raspi3_boot/Cargo.toml +++ b/04_mailboxes/raspi3_boot/Cargo.toml @@ -2,6 +2,7 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] panic-abort = "0.3.1" diff --git a/04_mailboxes/raspi3_boot/src/lib.rs b/04_mailboxes/raspi3_boot/src/lib.rs index 721b75f9..d12fcc88 100644 --- a/04_mailboxes/raspi3_boot/src/lib.rs +++ b/04_mailboxes/raspi3_boot/src/lib.rs @@ -31,7 +31,6 @@ //! Low-level boot of the Raspberry's processor extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/04_mailboxes/src/gpio.rs b/04_mailboxes/src/gpio.rs index 9ec2bda6..408af5ab 100644 --- a/04_mailboxes/src/gpio.rs +++ b/04_mailboxes/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/04_mailboxes/src/main.rs b/04_mailboxes/src/main.rs index 75a09b6b..f3bfe851 100644 --- a/04_mailboxes/src/main.rs +++ b/04_mailboxes/src/main.rs @@ -26,12 +26,6 @@ #![no_main] #![feature(asm)] -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod gpio; @@ -40,7 +34,7 @@ mod uart; use core::sync::atomic::{compiler_fence, Ordering}; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/04_mailboxes/src/mbox.rs b/04_mailboxes/src/mbox.rs index 2c0ceab9..88f8fadd 100644 --- a/04_mailboxes/src/mbox.rs +++ b/04_mailboxes/src/mbox.rs @@ -24,7 +24,10 @@ use super::MMIO_BASE; use core::ops; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/04_mailboxes/src/uart.rs b/04_mailboxes/src/uart.rs index 95d7f740..6a88659c 100644 --- a/04_mailboxes/src/uart.rs +++ b/04_mailboxes/src/uart.rs @@ -23,9 +23,9 @@ */ use super::MMIO_BASE; +use crate::gpio; use core::ops; -use gpio; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; /// Auxilary mini UART registers // diff --git a/05_uart0/Cargo.lock b/05_uart0/Cargo.lock index 8f59b9c3..d1906eda 100644 --- a/05_uart0/Cargo.lock +++ b/05_uart0/Cargo.lock @@ -3,7 +3,7 @@ name = "kernel8" version = "0.1.0" dependencies = [ "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2", ] [[package]] @@ -26,19 +26,17 @@ dependencies = [ [[package]] name = "register" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.3.2" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/05_uart0/Cargo.toml b/05_uart0/Cargo.toml index 0bc9ef3c..b748c4a5 100644 --- a/05_uart0/Cargo.toml +++ b/05_uart0/Cargo.toml @@ -2,10 +2,12 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -register = "0.2.0" +register = { path = '../../register-rs' } +#register = "0.2.0" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/05_uart0/kernel8 b/05_uart0/kernel8 index bbaff05b..3a94d950 100755 Binary files a/05_uart0/kernel8 and b/05_uart0/kernel8 differ diff --git a/05_uart0/kernel8.img b/05_uart0/kernel8.img index 99e5b2bb..d3e74013 100755 Binary files a/05_uart0/kernel8.img and b/05_uart0/kernel8.img differ diff --git a/05_uart0/raspi3_boot/Cargo.toml b/05_uart0/raspi3_boot/Cargo.toml index e080b254..1c3c1c69 100644 --- a/05_uart0/raspi3_boot/Cargo.toml +++ b/05_uart0/raspi3_boot/Cargo.toml @@ -2,6 +2,7 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] panic-abort = "0.3.1" diff --git a/05_uart0/raspi3_boot/src/lib.rs b/05_uart0/raspi3_boot/src/lib.rs index 721b75f9..d12fcc88 100644 --- a/05_uart0/raspi3_boot/src/lib.rs +++ b/05_uart0/raspi3_boot/src/lib.rs @@ -31,7 +31,6 @@ //! Low-level boot of the Raspberry's processor extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/05_uart0/src/gpio.rs b/05_uart0/src/gpio.rs index 3ff0c1e9..da6a5be4 100644 --- a/05_uart0/src/gpio.rs +++ b/05_uart0/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/05_uart0/src/main.rs b/05_uart0/src/main.rs index 3b297ffa..b1493f97 100644 --- a/05_uart0/src/main.rs +++ b/05_uart0/src/main.rs @@ -26,12 +26,6 @@ #![no_main] #![feature(asm)] -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod gpio; @@ -40,7 +34,7 @@ mod uart; use core::sync::atomic::{compiler_fence, Ordering}; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/05_uart0/src/mbox.rs b/05_uart0/src/mbox.rs index 279b3129..daff3771 100644 --- a/05_uart0/src/mbox.rs +++ b/05_uart0/src/mbox.rs @@ -24,7 +24,10 @@ use super::MMIO_BASE; use core::ops; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/05_uart0/src/uart.rs b/05_uart0/src/uart.rs index a2afdfec..722cb034 100644 --- a/05_uart0/src/uart.rs +++ b/05_uart0/src/uart.rs @@ -23,13 +23,13 @@ */ use super::MMIO_BASE; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. // diff --git a/06_raspbootin64/Cargo.lock b/06_raspbootin64/Cargo.lock index 8f59b9c3..90f2de94 100644 --- a/06_raspbootin64/Cargo.lock +++ b/06_raspbootin64/Cargo.lock @@ -3,7 +3,7 @@ name = "kernel8" version = "0.1.0" dependencies = [ "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -26,19 +26,19 @@ dependencies = [ [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/06_raspbootin64/Cargo.toml b/06_raspbootin64/Cargo.toml index b4a1316c..0728dd60 100644 --- a/06_raspbootin64/Cargo.toml +++ b/06_raspbootin64/Cargo.toml @@ -2,10 +2,11 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -register = "0.2.0" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot/pic" diff --git a/06_raspbootin64/kernel8 b/06_raspbootin64/kernel8 index 2a58f62c..a176ab6b 100755 Binary files a/06_raspbootin64/kernel8 and b/06_raspbootin64/kernel8 differ diff --git a/06_raspbootin64/kernel8.img b/06_raspbootin64/kernel8.img index 393e2e42..fe41d9f5 100755 Binary files a/06_raspbootin64/kernel8.img and b/06_raspbootin64/kernel8.img differ diff --git a/06_raspbootin64/raspi3_boot/Cargo.toml b/06_raspbootin64/raspi3_boot/Cargo.toml index e080b254..1c3c1c69 100644 --- a/06_raspbootin64/raspi3_boot/Cargo.toml +++ b/06_raspbootin64/raspi3_boot/Cargo.toml @@ -2,6 +2,7 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] panic-abort = "0.3.1" diff --git a/06_raspbootin64/raspi3_boot/src/lib.rs b/06_raspbootin64/raspi3_boot/src/lib.rs index aa08edd3..3e57d0a8 100644 --- a/06_raspbootin64/raspi3_boot/src/lib.rs +++ b/06_raspbootin64/raspi3_boot/src/lib.rs @@ -31,7 +31,6 @@ //! Low-level boot of the Raspberry's processor extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/06_raspbootin64/src/gpio.rs b/06_raspbootin64/src/gpio.rs index 3ff0c1e9..da6a5be4 100644 --- a/06_raspbootin64/src/gpio.rs +++ b/06_raspbootin64/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/06_raspbootin64/src/main.rs b/06_raspbootin64/src/main.rs index 63a2aeaf..2396cb9a 100644 --- a/06_raspbootin64/src/main.rs +++ b/06_raspbootin64/src/main.rs @@ -26,19 +26,13 @@ #![no_main] #![feature(asm)] -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod gpio; mod mbox; mod uart; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/06_raspbootin64/src/mbox.rs b/06_raspbootin64/src/mbox.rs index b33d2dab..d6343bee 100644 --- a/06_raspbootin64/src/mbox.rs +++ b/06_raspbootin64/src/mbox.rs @@ -24,7 +24,10 @@ use super::MMIO_BASE; use core::ops; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/06_raspbootin64/src/uart.rs b/06_raspbootin64/src/uart.rs index e148331b..26b7a0b7 100644 --- a/06_raspbootin64/src/uart.rs +++ b/06_raspbootin64/src/uart.rs @@ -23,13 +23,13 @@ */ use super::MMIO_BASE; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. // diff --git a/07_abstraction/Cargo.lock b/07_abstraction/Cargo.lock index cd6dccb9..16ef5e23 100644 --- a/07_abstraction/Cargo.lock +++ b/07_abstraction/Cargo.lock @@ -1,18 +1,18 @@ [[package]] name = "cortex-a" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel8" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,27 +29,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "raspi3_boot" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe913628f34718bc9e7d0d07e13ca1374638f64f0edc6eb063ec8abe581d395d" +"checksum cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12425c4491f31f28f539c74382ade69ee9db4f1f597aa177f43e072595562e46" "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/07_abstraction/Cargo.toml b/07_abstraction/Cargo.toml index b7f40114..bc742cac 100644 --- a/07_abstraction/Cargo.toml +++ b/07_abstraction/Cargo.toml @@ -2,11 +2,12 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -cortex-a = "2.2.1" -register = "0.2.0" +cortex-a = "2.3.1" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/07_abstraction/kernel8 b/07_abstraction/kernel8 index 8ef8e5fb..3f058c28 100755 Binary files a/07_abstraction/kernel8 and b/07_abstraction/kernel8 differ diff --git a/07_abstraction/kernel8.img b/07_abstraction/kernel8.img index 7f6ce7ca..63c5a4b0 100755 Binary files a/07_abstraction/kernel8.img and b/07_abstraction/kernel8.img differ diff --git a/07_abstraction/raspi3_boot/Cargo.toml b/07_abstraction/raspi3_boot/Cargo.toml index cd382ba4..09732955 100644 --- a/07_abstraction/raspi3_boot/Cargo.toml +++ b/07_abstraction/raspi3_boot/Cargo.toml @@ -2,8 +2,9 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] -cortex-a = "2.2.1" +cortex-a = "2.3.1" panic-abort = "0.3.1" r0 = "0.2.2" diff --git a/07_abstraction/raspi3_boot/src/lib.rs b/07_abstraction/raspi3_boot/src/lib.rs index d5d873cb..38e1c8f7 100644 --- a/07_abstraction/raspi3_boot/src/lib.rs +++ b/07_abstraction/raspi3_boot/src/lib.rs @@ -29,9 +29,7 @@ //! Low-level boot of the Raspberry's processor -extern crate cortex_a; extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/07_abstraction/src/gpio.rs b/07_abstraction/src/gpio.rs index 3ff0c1e9..da6a5be4 100644 --- a/07_abstraction/src/gpio.rs +++ b/07_abstraction/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/07_abstraction/src/main.rs b/07_abstraction/src/main.rs index 2ebcd1a0..82237308 100644 --- a/07_abstraction/src/main.rs +++ b/07_abstraction/src/main.rs @@ -25,14 +25,6 @@ #![no_std] #![no_main] -extern crate cortex_a; - -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod gpio; @@ -41,7 +33,7 @@ mod uart; use core::sync::atomic::{compiler_fence, Ordering}; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/07_abstraction/src/mbox.rs b/07_abstraction/src/mbox.rs index 3a2bc67f..5b7e3589 100644 --- a/07_abstraction/src/mbox.rs +++ b/07_abstraction/src/mbox.rs @@ -25,7 +25,10 @@ use super::MMIO_BASE; use core::ops; use cortex_a::asm; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/07_abstraction/src/uart.rs b/07_abstraction/src/uart.rs index a25f0d13..db4c639a 100644 --- a/07_abstraction/src/uart.rs +++ b/07_abstraction/src/uart.rs @@ -23,14 +23,14 @@ */ use super::MMIO_BASE; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; use cortex_a::asm; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. // diff --git a/08_random/Cargo.lock b/08_random/Cargo.lock index cd6dccb9..16ef5e23 100644 --- a/08_random/Cargo.lock +++ b/08_random/Cargo.lock @@ -1,18 +1,18 @@ [[package]] name = "cortex-a" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel8" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,27 +29,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "raspi3_boot" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe913628f34718bc9e7d0d07e13ca1374638f64f0edc6eb063ec8abe581d395d" +"checksum cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12425c4491f31f28f539c74382ade69ee9db4f1f597aa177f43e072595562e46" "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/08_random/Cargo.toml b/08_random/Cargo.toml index b7f40114..bc742cac 100644 --- a/08_random/Cargo.toml +++ b/08_random/Cargo.toml @@ -2,11 +2,12 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -cortex-a = "2.2.1" -register = "0.2.0" +cortex-a = "2.3.1" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/08_random/kernel8 b/08_random/kernel8 index cbda4203..f8cdc847 100755 Binary files a/08_random/kernel8 and b/08_random/kernel8 differ diff --git a/08_random/kernel8.img b/08_random/kernel8.img index 19f141ae..1ca65a6b 100755 Binary files a/08_random/kernel8.img and b/08_random/kernel8.img differ diff --git a/08_random/raspi3_boot/Cargo.toml b/08_random/raspi3_boot/Cargo.toml index cd382ba4..09732955 100644 --- a/08_random/raspi3_boot/Cargo.toml +++ b/08_random/raspi3_boot/Cargo.toml @@ -2,8 +2,9 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] -cortex-a = "2.2.1" +cortex-a = "2.3.1" panic-abort = "0.3.1" r0 = "0.2.2" diff --git a/08_random/raspi3_boot/src/lib.rs b/08_random/raspi3_boot/src/lib.rs index d5d873cb..38e1c8f7 100644 --- a/08_random/raspi3_boot/src/lib.rs +++ b/08_random/raspi3_boot/src/lib.rs @@ -29,9 +29,7 @@ //! Low-level boot of the Raspberry's processor -extern crate cortex_a; extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/08_random/src/gpio.rs b/08_random/src/gpio.rs index 3ff0c1e9..da6a5be4 100644 --- a/08_random/src/gpio.rs +++ b/08_random/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/08_random/src/main.rs b/08_random/src/main.rs index 8a842acc..31d7c371 100644 --- a/08_random/src/main.rs +++ b/08_random/src/main.rs @@ -25,14 +25,6 @@ #![no_std] #![no_main] -extern crate cortex_a; - -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod gpio; @@ -40,7 +32,7 @@ mod mbox; mod rand; mod uart; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/08_random/src/mbox.rs b/08_random/src/mbox.rs index 18fe5787..aeae88bb 100644 --- a/08_random/src/mbox.rs +++ b/08_random/src/mbox.rs @@ -25,7 +25,10 @@ use super::MMIO_BASE; use core::ops; use cortex_a::asm; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/08_random/src/rand.rs b/08_random/src/rand.rs index 866fce83..140e03d1 100644 --- a/08_random/src/rand.rs +++ b/08_random/src/rand.rs @@ -25,7 +25,7 @@ use super::MMIO_BASE; use core::ops; use cortex_a::asm; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; register_bitfields! { u32, diff --git a/08_random/src/uart.rs b/08_random/src/uart.rs index a25f0d13..db4c639a 100644 --- a/08_random/src/uart.rs +++ b/08_random/src/uart.rs @@ -23,14 +23,14 @@ */ use super::MMIO_BASE; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; use cortex_a::asm; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. // diff --git a/09_delays/Cargo.lock b/09_delays/Cargo.lock index cd6dccb9..16ef5e23 100644 --- a/09_delays/Cargo.lock +++ b/09_delays/Cargo.lock @@ -1,18 +1,18 @@ [[package]] name = "cortex-a" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel8" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,27 +29,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "raspi3_boot" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe913628f34718bc9e7d0d07e13ca1374638f64f0edc6eb063ec8abe581d395d" +"checksum cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12425c4491f31f28f539c74382ade69ee9db4f1f597aa177f43e072595562e46" "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/09_delays/Cargo.toml b/09_delays/Cargo.toml index b7f40114..bc742cac 100644 --- a/09_delays/Cargo.toml +++ b/09_delays/Cargo.toml @@ -2,11 +2,12 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -cortex-a = "2.2.1" -register = "0.2.0" +cortex-a = "2.3.1" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/09_delays/kernel8 b/09_delays/kernel8 index da3c6d6d..afaec440 100755 Binary files a/09_delays/kernel8 and b/09_delays/kernel8 differ diff --git a/09_delays/kernel8.img b/09_delays/kernel8.img index 668bc5ca..4547f6e3 100755 Binary files a/09_delays/kernel8.img and b/09_delays/kernel8.img differ diff --git a/09_delays/raspi3_boot/Cargo.toml b/09_delays/raspi3_boot/Cargo.toml index cd382ba4..09732955 100644 --- a/09_delays/raspi3_boot/Cargo.toml +++ b/09_delays/raspi3_boot/Cargo.toml @@ -2,8 +2,9 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] -cortex-a = "2.2.1" +cortex-a = "2.3.1" panic-abort = "0.3.1" r0 = "0.2.2" diff --git a/09_delays/raspi3_boot/src/lib.rs b/09_delays/raspi3_boot/src/lib.rs index d5d873cb..38e1c8f7 100644 --- a/09_delays/raspi3_boot/src/lib.rs +++ b/09_delays/raspi3_boot/src/lib.rs @@ -29,9 +29,7 @@ //! Low-level boot of the Raspberry's processor -extern crate cortex_a; extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/09_delays/src/gpio.rs b/09_delays/src/gpio.rs index 3ff0c1e9..da6a5be4 100644 --- a/09_delays/src/gpio.rs +++ b/09_delays/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/09_delays/src/main.rs b/09_delays/src/main.rs index 199d5ab9..027c72a0 100644 --- a/09_delays/src/main.rs +++ b/09_delays/src/main.rs @@ -25,14 +25,6 @@ #![no_std] #![no_main] -extern crate cortex_a; - -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod delays; @@ -40,7 +32,7 @@ mod gpio; mod mbox; mod uart; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/09_delays/src/mbox.rs b/09_delays/src/mbox.rs index 18fe5787..aeae88bb 100644 --- a/09_delays/src/mbox.rs +++ b/09_delays/src/mbox.rs @@ -25,7 +25,10 @@ use super::MMIO_BASE; use core::ops; use cortex_a::asm; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/09_delays/src/uart.rs b/09_delays/src/uart.rs index 4748bb56..75310d17 100644 --- a/09_delays/src/uart.rs +++ b/09_delays/src/uart.rs @@ -23,15 +23,15 @@ */ use super::MMIO_BASE; +use crate::delays; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; use cortex_a::asm; -use delays; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. // diff --git a/0A_power/Cargo.lock b/0A_power/Cargo.lock index cd6dccb9..16ef5e23 100644 --- a/0A_power/Cargo.lock +++ b/0A_power/Cargo.lock @@ -1,18 +1,18 @@ [[package]] name = "cortex-a" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel8" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,27 +29,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "raspi3_boot" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe913628f34718bc9e7d0d07e13ca1374638f64f0edc6eb063ec8abe581d395d" +"checksum cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12425c4491f31f28f539c74382ade69ee9db4f1f597aa177f43e072595562e46" "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/0A_power/Cargo.toml b/0A_power/Cargo.toml index b7f40114..bc742cac 100644 --- a/0A_power/Cargo.toml +++ b/0A_power/Cargo.toml @@ -2,11 +2,12 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -cortex-a = "2.2.1" -register = "0.2.0" +cortex-a = "2.3.1" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/0A_power/kernel8 b/0A_power/kernel8 index 56581bf7..03daaaf5 100755 Binary files a/0A_power/kernel8 and b/0A_power/kernel8 differ diff --git a/0A_power/kernel8.img b/0A_power/kernel8.img index 0cda48d1..d82db789 100755 Binary files a/0A_power/kernel8.img and b/0A_power/kernel8.img differ diff --git a/0A_power/raspi3_boot/Cargo.toml b/0A_power/raspi3_boot/Cargo.toml index cd382ba4..09732955 100644 --- a/0A_power/raspi3_boot/Cargo.toml +++ b/0A_power/raspi3_boot/Cargo.toml @@ -2,8 +2,9 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] -cortex-a = "2.2.1" +cortex-a = "2.3.1" panic-abort = "0.3.1" r0 = "0.2.2" diff --git a/0A_power/raspi3_boot/src/lib.rs b/0A_power/raspi3_boot/src/lib.rs index d5d873cb..38e1c8f7 100644 --- a/0A_power/raspi3_boot/src/lib.rs +++ b/0A_power/raspi3_boot/src/lib.rs @@ -29,9 +29,7 @@ //! Low-level boot of the Raspberry's processor -extern crate cortex_a; extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/0A_power/src/gpio.rs b/0A_power/src/gpio.rs index 2175cc3a..608ba532 100644 --- a/0A_power/src/gpio.rs +++ b/0A_power/src/gpio.rs @@ -24,7 +24,7 @@ use super::MMIO_BASE; use core::ops; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/0A_power/src/main.rs b/0A_power/src/main.rs index 5c147547..015ef27d 100644 --- a/0A_power/src/main.rs +++ b/0A_power/src/main.rs @@ -25,14 +25,6 @@ #![no_std] #![no_main] -extern crate cortex_a; - -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod delays; @@ -41,7 +33,7 @@ mod mbox; mod power; mod uart; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let gpio = gpio::GPIO::new(); diff --git a/0A_power/src/mbox.rs b/0A_power/src/mbox.rs index 00abf8fc..f5a420a5 100644 --- a/0A_power/src/mbox.rs +++ b/0A_power/src/mbox.rs @@ -25,7 +25,10 @@ use super::MMIO_BASE; use core::ops; use cortex_a::asm; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/0A_power/src/power.rs b/0A_power/src/power.rs index 41240021..4cce72d1 100644 --- a/0A_power/src/power.rs +++ b/0A_power/src/power.rs @@ -23,11 +23,11 @@ */ use super::MMIO_BASE; +use crate::delays; +use crate::gpio; +use crate::mbox; use core::ops; use core::sync::atomic::{compiler_fence, Ordering}; -use delays; -use gpio; -use mbox; use register::mmio::*; const POWER_BASE: u32 = MMIO_BASE + 0x100_01C; diff --git a/0A_power/src/uart.rs b/0A_power/src/uart.rs index c854edc7..8950fea6 100644 --- a/0A_power/src/uart.rs +++ b/0A_power/src/uart.rs @@ -23,15 +23,15 @@ */ use super::MMIO_BASE; +use crate::delays; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; use cortex_a::asm; -use delays; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. // diff --git a/0B_exception_levels/Cargo.lock b/0B_exception_levels/Cargo.lock index cd6dccb9..16ef5e23 100644 --- a/0B_exception_levels/Cargo.lock +++ b/0B_exception_levels/Cargo.lock @@ -1,18 +1,18 @@ [[package]] name = "cortex-a" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel8" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,27 +29,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "raspi3_boot" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe913628f34718bc9e7d0d07e13ca1374638f64f0edc6eb063ec8abe581d395d" +"checksum cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12425c4491f31f28f539c74382ade69ee9db4f1f597aa177f43e072595562e46" "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/0B_exception_levels/Cargo.toml b/0B_exception_levels/Cargo.toml index b7f40114..bc742cac 100644 --- a/0B_exception_levels/Cargo.toml +++ b/0B_exception_levels/Cargo.toml @@ -2,11 +2,12 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -cortex-a = "2.2.1" -register = "0.2.0" +cortex-a = "2.3.1" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/0B_exception_levels/kernel8 b/0B_exception_levels/kernel8 index dd2d163a..dfedbd82 100755 Binary files a/0B_exception_levels/kernel8 and b/0B_exception_levels/kernel8 differ diff --git a/0B_exception_levels/kernel8.img b/0B_exception_levels/kernel8.img index 4c0be6f9..7d47414a 100755 Binary files a/0B_exception_levels/kernel8.img and b/0B_exception_levels/kernel8.img differ diff --git a/0B_exception_levels/raspi3_boot/Cargo.toml b/0B_exception_levels/raspi3_boot/Cargo.toml index cd382ba4..09732955 100644 --- a/0B_exception_levels/raspi3_boot/Cargo.toml +++ b/0B_exception_levels/raspi3_boot/Cargo.toml @@ -2,8 +2,9 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] -cortex-a = "2.2.1" +cortex-a = "2.3.1" panic-abort = "0.3.1" r0 = "0.2.2" diff --git a/0B_exception_levels/raspi3_boot/src/lib.rs b/0B_exception_levels/raspi3_boot/src/lib.rs index ccfc6370..d5ce1ae8 100644 --- a/0B_exception_levels/raspi3_boot/src/lib.rs +++ b/0B_exception_levels/raspi3_boot/src/lib.rs @@ -29,9 +29,7 @@ //! Low-level boot of the Raspberry's processor -extern crate cortex_a; extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/0B_exception_levels/src/gpio.rs b/0B_exception_levels/src/gpio.rs index 3ff0c1e9..da6a5be4 100644 --- a/0B_exception_levels/src/gpio.rs +++ b/0B_exception_levels/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/0B_exception_levels/src/main.rs b/0B_exception_levels/src/main.rs index 7df44465..6e501672 100644 --- a/0B_exception_levels/src/main.rs +++ b/0B_exception_levels/src/main.rs @@ -25,14 +25,6 @@ #![no_std] #![no_main] -extern crate cortex_a; - -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod delays; @@ -77,7 +69,7 @@ fn check_daif(uart: &uart::Uart) { } } -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/0B_exception_levels/src/mbox.rs b/0B_exception_levels/src/mbox.rs index 18fe5787..aeae88bb 100644 --- a/0B_exception_levels/src/mbox.rs +++ b/0B_exception_levels/src/mbox.rs @@ -25,7 +25,10 @@ use super::MMIO_BASE; use core::ops; use cortex_a::asm; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/0B_exception_levels/src/uart.rs b/0B_exception_levels/src/uart.rs index a25f0d13..db4c639a 100644 --- a/0B_exception_levels/src/uart.rs +++ b/0B_exception_levels/src/uart.rs @@ -23,14 +23,14 @@ */ use super::MMIO_BASE; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; use cortex_a::asm; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. // diff --git a/0C_virtual_memory/Cargo.lock b/0C_virtual_memory/Cargo.lock index cd6dccb9..16ef5e23 100644 --- a/0C_virtual_memory/Cargo.lock +++ b/0C_virtual_memory/Cargo.lock @@ -1,18 +1,18 @@ [[package]] name = "cortex-a" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel8" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,27 +29,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "raspi3_boot" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe913628f34718bc9e7d0d07e13ca1374638f64f0edc6eb063ec8abe581d395d" +"checksum cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12425c4491f31f28f539c74382ade69ee9db4f1f597aa177f43e072595562e46" "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/0C_virtual_memory/Cargo.toml b/0C_virtual_memory/Cargo.toml index b7f40114..bc742cac 100644 --- a/0C_virtual_memory/Cargo.toml +++ b/0C_virtual_memory/Cargo.toml @@ -2,11 +2,12 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -cortex-a = "2.2.1" -register = "0.2.0" +cortex-a = "2.3.1" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/0C_virtual_memory/kernel8 b/0C_virtual_memory/kernel8 index 27b39c2d..b4644b05 100755 Binary files a/0C_virtual_memory/kernel8 and b/0C_virtual_memory/kernel8 differ diff --git a/0C_virtual_memory/kernel8.img b/0C_virtual_memory/kernel8.img index 1c5e6988..c0cfc9e8 100755 Binary files a/0C_virtual_memory/kernel8.img and b/0C_virtual_memory/kernel8.img differ diff --git a/0C_virtual_memory/raspi3_boot/Cargo.toml b/0C_virtual_memory/raspi3_boot/Cargo.toml index cd382ba4..09732955 100644 --- a/0C_virtual_memory/raspi3_boot/Cargo.toml +++ b/0C_virtual_memory/raspi3_boot/Cargo.toml @@ -2,8 +2,9 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] -cortex-a = "2.2.1" +cortex-a = "2.3.1" panic-abort = "0.3.1" r0 = "0.2.2" diff --git a/0C_virtual_memory/raspi3_boot/src/lib.rs b/0C_virtual_memory/raspi3_boot/src/lib.rs index ccfc6370..d5ce1ae8 100644 --- a/0C_virtual_memory/raspi3_boot/src/lib.rs +++ b/0C_virtual_memory/raspi3_boot/src/lib.rs @@ -29,9 +29,7 @@ //! Low-level boot of the Raspberry's processor -extern crate cortex_a; extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/0C_virtual_memory/src/gpio.rs b/0C_virtual_memory/src/gpio.rs index 3ff0c1e9..da6a5be4 100644 --- a/0C_virtual_memory/src/gpio.rs +++ b/0C_virtual_memory/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/0C_virtual_memory/src/main.rs b/0C_virtual_memory/src/main.rs index 6378ebe7..741cf4b2 100644 --- a/0C_virtual_memory/src/main.rs +++ b/0C_virtual_memory/src/main.rs @@ -27,14 +27,6 @@ #![feature(asm)] #![feature(const_fn)] -extern crate cortex_a; - -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; mod gpio; @@ -42,7 +34,7 @@ mod mbox; mod mmu; mod uart; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/0C_virtual_memory/src/mbox.rs b/0C_virtual_memory/src/mbox.rs index 18fe5787..aeae88bb 100644 --- a/0C_virtual_memory/src/mbox.rs +++ b/0C_virtual_memory/src/mbox.rs @@ -25,7 +25,10 @@ use super::MMIO_BASE; use core::ops; use cortex_a::asm; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/0C_virtual_memory/src/mmu.rs b/0C_virtual_memory/src/mmu.rs index 8acdaa14..5282420f 100644 --- a/0C_virtual_memory/src/mmu.rs +++ b/0C_virtual_memory/src/mmu.rs @@ -24,6 +24,7 @@ use super::uart; use cortex_a::{barrier, regs::*}; +use register::register_bitfields; /// Parse the ID_AA64MMFR0_EL1 register for runtime information about supported /// MMU features. @@ -130,7 +131,8 @@ pub unsafe fn init() { let lvl3_base: u64 = SINGLE_LVL3_TABLE.base_addr() >> 12; LVL2_TABLE[0] = (STAGE1_DESCRIPTOR::VALID::True + STAGE1_DESCRIPTOR::TYPE::Table - + STAGE1_DESCRIPTOR::NEXT_LVL_TABLE_ADDR_4KiB.val(lvl3_base)).value; + + STAGE1_DESCRIPTOR::NEXT_LVL_TABLE_ADDR_4KiB.val(lvl3_base)) + .value; // For educational purposes and fun, let the start of the second 2 MiB block // point to the 2 MiB aperture which contains the UART's base address. diff --git a/0C_virtual_memory/src/uart.rs b/0C_virtual_memory/src/uart.rs index cf8739ef..492b3b78 100644 --- a/0C_virtual_memory/src/uart.rs +++ b/0C_virtual_memory/src/uart.rs @@ -23,14 +23,14 @@ */ use super::MMIO_BASE; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; use cortex_a::asm; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. // diff --git a/0D_cache_performance/Cargo.lock b/0D_cache_performance/Cargo.lock index cd6dccb9..16ef5e23 100644 --- a/0D_cache_performance/Cargo.lock +++ b/0D_cache_performance/Cargo.lock @@ -1,18 +1,18 @@ [[package]] name = "cortex-a" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel8" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "raspi3_boot 0.1.0", - "register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,27 +29,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "raspi3_boot" version = "0.1.0" dependencies = [ - "cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "register" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tock-registers" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum cortex-a 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe913628f34718bc9e7d0d07e13ca1374638f64f0edc6eb063ec8abe581d395d" +"checksum cortex-a 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12425c4491f31f28f539c74382ade69ee9db4f1f597aa177f43e072595562e46" "checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157a11ac0b1882ff4a527a92f911dd288df17367faaaa0c36f188cd61ec36fc1" -"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" +"checksum register 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0f44a6dc9a98359515541a0c46ef4e3630a30879c1d7a4038f31dd533570bfb" +"checksum tock-registers 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c758f5195a2e0df9d9fecf6f506506b2766ff74cf64db1e995c87e2761a5c3e2" diff --git a/0D_cache_performance/Cargo.toml b/0D_cache_performance/Cargo.toml index b7f40114..bc742cac 100644 --- a/0D_cache_performance/Cargo.toml +++ b/0D_cache_performance/Cargo.toml @@ -2,11 +2,12 @@ name = "kernel8" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] raspi3_boot = { path = "raspi3_boot" } -cortex-a = "2.2.1" -register = "0.2.0" +cortex-a = "2.3.1" +register = "0.3.2" [package.metadata.cargo-xbuild] sysroot_path = "../xbuild_sysroot" diff --git a/0D_cache_performance/kernel8 b/0D_cache_performance/kernel8 index 5d70db03..3f0fed00 100755 Binary files a/0D_cache_performance/kernel8 and b/0D_cache_performance/kernel8 differ diff --git a/0D_cache_performance/kernel8.img b/0D_cache_performance/kernel8.img index 3e9be258..05fdca45 100755 Binary files a/0D_cache_performance/kernel8.img and b/0D_cache_performance/kernel8.img differ diff --git a/0D_cache_performance/raspi3_boot/Cargo.toml b/0D_cache_performance/raspi3_boot/Cargo.toml index cd382ba4..09732955 100644 --- a/0D_cache_performance/raspi3_boot/Cargo.toml +++ b/0D_cache_performance/raspi3_boot/Cargo.toml @@ -2,8 +2,9 @@ name = "raspi3_boot" version = "0.1.0" authors = ["Andre Richter "] +edition = "2018" [dependencies] -cortex-a = "2.2.1" +cortex-a = "2.3.1" panic-abort = "0.3.1" r0 = "0.2.2" diff --git a/0D_cache_performance/raspi3_boot/src/lib.rs b/0D_cache_performance/raspi3_boot/src/lib.rs index ccfc6370..d5ce1ae8 100644 --- a/0D_cache_performance/raspi3_boot/src/lib.rs +++ b/0D_cache_performance/raspi3_boot/src/lib.rs @@ -29,9 +29,7 @@ //! Low-level boot of the Raspberry's processor -extern crate cortex_a; extern crate panic_abort; -extern crate r0; #[macro_export] macro_rules! entry { diff --git a/0D_cache_performance/src/benchmark.rs b/0D_cache_performance/src/benchmark.rs index d8bf9ebc..c63b343b 100644 --- a/0D_cache_performance/src/benchmark.rs +++ b/0D_cache_performance/src/benchmark.rs @@ -1,6 +1,6 @@ +use super::uart; use core::sync::atomic::{compiler_fence, Ordering}; use cortex_a::{barrier, regs::*}; -use super::uart; /// We assume that addr is cacheline aligned fn batch_modify_time(addr: u64) -> Option { @@ -63,7 +63,7 @@ pub fn run(uart: &uart::Uart) { uart.dec(t as u32); uart.puts(" miliseconds.\n\n"); t - }, + } None => { uart.puts(ERROR_STRING); return; @@ -81,7 +81,7 @@ pub fn run(uart: &uart::Uart) { uart.dec(t as u32); uart.puts(" miliseconds.\n\n"); t - }, + } None => { uart.puts(ERROR_STRING); return; diff --git a/0D_cache_performance/src/gpio.rs b/0D_cache_performance/src/gpio.rs index 3ff0c1e9..da6a5be4 100644 --- a/0D_cache_performance/src/gpio.rs +++ b/0D_cache_performance/src/gpio.rs @@ -23,7 +23,7 @@ */ use super::MMIO_BASE; -use register::mmio::ReadWrite; +use register::{mmio::ReadWrite, register_bitfields}; // Descriptions taken from // https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf diff --git a/0D_cache_performance/src/main.rs b/0D_cache_performance/src/main.rs index 44849984..112e1b69 100644 --- a/0D_cache_performance/src/main.rs +++ b/0D_cache_performance/src/main.rs @@ -27,23 +27,15 @@ #![feature(asm)] #![feature(const_fn)] -extern crate cortex_a; - -#[macro_use] -extern crate raspi3_boot; - -#[macro_use] -extern crate register; - const MMIO_BASE: u32 = 0x3F00_0000; +mod benchmark; mod gpio; mod mbox; mod mmu; mod uart; -mod benchmark; -entry!(kernel_entry); +raspi3_boot::entry!(kernel_entry); fn kernel_entry() -> ! { let mut mbox = mbox::Mbox::new(); diff --git a/0D_cache_performance/src/mbox.rs b/0D_cache_performance/src/mbox.rs index 18fe5787..aeae88bb 100644 --- a/0D_cache_performance/src/mbox.rs +++ b/0D_cache_performance/src/mbox.rs @@ -25,7 +25,10 @@ use super::MMIO_BASE; use core::ops; use cortex_a::asm; -use register::mmio::{ReadOnly, WriteOnly}; +use register::{ + mmio::{ReadOnly, WriteOnly}, + register_bitfields, +}; register_bitfields! { u32, diff --git a/0D_cache_performance/src/mmu.rs b/0D_cache_performance/src/mmu.rs index 04eeb89e..996b8edf 100644 --- a/0D_cache_performance/src/mmu.rs +++ b/0D_cache_performance/src/mmu.rs @@ -23,6 +23,7 @@ */ use cortex_a::{barrier, regs::*}; +use register::register_bitfields; register_bitfields! {u64, // AArch64 Reference Manual page 2150 diff --git a/0D_cache_performance/src/uart.rs b/0D_cache_performance/src/uart.rs index efdafc7b..b8e160e7 100644 --- a/0D_cache_performance/src/uart.rs +++ b/0D_cache_performance/src/uart.rs @@ -23,14 +23,14 @@ */ use super::MMIO_BASE; +use crate::gpio; +use crate::mbox; use core::{ ops, sync::atomic::{compiler_fence, Ordering}, }; use cortex_a::asm; -use gpio; -use mbox; -use register::mmio::*; +use register::{mmio::*, register_bitfields}; // PL011 UART registers. //