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 = [
"-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"

2
Cargo.lock generated
View File

@ -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",
]

View File

@ -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

View File

@ -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,

View File

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

View File

@ -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
'';

View File

@ -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"));

View File

@ -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<const N: usize>(_: [(); 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))

View File

@ -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",
];

View File

@ -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;

View File

@ -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'"