From 2f27315d13d45a6fea7cb1e661d0b8772d931edb Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Tue, 8 Oct 2024 17:51:31 +0800 Subject: [PATCH] fix errors --- flake.lock | 35 ++++++++++---------- flake.nix | 2 +- src/Cargo.lock | 57 +++++++++++---------------------- src/libboard_artiq/src/fiq.rs | 1 + src/libksupport/Cargo.toml.tpl | 7 +--- src/libksupport/src/eh_artiq.rs | 12 +++---- src/libksupport/src/irq.rs | 2 +- src/libksupport/src/lib.rs | 4 +-- src/libunwind/lib.rs | 17 ---------- src/libunwind/libunwind.rs | 9 ++---- src/runtime/src/panic.rs | 4 +-- 11 files changed, 53 insertions(+), 97 deletions(-) diff --git a/flake.lock b/flake.lock index f52fff5..2fba0c6 100644 --- a/flake.lock +++ b/flake.lock @@ -11,11 +11,11 @@ "src-pythonparser": "src-pythonparser" }, "locked": { - "lastModified": 1728269744, - "narHash": "sha256-GpVK5qyEnqcVDApRwD5wP3TlLVYj37XRJpN3KGb4mjU=", + "lastModified": 1728372028, + "narHash": "sha256-2JoOKhz75eWZ5YV9830ZP9Hh+EvHhTBjy/mbq7g7HsU=", "ref": "refs/heads/master", - "rev": "049ef9022016f05119454335972d328b9e3ca539", - "revCount": 9022, + "rev": "cdcaee80d1cefd66388f860064084e6341dc0642", + "revCount": 9024, "type": "git", "url": "https://github.com/m-labs/artiq.git" }, @@ -102,11 +102,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727348695, - "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", + "lastModified": 1728241625, + "narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", + "rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1", "type": "github" }, "original": { @@ -153,11 +153,11 @@ ] }, "locked": { - "lastModified": 1724921939, - "narHash": "sha256-/S5iip1LHLiCP2VY7PwClDteP9ZMRZvzzKR1LZuV3fs=", + "lastModified": 1728371104, + "narHash": "sha256-PPnAyDedUQ7Og/Cby9x5OT9wMkNGTP8GS53V6N/dk4w=", "owner": "m-labs", "repo": "sipyco", - "rev": "32ddd78ff3641b75054793ea0d5681c951766754", + "rev": "094a6cd63ffa980ef63698920170e50dc9ba77fd", "type": "github" }, "original": { @@ -240,17 +240,18 @@ ] }, "locked": { - "lastModified": 1728110308, - "narHash": "sha256-MAoFbcDgr+ZjptFCWfthK+tTnR1NcfuO6tvYhNM2Pwo=", - "ref": "refs/heads/master", - "rev": "cc20478d91e30e1448a4304df7003caed2981b71", - "revCount": 651, + "lastModified": 1728375081, + "narHash": "sha256-3D/IOUFaOLRe7raiVrrK6tMl8IHyjAxVJ2dOkkpS4EQ=", + "ref": "bump_to_latest", + "rev": "d76f6fee0e046e11e1b8868a6c5657810f39fe51", + "revCount": 673, "type": "git", - "url": "https://git.m-labs.hk/m-labs/zynq-rs" + "url": "https://git.m-labs.hk/srenblad/zynq-rs/" }, "original": { + "ref": "bump_to_latest", "type": "git", - "url": "https://git.m-labs.hk/m-labs/zynq-rs" + "url": "https://git.m-labs.hk/srenblad/zynq-rs/" } } }, diff --git a/flake.nix b/flake.nix index 8cba76d..8edb043 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs.artiq.url = git+https://github.com/m-labs/artiq.git; inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; }; - inputs.zynq-rs.url = git+https://git.m-labs.hk/m-labs/zynq-rs; + inputs.zynq-rs.url = git+https://git.m-labs.hk/srenblad/zynq-rs/?ref=bump_to_latest; inputs.zynq-rs.inputs.nixpkgs.follows = "artiq/nixpkgs"; outputs = { self, mozilla-overlay, zynq-rs, artiq }: diff --git a/src/Cargo.lock b/src/Cargo.lock index 835eca0..6347f22 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -46,6 +46,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + [[package]] name = "build_const" version = "0.2.2" @@ -82,18 +88,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "compiler_builtins" -version = "0.1.39" +version = "0.1.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3748f82c7d366a0b4950257d19db685d4958d2fa27c6d164a3f069fec42b748b" - -[[package]] -name = "core_io" -version = "0.1.20210325" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97f8932064288cc79feb4d343a399d353a6f6f001e586ece47fe518a9e8507df" -dependencies = [ - "rustc_version", -] +checksum = "f11973008a8cf741fe6d22f339eba21fd0ca81e2760a769ba8243ed6c21edd7e" [[package]] name = "crc" @@ -141,13 +138,10 @@ dependencies = [ [[package]] name = "fatfs" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e18f80a87439240dac45d927fd8f8081b6f1e34c03e97271189fa8a8c2e96c8f" +version = "0.4.0" +source = "git+https://github.com/rafalh/rust-fatfs?rev=85f06e0#85f06e08edbd3368e1b0562f2fc1b6d178bf7b8a" dependencies = [ - "bitflags", - "byteorder", - "core_io", + "bitflags 2.6.0", "log", ] @@ -319,7 +313,6 @@ dependencies = [ name = "libconfig" version = "0.1.0" dependencies = [ - "core_io", "fatfs", "libboard_zynq", "log", @@ -391,8 +384,9 @@ checksum = "c75de51135344a4f8ed3cfe2720dc27736f7711989703a0b43aadf3753c55577" [[package]] name = "nalgebra" -version = "0.32.6" -source = "git+https://git.m-labs.hk/M-Labs/nalgebra.git?rev=dd00f9b#dd00f9b46046e0b931d1b470166db02fd29591be" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c4b5f057b303842cf3262c27e465f4c303572e7f6b0648f60e16248ac3397f4" dependencies = [ "approx", "num-complex", @@ -541,15 +535,6 @@ dependencies = [ "void", ] -[[package]] -name = "rustc_version" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" -dependencies = [ - "semver", -] - [[package]] name = "satman" version = "0.0.0" @@ -571,17 +556,11 @@ dependencies = [ "unwind", ] -[[package]] -name = "semver" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" - [[package]] name = "simba" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50582927ed6f77e4ac020c057f37a268fc6aebc29225050365aacbb9deeeddc4" +checksum = "b3a386a501cd104797982c15ae17aafe8b9261315b5d07e3ec803f2ea26be0fa" dependencies = [ "approx", "num-complex", @@ -595,7 +574,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e4a069bef843d170df47e7c0a8bf8d037f217d9f5b325865acc3e466ffe40d3" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "managed", ] @@ -617,7 +596,7 @@ version = "0.1.8" source = "git+https://git.m-labs.hk/M-Labs/tar-no-std?rev=2ab6dc5#2ab6dc58e5249c59c4eb03eaf3a119bcdd678d32" dependencies = [ "arrayvec", - "bitflags", + "bitflags 1.3.2", "log", ] diff --git a/src/libboard_artiq/src/fiq.rs b/src/libboard_artiq/src/fiq.rs index dc9c013..1c85b06 100644 --- a/src/libboard_artiq/src/fiq.rs +++ b/src/libboard_artiq/src/fiq.rs @@ -1,5 +1,6 @@ use libboard_zynq::{println, stdio}; use libcortex_a9::{interrupt_handler, regs::MPIDR}; +use core::arch::asm; use libregister::RegisterR; #[cfg(has_si549)] diff --git a/src/libksupport/Cargo.toml.tpl b/src/libksupport/Cargo.toml.tpl index e06c1c9..0738154 100644 --- a/src/libksupport/Cargo.toml.tpl +++ b/src/libksupport/Cargo.toml.tpl @@ -17,6 +17,7 @@ void = { version = "1", default-features = false } log_buffer = { version = "1.2" } libm = { version = "0.2", features = ["unstable"] } vcell = "0.1" +nalgebra = { version = "0.33.0", default-features = false, features = ["libm", "alloc"]} libboard_zynq = { path = "@@ZYNQ_RS@@/libboard_zynq", features = ["ipv6"]} libsupport_zynq = { path = "@@ZYNQ_RS@@/libsupport_zynq", default-features = false, features = ["alloc_core"] } @@ -31,9 +32,3 @@ unwind = { path = "../libunwind" } libc = { path = "../libc" } io = { path = "../libio" } libboard_artiq = { path = "../libboard_artiq" } - -[dependencies.nalgebra] -git = "https://git.m-labs.hk/M-Labs/nalgebra.git" -rev = "dd00f9b" -default-features = false -features = ["libm", "alloc"] diff --git a/src/libksupport/src/eh_artiq.rs b/src/libksupport/src/eh_artiq.rs index 4741c5e..c06f56e 100644 --- a/src/libksupport/src/eh_artiq.rs +++ b/src/libksupport/src/eh_artiq.rs @@ -95,30 +95,30 @@ struct ExceptionBuffer { } static mut EXCEPTION_BUFFER: ExceptionBuffer = ExceptionBuffer { - uw_exceptions: [uw::_Unwind_Exception { + uw_exceptions: [ const { uw::_Unwind_Exception { exception_class: EXCEPTION_CLASS, exception_cleanup: cleanup, private: [0; uw::unwinder_private_data_size], - }; MAX_INFLIGHT_EXCEPTIONS], + } }; MAX_INFLIGHT_EXCEPTIONS], exceptions: [None; MAX_INFLIGHT_EXCEPTIONS + 1], exception_stack: [-1; MAX_INFLIGHT_EXCEPTIONS + 1], backtrace: [(0, 0); MAX_BACKTRACE_SIZE], backtrace_size: 0, - stack_pointers: [StackPointerBacktrace { + stack_pointers: [ const { StackPointerBacktrace { stack_pointer: 0, initial_backtrace_size: 0, current_backtrace_size: 0, - }; MAX_INFLIGHT_EXCEPTIONS + 1], + } }; MAX_INFLIGHT_EXCEPTIONS + 1], exception_count: 0, }; pub unsafe extern "C" fn reset_exception_buffer() { trace!("reset exception buffer"); - EXCEPTION_BUFFER.uw_exceptions = [uw::_Unwind_Exception { + EXCEPTION_BUFFER.uw_exceptions = [ const { uw::_Unwind_Exception { exception_class: EXCEPTION_CLASS, exception_cleanup: cleanup, private: [0; uw::unwinder_private_data_size], - }; MAX_INFLIGHT_EXCEPTIONS]; + } }; MAX_INFLIGHT_EXCEPTIONS]; EXCEPTION_BUFFER.exceptions = [None; MAX_INFLIGHT_EXCEPTIONS + 1]; EXCEPTION_BUFFER.exception_stack = [-1; MAX_INFLIGHT_EXCEPTIONS + 1]; EXCEPTION_BUFFER.backtrace_size = 0; diff --git a/src/libksupport/src/irq.rs b/src/libksupport/src/irq.rs index a18feb9..b21afef 100644 --- a/src/libksupport/src/irq.rs +++ b/src/libksupport/src/irq.rs @@ -1,5 +1,5 @@ use core::sync::atomic::{AtomicBool, Ordering}; - +use core::arch::asm; use libboard_zynq::{gic, mpcore, println, stdio}; use libcortex_a9::{asm, interrupt_handler, notify_spin_lock, regs::MPIDR, spin_lock_yield}; use libregister::RegisterR; diff --git a/src/libksupport/src/lib.rs b/src/libksupport/src/lib.rs index 630f19e..34057d0 100644 --- a/src/libksupport/src/lib.rs +++ b/src/libksupport/src/lib.rs @@ -1,7 +1,7 @@ #![no_std] #![feature(c_variadic)] -#![feature(const_btree_new)] -#![feature(const_in_array_repeat_expressions)] +#![feature(const_btree_len)] +#![feature(generic_const_exprs)] #![feature(naked_functions)] #![feature(asm)] diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs index 34ae38d..80ec618 100644 --- a/src/libunwind/lib.rs +++ b/src/libunwind/lib.rs @@ -1,8 +1,5 @@ #![no_std] #![feature(link_cfg)] -#![feature(nll)] -#![feature(unwind_attributes)] -#![feature(static_nobundle)] #![cfg_attr(not(target_env = "msvc"), feature(libc))] cfg_if::cfg_if! { @@ -17,17 +14,3 @@ cfg_if::cfg_if! { pub use backtrace::backtrace; } } - -#[cfg(target_env = "musl")] -#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))] -#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))] -extern "C" {} - -#[cfg(target_os = "redox")] -#[link(name = "gcc_eh", kind = "static-nobundle", cfg(target_feature = "crt-static"))] -#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))] -extern "C" {} - -#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] -#[link(name = "unwind", kind = "static-nobundle")] -extern "C" {} diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs index 0f0e457..4ec0626 100644 --- a/src/libunwind/libunwind.rs +++ b/src/libunwind/libunwind.rs @@ -77,8 +77,7 @@ pub type _Unwind_Exception_Cleanup_Fn = all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")), link(name = "unwind", kind = "static") )] -extern "C" { - #[unwind(allowed)] +extern "C-unwind" { pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !; pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception); pub fn _Unwind_GetLanguageSpecificData(ctx: *mut _Unwind_Context) -> *mut c_void; @@ -226,8 +225,7 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { #[cfg_attr(all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")), link(name = "unwind", kind = "static"))] - extern "C" { - #[unwind(allowed)] + extern "C-unwind" { pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code; pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn, trace_argument: *mut c_void) @@ -238,8 +236,7 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { #[cfg_attr(all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")), link(name = "unwind", kind = "static"))] - extern "C" { - #[unwind(allowed)] + extern "C-unwind" { pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code; } diff --git a/src/runtime/src/panic.rs b/src/runtime/src/panic.rs index 7ec2a21..c0bf1ad 100644 --- a/src/runtime/src/panic.rs +++ b/src/runtime/src/panic.rs @@ -22,7 +22,7 @@ fn panic(info: &core::panic::PanicInfo) -> ! { } else { print!("unknown location"); } - if let Some(message) = info.message() { + if let Some(message) = info.message().as_str() { println!(": {}", message); } else { println!(""); @@ -61,7 +61,7 @@ fn soft_panic(info: &core::panic::PanicInfo) -> ! { } else { error!("panic at unknown location"); } - if let Some(message) = info.message() { + if let Some(message) = info.message().as_str() { error!("panic message: {}", message); } let timer = GlobalTimer::start();