forked from M-Labs/artiq
1
0
Fork 0

firmware use Rust 0.18.0.

This commit is contained in:
whitequark 2017-04-19 09:38:24 +00:00
parent fe05aede78
commit db494967c5
10 changed files with 28 additions and 13 deletions

View File

@ -81,6 +81,13 @@ pub extern fn __rust_allocate(mut size: usize, align: usize) -> *mut u8 {
ptr::null_mut() ptr::null_mut()
} }
#[no_mangle]
pub extern fn __rust_allocate_zeroed(size: usize, align: usize) -> *mut u8 {
let ptr = __rust_allocate(size, align);
unsafe { ptr::write_bytes(ptr, 0, size); }
ptr
}
#[no_mangle] #[no_mangle]
pub extern fn __rust_deallocate(ptr: *mut u8, _old_size: usize, _align: usize) { pub extern fn __rust_deallocate(ptr: *mut u8, _old_size: usize, _align: usize) {
unsafe { unsafe {

View File

@ -7,6 +7,11 @@ pub extern "C" fn __rust_allocate(_size: usize, _align: usize) -> *mut u8 {
unimplemented!() unimplemented!()
} }
#[no_mangle]
pub extern fn __rust_allocate_zeroed(_size: usize, _align: usize) -> *mut u8 {
unimplemented!()
}
#[no_mangle] #[no_mangle]
pub extern "C" fn __rust_deallocate(_ptr: *mut u8, _old_size: usize, _align: usize) { pub extern "C" fn __rust_deallocate(_ptr: *mut u8, _old_size: usize, _align: usize) {
unimplemented!() unimplemented!()

View File

@ -2,8 +2,6 @@
#[macro_use] #[macro_use]
extern crate std_artiq as std; extern crate std_artiq as std;
#[macro_use]
extern crate log;
extern crate board; extern crate board;
extern crate byteorder; extern crate byteorder;

View File

@ -1,5 +1,5 @@
#![no_std] #![no_std]
#![feature(untagged_unions, ptr_unaligned)] #![feature(untagged_unions)]
use core::{mem, ptr, fmt, slice, str, convert}; use core::{mem, ptr, fmt, slice, str, convert};
use elf::*; use elf::*;

View File

@ -248,7 +248,6 @@
//! time and may call fewer or more syscalls/library functions. //! time and may call fewer or more syscalls/library functions.
use core::cmp; use core::cmp;
use std_unicode::str as core_str;
use core::fmt; use core::fmt;
use core::iter::{Iterator}; use core::iter::{Iterator};
use core::marker::Sized; use core::marker::Sized;
@ -1529,7 +1528,7 @@ impl<R: Read> Iterator for Chars<R> {
Ok(..) => buf[0], Ok(..) => buf[0],
Err(e) => return Some(Err(CharsError::Other(e))), Err(e) => return Some(Err(CharsError::Other(e))),
}; };
let width = core_str::utf8_char_width(first_byte); let width = ::core::str::utf8_char_width(first_byte);
if width == 1 { return Some(Ok(first_byte as char)) } if width == 1 { return Some(Ok(first_byte as char)) }
if width == 0 { return Some(Err(CharsError::NotUtf8)) } if width == 0 { return Some(Err(CharsError::NotUtf8)) }
let mut buf = [first_byte, 0, 0, 0]; let mut buf = [first_byte, 0, 0, 0];

View File

@ -1,6 +1,6 @@
#![feature(lang_items, asm, alloc, collections, needs_panic_runtime, #![feature(lang_items, asm, alloc, collections, needs_panic_runtime,
unicode, raw, int_error_internals, try_from, macro_reexport, unicode, raw, int_error_internals, try_from, macro_reexport,
allow_internal_unstable, stmt_expr_attributes)] allow_internal_unstable, stmt_expr_attributes, str_internals)]
#![no_std] #![no_std]
#![needs_panic_runtime] #![needs_panic_runtime]

View File

@ -1,7 +1,8 @@
#![no_std] #![no_std]
#![feature(compiler_builtins_lib, repr_simd, lang_items, const_fn)] #![feature(compiler_builtins_lib, alloc, oom, repr_simd, lang_items, const_fn)]
extern crate compiler_builtins; extern crate compiler_builtins;
extern crate alloc;
extern crate cslice; extern crate cslice;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -168,6 +169,9 @@ pub extern fn main() -> i32 {
alloc_artiq::seed(&mut _fheap as *mut u8, alloc_artiq::seed(&mut _fheap as *mut u8,
&_eheap as *const u8 as usize - &_fheap as *const u8 as usize); &_eheap as *const u8 as usize - &_fheap as *const u8 as usize);
fn oom() -> ! { panic!("out of memory") }
alloc::oom::set_oom_handler(oom);
static mut LOG_BUFFER: [u8; 65536] = [0; 65536]; static mut LOG_BUFFER: [u8; 65536] = [0; 65536];
logger_artiq::BufferLogger::new(&mut LOG_BUFFER[..]).register(startup); logger_artiq::BufferLogger::new(&mut LOG_BUFFER[..]).register(startup);
0 0

View File

@ -36,7 +36,7 @@ def get_argparser():
parser.add_argument("-t", "--target", metavar="TARGET", parser.add_argument("-t", "--target", metavar="TARGET",
type=str, default="kc705_dds", type=str, default="kc705_dds",
help="Target to build, one of: " help="Target to build, one of: "
"kc705_dds kc705_drtio_satellite") "kc705_dds kc705_drtio_master kc705_drtio_satellite")
parser.add_argument("-c", "--config", metavar="TARGET_CFG", parser.add_argument("-c", "--config", metavar="TARGET_CFG",
type=str, default="openocd-kc705.cfg", type=str, default="openocd-kc705.cfg",
help="OpenOCD configuration file corresponding to the development board") help="OpenOCD configuration file corresponding to the development board")
@ -53,7 +53,7 @@ def main():
args = get_argparser().parse_args() args = get_argparser().parse_args()
init_logger(args) init_logger(args)
if args.target == "kc705_dds": if args.target == "kc705_dds" or args.target == "kc705_drtio_master":
firmware = "runtime" firmware = "runtime"
elif args.target == "kc705_drtio_satellite": elif args.target == "kc705_drtio_satellite":
firmware = "satman" firmware = "satman"

View File

@ -20,7 +20,7 @@ requirements:
- binutils-or1k-linux >=2.27 - binutils-or1k-linux >=2.27
- llvm-or1k - llvm-or1k
- llvmlite-artiq 0.12.0.dev py35_30 - llvmlite-artiq 0.12.0.dev py35_30
- rust-core-or1k 1.17.0 12 - rust-core-or1k 1.18.0 13
- cargo 0.11.0 - cargo 0.11.0
- openocd >=0.10 - openocd >=0.10
- lit - lit

View File

@ -62,7 +62,7 @@ and the ARTIQ kernels.
$ cd ~/artiq-dev $ cd ~/artiq-dev
$ git clone --recursive https://github.com/m-labs/artiq $ git clone --recursive https://github.com/m-labs/artiq
Add ``-b release-X`` to the ``git clone`` command if you are building a stable branch of ARTIQ (the default will fetch the development ``master`` branch). Add ``-b release-X`` to the ``git clone`` command if you are building a stable branch of ARTIQ (the default will fetch the development ``master`` branch).
* Install OpenRISC binutils (or1k-linux-...): :: * Install OpenRISC binutils (or1k-linux-...): ::
@ -99,13 +99,15 @@ and the ARTIQ kernels.
* Install Rust: :: * Install Rust: ::
$ cd ~/artiq-dev $ cd ~/artiq-dev
$ git clone -b artiq-1.16.0 https://github.com/m-labs/rust $ git clone -b artiq-1.18.0 https://github.com/m-labs/rust
$ cd rust $ cd rust
$ git submodule update --init $ git submodule update --init
$ mkdir build $ mkdir build
$ cd build $ cd build
$ ../configure --prefix=/usr/local/rust-or1k --llvm-root=/usr/local/llvm-or1k --disable-manage-submodules $ ../configure --prefix=/usr/local/rust-or1k --llvm-root=/usr/local/llvm-or1k --disable-manage-submodules
$ sudo make install -j4 $ sudo mkdir /usr/local/rust-or1k
$ sudo chown $USER.$USER /usr/local/rust-or1k
$ make install
$ libs="libcore liballoc libstd_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 ." $ 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 ."