diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8839654..64f778f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,17 +10,21 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@master + + - name: Install Qemu + uses: ConorMacBride/install-package@v1 + with: + apt: qemu-system + + - name: Install Rust + uses: dtolnay/rust-toolchain@master with: toolchain: nightly targets: riscv64imac-unknown-none-elf components: clippy - - uses: ConorMacBride/install-package@v1 - with: - apt: qemu-system - - name: Clippy - run: cargo clippy - - name: Build - run: cargo build --verbose - - name: Test - run: cargo test + + - name: Install cargo-make + run: cargo install cargo-make + + - name: Run CI Flow + run: cargo make ci-flow diff --git a/.gitignore b/.gitignore index ea8c4bf..f419dc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +/.idea /target diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/compilerexplorer.settings.xml b/.idea/compilerexplorer.settings.xml deleted file mode 100644 index e310928..0000000 --- a/.idea/compilerexplorer.settings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml deleted file mode 100644 index d23208f..0000000 --- a/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/rust.xml b/.idea/rust.xml deleted file mode 100644 index 7bc91ea..0000000 --- a/.idea/rust.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/tiny_os.iml b/.idea/tiny_os.iml index 39b884e..7a189db 100644 --- a/.idea/tiny_os.iml +++ b/.idea/tiny_os.iml @@ -1,9 +1,9 @@ - + - + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 8306744..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,6 +2,5 @@ - \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index 47c7f15..0000000 --- a/Cargo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[workspace] -resolver = "2" -members = ["kernel"] diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 0000000..44fa43a --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,18 @@ +[env] +CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true +CARGO_MAKE_WORKSPACE_EMULATION = true +CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = [ + "kernel" +] + +[tasks.clipppy] +install_crate = "clippy" +command = "cargo" +args = ["clippy"] +dependencies = ["fmt"] + +[tasks.build] +args = ["build"] + +[tasks.test] +args = ["test"] diff --git a/kernel/.gitignore b/kernel/.gitignore new file mode 100644 index 0000000..f419dc7 --- /dev/null +++ b/kernel/.gitignore @@ -0,0 +1,2 @@ +/.idea +/target diff --git a/Cargo.lock b/kernel/Cargo.lock similarity index 93% rename from Cargo.lock rename to kernel/Cargo.lock index c13ef1a..996a56a 100644 --- a/Cargo.lock +++ b/kernel/Cargo.lock @@ -26,6 +26,12 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "critical-section" version = "1.1.2" @@ -42,14 +48,15 @@ checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" name = "kernel" version = "0.1.0" dependencies = [ - "bitflags 2.4.2", - "lazy_static", - "log", - "riscv", - "sbi-rt", - "spin 0.9.8", - "static_assertions", - "uart_16550", + "bitflags 2.4.2", + "cfg-if", + "lazy_static", + "log", + "riscv", + "sbi-rt", + "spin 0.9.8", + "static_assertions", + "uart_16550", ] [[package]] diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 878adfa..778e73c 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -13,7 +13,6 @@ arch_riscv32 = [] board_default = [] board_virt = [] -board_thead = [] log_color = [] @@ -25,9 +24,10 @@ panic = "abort" [profile.release] panic = "abort" +lto = "thin" [dependencies] -bitflags = "2.4.1" +bitflags = "2.4.2" lazy_static = { version = "1.4.0", features = ["spin_no_std"] } log = "0.4" riscv = { version = "0.11.1", features = ["s-mode"] } @@ -35,3 +35,4 @@ sbi-rt = { version = "0.0.3", features = ["legacy"] } spin = "0.9.8" static_assertions = "1.1.0" uart_16550 = "0.3" +cfg-if = "1.0.0" diff --git a/kernel/build.rs b/kernel/build.rs index 14b049a..c0ba1f6 100644 --- a/kernel/build.rs +++ b/kernel/build.rs @@ -9,11 +9,11 @@ fn main() { const TARGET_LDS: &[TargetConfig] = &[ TargetConfig { target: "riscv64", - lds: "kernel/src/arch/riscv/linker.ld", + lds: "src/arch/riscv/linker.ld", }, TargetConfig { target: "riscv32", - lds: "kernel/src/arch/riscv/linker.ld", + lds: "src/arch/riscv/linker.ld", }, ];