diff --git a/artiq/firmware/runtime/Cargo.lock b/artiq/firmware/Cargo.lock similarity index 82% rename from artiq/firmware/runtime/Cargo.lock rename to artiq/firmware/Cargo.lock index bd44fd6fb..dba7c50be 100644 --- a/artiq/firmware/runtime/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -1,21 +1,15 @@ [root] -name = "runtime" +name = "std_artiq" version = "0.0.0" -dependencies = [ - "bsp 0.0.0", - "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fringe 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log_buffer 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lwip 0.0.0", - "std_artiq 0.0.0", - "walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "alloc_artiq" version = "0.0.0" +[[package]] +name = "alloc_none" +version = "0.0.0" + [[package]] name = "bsp" version = "0.0.0" @@ -30,7 +24,7 @@ name = "fringe" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -42,9 +36,19 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ksupport" +version = "0.0.0" +dependencies = [ + "alloc_none 0.0.0", + "bsp 0.0.0", + "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "std_artiq 0.0.0", +] + [[package]] name = "libc" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -70,15 +74,23 @@ name = "lwip-sys" version = "0.0.0" [[package]] -name = "std_artiq" +name = "runtime" version = "0.0.0" dependencies = [ "alloc_artiq 0.0.0", + "bsp 0.0.0", + "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fringe 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log_buffer 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lwip 0.0.0", + "std_artiq 0.0.0", + "walkdir 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "walkdir" -version = "0.1.8" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -99,9 +111,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum fringe 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "987689dcfad85eee8d76b477865641ec483e63fb86d52966bfc350c4a647d78a" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum libc 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "23e3757828fa702a20072c37ff47938e9dd331b92fac6e223d26d4b7a55f7ee2" +"checksum libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a51822fc847e7a8101514d1d44e354ba2ffa7d4c194dcab48870740e327cac70" "checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" "checksum log_buffer 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec57723b84bbe7bdf76aa93169c9b59e67473317c6de3a83cb2a0f8ccb2aa493" -"checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780" +"checksum walkdir 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd7c16466ecc507c7cb5988db03e6eab4aaeab89a5c37a29251fcfd3ac9b7afe" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/artiq/firmware/liballoc_none/Cargo.toml b/artiq/firmware/liballoc_none/Cargo.toml new file mode 100644 index 000000000..3cabb1f60 --- /dev/null +++ b/artiq/firmware/liballoc_none/Cargo.toml @@ -0,0 +1,8 @@ +[package] +authors = ["M-Labs"] +name = "alloc_none" +version = "0.0.0" + +[lib] +name = "alloc_none" +path = "lib.rs" diff --git a/artiq/firmware/liballoc_none/lib.rs b/artiq/firmware/liballoc_none/lib.rs new file mode 100644 index 000000000..f321c49a8 --- /dev/null +++ b/artiq/firmware/liballoc_none/lib.rs @@ -0,0 +1,36 @@ +#![feature(allocator)] +#![no_std] +#![allocator] + +#[no_mangle] +pub extern "C" fn __rust_allocate(_size: usize, _align: usize) -> *mut u8 { + unimplemented!() +} + +#[no_mangle] +pub extern "C" fn __rust_deallocate(_ptr: *mut u8, _old_size: usize, _align: usize) { + unimplemented!() +} + +#[no_mangle] +pub extern "C" fn __rust_reallocate(_ptr: *mut u8, + _old_size: usize, + _size: usize, + _align: usize) + -> *mut u8 { + unimplemented!() +} + +#[no_mangle] +pub extern "C" fn __rust_reallocate_inplace(_ptr: *mut u8, + _old_size: usize, + _size: usize, + _align: usize) + -> usize { + unimplemented!() +} + +#[no_mangle] +pub extern "C" fn __rust_usable_size(_size: usize, _align: usize) -> usize { + unimplemented!() +} diff --git a/artiq/firmware/libksupport/Cargo.lock b/artiq/firmware/libksupport/Cargo.lock deleted file mode 100644 index d5a6cd619..000000000 --- a/artiq/firmware/libksupport/Cargo.lock +++ /dev/null @@ -1,31 +0,0 @@ -[root] -name = "ksupport" -version = "0.0.0" -dependencies = [ - "bsp 0.0.0", - "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "std_artiq 0.0.0", -] - -[[package]] -name = "alloc_artiq" -version = "0.0.0" - -[[package]] -name = "bsp" -version = "0.0.0" - -[[package]] -name = "byteorder" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "std_artiq" -version = "0.0.0" -dependencies = [ - "alloc_artiq 0.0.0", -] - -[metadata] -"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" diff --git a/artiq/firmware/libksupport/Cargo.toml b/artiq/firmware/libksupport/Cargo.toml index b7179fc6f..581dee017 100644 --- a/artiq/firmware/libksupport/Cargo.toml +++ b/artiq/firmware/libksupport/Cargo.toml @@ -9,6 +9,7 @@ path = "lib.rs" crate-type = ["staticlib"] [dependencies] +alloc_none = { path = "../liballoc_none" } std_artiq = { path = "../libstd_artiq" } bsp = { path = "../libbsp" } byteorder = { version = "0.5", default-features = false } diff --git a/artiq/firmware/libksupport/lib.rs b/artiq/firmware/libksupport/lib.rs index b38ab0808..93306e565 100644 --- a/artiq/firmware/libksupport/lib.rs +++ b/artiq/firmware/libksupport/lib.rs @@ -3,6 +3,7 @@ #![no_std] #![needs_panic_runtime] +extern crate alloc_none; #[macro_use] extern crate std_artiq as std; extern crate libc; @@ -60,21 +61,6 @@ use libc::{c_char, size_t}; use kernel_proto::*; use dyld::Library; -#[no_mangle] -pub extern "C" fn malloc(_size: usize) -> *mut libc::c_void { - unimplemented!() -} - -#[no_mangle] -pub extern "C" fn realloc(_ptr: *mut libc::c_void, _size: usize) -> *mut libc::c_void { - unimplemented!() -} - -#[no_mangle] -pub extern "C" fn free(_ptr: *mut libc::c_void) { - unimplemented!() -} - fn send(request: &Message) { unsafe { mailbox::send(request as *const _ as usize) } while !mailbox::acknowledged() {} diff --git a/artiq/firmware/libstd_artiq/Cargo.toml b/artiq/firmware/libstd_artiq/Cargo.toml index a4467683f..dde6f0560 100644 --- a/artiq/firmware/libstd_artiq/Cargo.toml +++ b/artiq/firmware/libstd_artiq/Cargo.toml @@ -7,8 +7,5 @@ version = "0.0.0" name = "std_artiq" path = "lib.rs" -[dependencies] -alloc_artiq = { path = "../liballoc_artiq" } - [features] alloc = [] diff --git a/artiq/firmware/libstd_artiq/lib.rs b/artiq/firmware/libstd_artiq/lib.rs index 22f55ee25..3a7f66404 100644 --- a/artiq/firmware/libstd_artiq/lib.rs +++ b/artiq/firmware/libstd_artiq/lib.rs @@ -5,7 +5,6 @@ #![needs_panic_runtime] extern crate std_unicode; -extern crate alloc_artiq; extern crate alloc; #[macro_use] #[macro_reexport(vec, format)] diff --git a/artiq/firmware/runtime/Cargo.toml b/artiq/firmware/runtime/Cargo.toml index d06060233..1fe70abe9 100644 --- a/artiq/firmware/runtime/Cargo.toml +++ b/artiq/firmware/runtime/Cargo.toml @@ -13,6 +13,7 @@ crate-type = ["staticlib"] path = "lib.rs" [dependencies] +alloc_artiq = { path = "../liballoc_artiq" } std_artiq = { path = "../libstd_artiq", features = ["alloc"] } lwip = { path = "../liblwip", default-features = false } bsp = { path = "../libbsp" } diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index ee0aa7a5b..38be35401 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -1,6 +1,7 @@ #![no_std] #![feature(libc, const_fn, stmt_expr_attributes, repr_simd, asm, lang_items)] +extern crate alloc_artiq; #[macro_use] extern crate std_artiq as std; extern crate libc;