diff --git a/artiq/firmware/libksupport/lib.rs b/artiq/firmware/libksupport/lib.rs index 4248e1a2d..b38ab0808 100644 --- a/artiq/firmware/libksupport/lib.rs +++ b/artiq/firmware/libksupport/lib.rs @@ -112,8 +112,9 @@ macro_rules! println { #[path = "../runtime/rpc_queue.rs"] mod rpc_queue; +#[no_mangle] #[lang = "panic_fmt"] -extern fn panic_fmt(args: core::fmt::Arguments, file: &'static str, line: u32) -> ! { +pub extern fn panic_fmt(args: core::fmt::Arguments, file: &'static str, line: u32) -> ! { println!("panic at {}:{}: {}", file, line, args); send(&RunAborted); loop {} diff --git a/artiq/firmware/libstd_artiq/error.rs b/artiq/firmware/libstd_artiq/error.rs index df1d76b6c..5e4e0ead1 100644 --- a/artiq/firmware/libstd_artiq/error.rs +++ b/artiq/firmware/libstd_artiq/error.rs @@ -49,7 +49,7 @@ use any::TypeId; use boxed::Box; use cell; use fmt::{self, Debug, Display}; -use marker::{Send, Sync, Reflect}; +use marker::{Send, Sync}; use mem::transmute; use num; use core::raw::TraitObject; @@ -57,7 +57,7 @@ use str; use string::{self, String}; /// Base functionality for all errors in Rust. -pub trait Error: Debug + Display + Reflect { +pub trait Error: Debug + Display { /// A short description of the error. /// /// The description should not contain newlines or sentence-ending @@ -258,13 +258,13 @@ impl Error for fmt::Error { } } -impl<'a, T: ?Sized + Reflect> Error for cell::BorrowError<'a, T> { +impl Error for cell::BorrowError { fn description(&self) -> &str { "already mutably borrowed" } } -impl<'a, T: ?Sized + Reflect> Error for cell::BorrowMutError<'a, T> { +impl Error for cell::BorrowMutError { fn description(&self) -> &str { "already borrowed" } diff --git a/artiq/firmware/libstd_artiq/io/mod.rs b/artiq/firmware/libstd_artiq/io/mod.rs index e1ea29969..0159b92a9 100644 --- a/artiq/firmware/libstd_artiq/io/mod.rs +++ b/artiq/firmware/libstd_artiq/io/mod.rs @@ -248,7 +248,7 @@ //! time and may call fewer or more syscalls/library functions. use core::cmp; -use rustc_unicode::str as core_str; +use std_unicode::str as core_str; use core::fmt; use core::iter::{Iterator}; use core::marker::Sized; diff --git a/artiq/firmware/libstd_artiq/lib.rs b/artiq/firmware/libstd_artiq/lib.rs index 648baa61e..22f55ee25 100644 --- a/artiq/firmware/libstd_artiq/lib.rs +++ b/artiq/firmware/libstd_artiq/lib.rs @@ -1,11 +1,10 @@ #![feature(lang_items, asm, alloc, collections, libc, needs_panic_runtime, - question_mark, unicode, reflect_marker, raw, int_error_internals, - try_from, try_borrow, macro_reexport, allow_internal_unstable, - stmt_expr_attributes)] + unicode, raw, int_error_internals, try_from, macro_reexport, + allow_internal_unstable, stmt_expr_attributes)] #![no_std] #![needs_panic_runtime] -extern crate rustc_unicode; +extern crate std_unicode; extern crate alloc_artiq; extern crate alloc; #[macro_use] diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index bce19d2b0..ee0aa7a5b 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -1,6 +1,5 @@ #![no_std] -#![feature(libc, const_fn, try_borrow, stmt_expr_attributes, repr_simd, asm, - lang_items)] +#![feature(libc, const_fn, stmt_expr_attributes, repr_simd, asm, lang_items)] #[macro_use] extern crate std_artiq as std; @@ -46,8 +45,9 @@ pub fn print_fmt(args: self::core::fmt::Arguments) { let _ = Console.write_fmt(args); } +#[no_mangle] #[lang = "panic_fmt"] -extern fn panic_fmt(args: self::core::fmt::Arguments, file: &'static str, line: u32) -> ! { +pub extern fn panic_fmt(args: self::core::fmt::Arguments, file: &'static str, line: u32) -> ! { let _ = write!(Console, "panic at {}:{}: {}\n", file, line, args); let _ = write!(Console, "waiting for debugger...\n"); unsafe { diff --git a/artiq/firmware/runtime/mailbox.rs b/artiq/firmware/runtime/mailbox.rs index 2b1a42cbb..bbf5f302b 100644 --- a/artiq/firmware/runtime/mailbox.rs +++ b/artiq/firmware/runtime/mailbox.rs @@ -2,24 +2,24 @@ use core::ptr::{read_volatile, write_volatile}; use bsp::board; const MAILBOX: *mut usize = board::mem::MAILBOX_BASE as *mut usize; -static mut last: usize = 0; +static mut LAST: usize = 0; pub unsafe fn send(data: usize) { - last = data; + LAST = data; write_volatile(MAILBOX, data) } pub fn acknowledged() -> bool { unsafe { let data = read_volatile(MAILBOX); - data == 0 || data != last + data == 0 || data != LAST } } pub fn receive() -> usize { unsafe { let data = read_volatile(MAILBOX); - if data == last { + if data == LAST { 0 } else { if data != 0 { diff --git a/conda/artiq-kc705-nist_clock/meta.yaml b/conda/artiq-kc705-nist_clock/meta.yaml index bc56bf200..ba3c3d155 100644 --- a/conda/artiq-kc705-nist_clock/meta.yaml +++ b/conda/artiq-kc705-nist_clock/meta.yaml @@ -16,7 +16,7 @@ requirements: - misoc 0.5.dev - llvm-or1k - binutils-or1k-linux >=2.27 - - rust-core-or1k + - rust-core-or1k 1.16.0 11 - cargo run: - artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_DESCRIBE_HASH")[1:]) if "GIT_DESCRIBE_TAG" in environ else "" }} diff --git a/conda/artiq-kc705-nist_qc2/meta.yaml b/conda/artiq-kc705-nist_qc2/meta.yaml index 9a0223a9b..ae0c01e72 100644 --- a/conda/artiq-kc705-nist_qc2/meta.yaml +++ b/conda/artiq-kc705-nist_qc2/meta.yaml @@ -16,7 +16,7 @@ requirements: - misoc 0.5.dev - llvm-or1k - binutils-or1k-linux >=2.27 - - rust-core-or1k + - rust-core-or1k 1.16.0 11 - cargo run: - artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_DESCRIBE_HASH")[1:]) if "GIT_DESCRIBE_TAG" in environ else "" }} diff --git a/conda/artiq-kc705-phaser/meta.yaml b/conda/artiq-kc705-phaser/meta.yaml index e843ec666..219104a4b 100644 --- a/conda/artiq-kc705-phaser/meta.yaml +++ b/conda/artiq-kc705-phaser/meta.yaml @@ -17,7 +17,7 @@ requirements: - jesd204b 0.2 - llvm-or1k - binutils-or1k-linux >=2.27 - - rust-core-or1k + - rust-core-or1k 1.16.0 11 - cargo - numpy run: diff --git a/conda/artiq-pipistrello-demo/meta.yaml b/conda/artiq-pipistrello-demo/meta.yaml index d9975d733..c9d0f09d0 100644 --- a/conda/artiq-pipistrello-demo/meta.yaml +++ b/conda/artiq-pipistrello-demo/meta.yaml @@ -16,7 +16,7 @@ requirements: - misoc 0.5.dev - llvm-or1k - binutils-or1k-linux >=2.27 - - rust-core-or1k + - rust-core-or1k 1.16.0 11 - cargo run: - artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_DESCRIBE_HASH")[1:]) if "GIT_DESCRIBE_TAG" in environ else "" }} diff --git a/doc/manual/installing_from_source.rst b/doc/manual/installing_from_source.rst index 3d5450ce3..5ac2a650a 100644 --- a/doc/manual/installing_from_source.rst +++ b/doc/manual/installing_from_source.rst @@ -61,7 +61,7 @@ and the ARTIQ kernels. * Install Rust: :: $ cd ~/artiq-dev - $ git clone https://github.com/m-labs/rust + $ git clone -b artiq-1.16.0 https://github.com/m-labs/rust $ cd rust $ git checkout artiq $ git submodule update --init @@ -70,7 +70,7 @@ and the ARTIQ kernels. $ ../configure --prefix=/usr/local/rust-or1k --llvm-root=/usr/local/llvm-or1k --disable-manage-submodules $ sudo make install -j4 - $ libs="libcore liballoc librustc_unicode libcollections liblibc_mini libunwind" + $ libs="libcore liballoc libstd_unicode libcollections liblibc_mini libunwind" $ rustc="/usr/local/rust-or1k/bin/rustc --target or1k-unknown-none -g -C target-feature=+mul,+div,+ffl1,+cmov,+addc -C opt-level=s -L ." $ destdir="/usr/local/rust-or1k/lib/rustlib/or1k-unknown-none/lib/" $ mkdir ../build-or1k