WIP successful build wit updated Rust toolchain

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2023-02-08 12:45:35 +08:00
parent f887219db1
commit e78460ecf6
11 changed files with 13 additions and 47 deletions

View File

@ -1,9 +1,9 @@
[target.armv7-none-eabihf] [target.armv7a-none-eabihf]
rustflags = [ rustflags = [
"-C", "link-arg=-Tlink.x", "-C", "link-arg=-Tlink.x",
"-C", "target-feature=a9,armv7-a,neon", "-C", "target-feature=+neon",
"-C", "target-cpu=cortex-a9", "-C", "target-cpu=cortex-a9",
] ]
[build] [build]
target = "armv7-none-eabihf.json" target = "armv7a-none-eabihf.json"

2
Cargo.lock generated
View File

@ -41,7 +41,7 @@ checksum = "13e81c6cd7ab79f51a0c927d22858d61ad12bd0b3865f0b13ece02a4486aeabb"
[[package]] [[package]]
name = "core_io" name = "core_io"
version = "0.1.20221029" 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 = [ dependencies = [
"rustc_version", "rustc_version",
] ]

View File

@ -35,7 +35,7 @@ nix develop
cargo xbuild --release -p experiments 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 ## Debug

View File

@ -1,12 +1,4 @@
{ {
"abi-blacklist": [
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"win64",
"sysv64"
],
"arch": "arm", "arch": "arm",
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
"emit-debug-gdb-scripts": false, "emit-debug-gdb-scripts": false,

View File

@ -1,8 +1,5 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
//#![feature(const_in_array_repeat_expressions)]
//#![feature(naked_functions)]
//#![feature(asm)]
extern crate alloc; extern crate alloc;

View File

@ -234,7 +234,7 @@
installPhase = '' installPhase = ''
mkdir -p $out $out/nix-support 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 echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products
''; '';

View File

@ -1,6 +1,5 @@
#![no_std] #![no_std]
#![feature(never_type)] #![feature(never_type)]
//#![feature(const_fn)]
extern crate alloc; extern crate alloc;
@ -16,7 +15,7 @@ pub mod sync_channel;
mod uncached; mod uncached;
pub use fpu::enable_fpu; pub use fpu::enable_fpu;
pub use uncached::UncachedSlice; pub use uncached::UncachedSlice;
use core::arch::{global_asm, asm}; use core::arch::global_asm;
global_asm!(include_str!("exceptions.s")); global_asm!(include_str!("exceptions.s"));

View File

@ -37,7 +37,7 @@ impl<'a, T> Sender<'a, T> where T: Clone {
notify_spin_lock(); notify_spin_lock();
if !prev.is_null() { if !prev.is_null() {
unsafe { unsafe {
Box::from_raw(prev); let _ = Box::from_raw(prev);
} }
} }
Ok(()) Ok(())
@ -91,7 +91,7 @@ impl<'a, T> Sender<'a, T> where T: Clone {
for v in self.list.iter() { for v in self.list.iter() {
let original = v.swap(core::ptr::null_mut(), Ordering::Relaxed); let original = v.swap(core::ptr::null_mut(), Ordering::Relaxed);
if !original.is_null() { 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<const N: usize>(_: [(); N]) -> usize { N }
#[macro_export] #[macro_export]
/// Macro for initializing the sync_channel with static buffer and indexes. /// 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 { macro_rules! sync_channel {
($t: ty, $cap: expr) => { ($t: ty, $cap: expr) => {
{ {
// TODO remove const_in_array_repeat_expressions
use core::sync::atomic::{AtomicUsize, AtomicPtr}; use core::sync::atomic::{AtomicUsize, AtomicPtr};
use core::mem::MaybeUninit; use core::mem::MaybeUninit;
use $crate::sync_channel::{Sender, Receiver}; use $crate::sync_channel::{Sender, Receiver};
static LIST: [AtomicPtr<$t>; $cap + 1] = [ const ATOMIC_NULL: AtomicPtr<$t> = AtomicPtr::new(core::ptr::null_mut());
AtomicPtr::new(core::ptr::null_mut()), static LIST: [AtomicPtr<$t>; $cap + 1] = [ATOMIC_NULL; $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())];
static WRITE: AtomicUsize = AtomicUsize::new(0); static WRITE: AtomicUsize = AtomicUsize::new(0);
static READ: AtomicUsize = AtomicUsize::new(0); static READ: AtomicUsize = AtomicUsize::new(0);
(Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ)) (Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ))

View File

@ -10,7 +10,7 @@ fn compile_memcpy() {
cfg.compiler("clang"); cfg.compiler("clang");
cfg.no_default_flags(true); cfg.no_default_flags(true);
cfg.warnings(false); cfg.warnings(false);
cfg.flag("--target=armv7-none-eabihf"); cfg.flag("--target=armv7a-none-eabihf");
let sources = vec![ let sources = vec![
"memcpy.S", "memcpy.S",
]; ];

View File

@ -2,8 +2,6 @@
#![feature(alloc_error_handler)] #![feature(alloc_error_handler)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
//#![feature(naked_functions)]
//#![feature(asm)]
pub extern crate alloc; pub extern crate alloc;
pub extern crate compiler_builtins; pub extern crate compiler_builtins;
@ -13,4 +11,3 @@ mod abort;
#[cfg(feature = "panic_handler")] #[cfg(feature = "panic_handler")]
mod panic; mod panic;
pub mod ram; pub mod ram;

View File

@ -17,5 +17,5 @@ target_folder=/tmp/zynq-\$USER
ssh $target_host "mkdir -p $target_folder" ssh $target_host "mkdir -p $target_folder"
rsync openocd/* $target_host:$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'" ssh $target_host "cd $target_folder; openocd -f zc706.cfg -c 'load_image experiments.elf; resume 0; exit'"