diff --git a/.cargo/config b/.cargo/config index 2b26448..578d12a 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,9 +1,9 @@ -[target.armv7-none-eabihf] +[target.armv7a-none-eabihf] rustflags = [ "-C", "link-arg=-Tlink.x", - "-C", "target-feature=a9,armv7-a,neon", + "-C", "target-feature=+neon", "-C", "target-cpu=cortex-a9", ] [build] -target = "armv7-none-eabihf.json" +target = "armv7a-none-eabihf.json" diff --git a/Cargo.lock b/Cargo.lock index 8aac19a..57434f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,7 +41,7 @@ checksum = "13e81c6cd7ab79f51a0c927d22858d61ad12bd0b3865f0b13ece02a4486aeabb" [[package]] name = "core_io" version = "0.1.20221029" -source = "git+https://github.com/thomasfire/rust-core_io.git#cdaefa2b56c0782364a76945bb3664663fdcfe52" +source = "git+https://github.com/thomasfire/rust-core_io.git#b33eedf99f3c4b417e354aa370858332a00e24e9" dependencies = [ "rustc_version", ] diff --git a/README.md b/README.md index 7a84936..6df3eff 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ nix develop cargo xbuild --release -p experiments ``` -Currently the ELF output is placed at `target/armv7-none-eabi/release/experiments`, or `result/experiments.elf` for Nix Flakes build. +Currently the ELF output is placed at `target/armv7a-none-eabi/release/experiments`, or `result/experiments.elf` for Nix Flakes build. ## Debug diff --git a/armv7-none-eabihf.json b/armv7a-none-eabihf.json similarity index 82% rename from armv7-none-eabihf.json rename to armv7a-none-eabihf.json index 4fc452f..6062f98 100644 --- a/armv7-none-eabihf.json +++ b/armv7a-none-eabihf.json @@ -1,12 +1,4 @@ { - "abi-blacklist": [ - "stdcall", - "fastcall", - "vectorcall", - "thiscall", - "win64", - "sysv64" - ], "arch": "arm", "data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "emit-debug-gdb-scripts": false, diff --git a/experiments/src/main.rs b/experiments/src/main.rs index 59cec7f..f7650d8 100644 --- a/experiments/src/main.rs +++ b/experiments/src/main.rs @@ -1,8 +1,5 @@ #![no_std] #![no_main] -//#![feature(const_in_array_repeat_expressions)] -//#![feature(naked_functions)] -//#![feature(asm)] extern crate alloc; diff --git a/flake.nix b/flake.nix index 675af87..c4b3cc9 100644 --- a/flake.nix +++ b/flake.nix @@ -234,7 +234,7 @@ installPhase = '' mkdir -p $out $out/nix-support - cp target/armv7-none-eabihf/release/${name} $out/${name}.elf + cp target/armv7a-none-eabihf/release/${name} $out/${name}.elf echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products ''; diff --git a/libcortex_a9/src/lib.rs b/libcortex_a9/src/lib.rs index e7bceba..144ef9c 100644 --- a/libcortex_a9/src/lib.rs +++ b/libcortex_a9/src/lib.rs @@ -1,6 +1,5 @@ #![no_std] #![feature(never_type)] -//#![feature(const_fn)] extern crate alloc; @@ -16,7 +15,7 @@ pub mod sync_channel; mod uncached; pub use fpu::enable_fpu; pub use uncached::UncachedSlice; -use core::arch::{global_asm, asm}; +use core::arch::global_asm; global_asm!(include_str!("exceptions.s")); diff --git a/libcortex_a9/src/sync_channel.rs b/libcortex_a9/src/sync_channel.rs index 5da28ec..cf04e6e 100644 --- a/libcortex_a9/src/sync_channel.rs +++ b/libcortex_a9/src/sync_channel.rs @@ -37,7 +37,7 @@ impl<'a, T> Sender<'a, T> where T: Clone { notify_spin_lock(); if !prev.is_null() { unsafe { - Box::from_raw(prev); + let _ = Box::from_raw(prev); } } Ok(()) @@ -91,7 +91,7 @@ impl<'a, T> Sender<'a, T> where T: Clone { for v in self.list.iter() { let original = v.swap(core::ptr::null_mut(), Ordering::Relaxed); if !original.is_null() { - Box::from_raw(original); + let _ = Box::from_raw(original); } } } @@ -170,35 +170,16 @@ impl<'a, T> Iterator for Receiver<'a, T> where T: Clone { } } -macro_rules! count_tts { - () => {}; - ($_head:tt $($tail:tt)*) => {1usize + count_tts!($($tail)*)}; -} - -const fn count_helper(_: [(); N]) -> usize { N } - #[macro_export] /// Macro for initializing the sync_channel with static buffer and indexes. -/// Note that this requires `#![feature(const_in_array_repeat_expressions)]` macro_rules! sync_channel { ($t: ty, $cap: expr) => { { - // TODO remove const_in_array_repeat_expressions use core::sync::atomic::{AtomicUsize, AtomicPtr}; use core::mem::MaybeUninit; use $crate::sync_channel::{Sender, Receiver}; - static LIST: [AtomicPtr<$t>; $cap + 1] = [ - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut()), - AtomicPtr::new(core::ptr::null_mut())]; + const ATOMIC_NULL: AtomicPtr<$t> = AtomicPtr::new(core::ptr::null_mut()); + static LIST: [AtomicPtr<$t>; $cap + 1] = [ATOMIC_NULL; $cap + 1]; static WRITE: AtomicUsize = AtomicUsize::new(0); static READ: AtomicUsize = AtomicUsize::new(0); (Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ)) diff --git a/libsupport_zynq/build.rs b/libsupport_zynq/build.rs index 1bd1739..437ed98 100644 --- a/libsupport_zynq/build.rs +++ b/libsupport_zynq/build.rs @@ -10,7 +10,7 @@ fn compile_memcpy() { cfg.compiler("clang"); cfg.no_default_flags(true); cfg.warnings(false); - cfg.flag("--target=armv7-none-eabihf"); + cfg.flag("--target=armv7a-none-eabihf"); let sources = vec![ "memcpy.S", ]; diff --git a/libsupport_zynq/src/lib.rs b/libsupport_zynq/src/lib.rs index b47d712..6b360d6 100644 --- a/libsupport_zynq/src/lib.rs +++ b/libsupport_zynq/src/lib.rs @@ -2,8 +2,6 @@ #![feature(alloc_error_handler)] #![feature(panic_info_message)] -//#![feature(naked_functions)] -//#![feature(asm)] pub extern crate alloc; pub extern crate compiler_builtins; @@ -13,4 +11,3 @@ mod abort; #[cfg(feature = "panic_handler")] mod panic; pub mod ram; - diff --git a/remote_run.sh b/remote_run.sh index 87fd4e0..85db9e7 100755 --- a/remote_run.sh +++ b/remote_run.sh @@ -17,5 +17,5 @@ target_folder=/tmp/zynq-\$USER ssh $target_host "mkdir -p $target_folder" rsync openocd/* $target_host:$target_folder -rsync target/armv7-none-eabihf/release/experiments $target_host:$target_folder/experiments.elf +rsync target/armv7a-none-eabihf/release/experiments $target_host:$target_folder/experiments.elf ssh $target_host "cd $target_folder; openocd -f zc706.cfg -c 'load_image experiments.elf; resume 0; exit'"