From 2a81819eb0d38c992777473e34b8643a4aea6aec Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 25 Feb 2017 17:54:14 +0000 Subject: [PATCH] firmware: restructure to avoid #[path = "..."] mod ...; Such code is fragile, introduces mess in dependencies, and inflates compile times. --- artiq/firmware/Cargo.lock | 23 +++- artiq/firmware/ksupport/Cargo.toml | 10 +- artiq/firmware/ksupport/Makefile | 2 +- artiq/firmware/ksupport/eh.rs | 25 ++++ artiq/firmware/ksupport/lib.rs | 111 ++++++++---------- artiq/firmware/ksupport/rtio.rs | 15 +-- artiq/firmware/libamp/Cargo.toml | 11 ++ artiq/firmware/libamp/lib.rs | 6 + artiq/firmware/{runtime => libamp}/mailbox.rs | 0 .../firmware/{runtime => libamp}/rpc_queue.rs | 2 - artiq/firmware/libproto/Cargo.toml | 15 +++ .../{runtime => libproto}/analyzer_proto.rs | 2 +- .../{runtime/proto.rs => libproto/io.rs} | 5 +- .../{runtime => libproto}/kernel_proto.rs | 2 - artiq/firmware/libproto/lib.rs | 21 ++++ .../{runtime => libproto}/moninj_proto.rs | 2 +- .../{runtime => libproto}/rpc_proto.rs | 10 +- .../{runtime => libproto}/session_proto.rs | 5 +- artiq/firmware/runtime/Cargo.toml | 11 +- artiq/firmware/runtime/lib.rs | 25 ++-- 20 files changed, 190 insertions(+), 113 deletions(-) create mode 100644 artiq/firmware/libamp/Cargo.toml create mode 100644 artiq/firmware/libamp/lib.rs rename artiq/firmware/{runtime => libamp}/mailbox.rs (100%) rename artiq/firmware/{runtime => libamp}/rpc_queue.rs (98%) create mode 100644 artiq/firmware/libproto/Cargo.toml rename artiq/firmware/{runtime => libproto}/analyzer_proto.rs (97%) rename artiq/firmware/{runtime/proto.rs => libproto/io.rs} (96%) rename artiq/firmware/{runtime => libproto}/kernel_proto.rs (98%) create mode 100644 artiq/firmware/libproto/lib.rs rename artiq/firmware/{runtime => libproto}/moninj_proto.rs (99%) rename artiq/firmware/{runtime => libproto}/rpc_proto.rs (99%) rename artiq/firmware/{runtime => libproto}/session_proto.rs (99%) diff --git a/artiq/firmware/Cargo.lock b/artiq/firmware/Cargo.lock index 38e74d84f..efae082ed 100644 --- a/artiq/firmware/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -10,6 +10,13 @@ version = "0.0.0" name = "alloc_none" version = "0.0.0" +[[package]] +name = "amp" +version = "0.0.0" +dependencies = [ + "board 0.0.0", +] + [[package]] name = "board" version = "0.0.0" @@ -93,11 +100,13 @@ name = "ksupport" version = "0.0.0" dependencies = [ "alloc_none 0.0.0", + "amp 0.0.0", "board 0.0.0", "build_artiq 0.0.0", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "dyld 0.0.0", + "proto 0.0.0", "std_artiq 0.0.0", ] @@ -130,21 +139,33 @@ name = "managed" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "proto" +version = "0.0.0" +dependencies = [ + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dyld 0.0.0", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "std_artiq 0.0.0", +] + [[package]] name = "runtime" version = "0.0.0" dependencies = [ "alloc_artiq 0.0.0", + "amp 0.0.0", "board 0.0.0", "build_artiq 0.0.0", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins?rev=631b568)", "cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "drtioaux 0.0.0", - "dyld 0.0.0", "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)", "logger_artiq 0.0.0", + "proto 0.0.0", "smoltcp 0.2.1 (git+https://github.com/m-labs/smoltcp?rev=e8ece3e)", "std_artiq 0.0.0", ] diff --git a/artiq/firmware/ksupport/Cargo.toml b/artiq/firmware/ksupport/Cargo.toml index e0604d5eb..7cded1135 100644 --- a/artiq/firmware/ksupport/Cargo.toml +++ b/artiq/firmware/ksupport/Cargo.toml @@ -13,9 +13,11 @@ crate-type = ["staticlib"] build_artiq = { path = "../libbuild_artiq" } [dependencies] -alloc_none = { path = "../liballoc_none" } -std_artiq = { path = "../libstd_artiq" } -board = { path = "../libboard" } -dyld = { path = "../libdyld" } byteorder = { version = "1.0", default-features = false } cslice = { version = "0.3" } +alloc_none = { path = "../liballoc_none" } +std_artiq = { path = "../libstd_artiq" } +dyld = { path = "../libdyld" } +board = { path = "../libboard" } +proto = { path = "../libproto" } +amp = { path = "../libamp" } diff --git a/artiq/firmware/ksupport/Makefile b/artiq/firmware/ksupport/Makefile index 47a58f2fe..c45aea7a4 100644 --- a/artiq/firmware/ksupport/Makefile +++ b/artiq/firmware/ksupport/Makefile @@ -23,7 +23,7 @@ $(RUSTOUT)/libksupport.a: ksupport.elf: $(RUSTOUT)/libksupport.a glue.o $(LD) $(LDFLAGS) -T $(KSUPPORT_DIRECTORY)/ksupport.ld -o $@ $^ \ - -lbase -lm -lcompiler-rt -lunwind + -lunwind -lcompiler-rt -lbase -lm @chmod -x $@ %.o: $(KSUPPORT_DIRECTORY)/%.c diff --git a/artiq/firmware/ksupport/eh.rs b/artiq/firmware/ksupport/eh.rs index 171835cf4..05f7a68a0 100644 --- a/artiq/firmware/ksupport/eh.rs +++ b/artiq/firmware/ksupport/eh.rs @@ -433,3 +433,28 @@ pub unsafe extern fn reraise() -> ! { uw::_Unwind_Resume(&mut INFLIGHT.uw_exception) } } + +// Stub implementations for the functions the panic_unwind crate expects to be provided. +// These all do nothing in libunwind, but aren't built for OR1K. +pub mod stubs { + #![allow(bad_style, unused_variables)] + + use super::{uw, c_int}; + + #[export_name="_Unwind_GetIPInfo"] + pub unsafe extern fn _Unwind_GetIPInfo(ctx: *mut uw::_Unwind_Context, + ip_before_insn: *mut c_int) -> uw::_Unwind_Word { + *ip_before_insn = 0; + uw::_Unwind_GetIP(ctx) + } + + #[export_name="_Unwind_GetTextRelBase"] + pub unsafe extern fn _Unwind_GetTextRelBase(ctx: *mut uw::_Unwind_Context) -> uw::_Unwind_Ptr { + unimplemented!() + } + + #[export_name="_Unwind_GetDataRelBase"] + pub unsafe extern fn _Unwind_GetDataRelBase(ctx: *mut uw::_Unwind_Context) -> uw::_Unwind_Ptr { + unimplemented!() + } +} diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index ff49d9296..44375bfeb 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -1,54 +1,26 @@ #![feature(lang_items, asm, libc, panic_unwind, unwind_attributes)] #![no_std] -extern crate alloc_none; -#[macro_use] -extern crate std_artiq as std; extern crate unwind; extern crate libc; extern crate byteorder; -extern crate board; extern crate cslice; + +extern crate alloc_none; +extern crate std_artiq as std; + +extern crate board; extern crate dyld; - -#[path = "../runtime/mailbox.rs"] -mod mailbox; - -#[path = "../runtime/proto.rs"] -mod proto; -#[path = "../runtime/kernel_proto.rs"] -mod kernel_proto; -#[path = "../runtime/rpc_proto.rs"] -mod rpc_proto; - -mod api; +extern crate proto; +extern crate amp; use core::{mem, ptr, slice, str}; use std::io::Cursor; use cslice::{CSlice, AsCSlice}; -use kernel_proto::*; use dyld::Library; - -macro_rules! artiq_raise { - ($name:expr, $message:expr, $param0:expr, $param1:expr, $param2:expr) => ({ - use cslice::AsCSlice; - let exn = $crate::eh::Exception { - name: concat!("0:artiq.coredevice.exceptions.", $name).as_bytes().as_c_slice(), - file: file!().as_bytes().as_c_slice(), - line: line!(), - column: column!(), - // https://github.com/rust-lang/rfcs/pull/1719 - function: "(Rust function)".as_bytes().as_c_slice(), - message: $message.as_bytes().as_c_slice(), - param: [$param0, $param1, $param2] - }; - #[allow(unused_unsafe)] - unsafe { $crate::eh::raise(&exn) } - }); - ($name:expr, $message:expr) => ({ - artiq_raise!($name, $message, 0, 0, 0) - }); -} +use proto::{kernel_proto, rpc_proto}; +use proto::kernel_proto::*; +use amp::{mailbox, rpc_queue}; fn send(request: &Message) { unsafe { mailbox::send(request as *const _ as usize) } @@ -75,6 +47,14 @@ macro_rules! recv { } } +#[no_mangle] +#[lang = "panic_fmt"] +pub extern fn panic_fmt(args: core::fmt::Arguments, file: &'static str, line: u32) -> ! { + send(&Log(format_args!("panic at {}:{}: {}", file, line, args))); + send(&RunAborted); + loop {} +} + macro_rules! print { ($($arg:tt)*) => ($crate::send(&$crate::kernel_proto::Log(format_args!($($arg)*)))); } @@ -84,19 +64,31 @@ macro_rules! println { ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); } -#[path = "../runtime/rpc_queue.rs"] -mod rpc_queue; -mod rtio; -mod eh; - -#[no_mangle] -#[lang = "panic_fmt"] -pub extern fn panic_fmt(args: core::fmt::Arguments, file: &'static str, line: u32) -> ! { - println!("panic at {}:{}: {}", file, line, args); - send(&RunAborted); - loop {} +macro_rules! raise { + ($name:expr, $message:expr, $param0:expr, $param1:expr, $param2:expr) => ({ + use cslice::AsCSlice; + let exn = $crate::eh::Exception { + name: concat!("0:artiq.coredevice.exceptions.", $name).as_bytes().as_c_slice(), + file: file!().as_bytes().as_c_slice(), + line: line!(), + column: column!(), + // https://github.com/rust-lang/rfcs/pull/1719 + function: "(Rust function)".as_bytes().as_c_slice(), + message: $message.as_bytes().as_c_slice(), + param: [$param0, $param1, $param2] + }; + #[allow(unused_unsafe)] + unsafe { $crate::eh::raise(&exn) } + }); + ($name:expr, $message:expr) => ({ + raise!($name, $message, 0, 0, 0) + }); } +pub mod eh; +mod api; +mod rtio; + static mut NOW: u64 = 0; #[no_mangle] @@ -115,12 +107,6 @@ pub extern fn send_to_rtio_log(timestamp: i64, text: CSlice) { rtio::log(timestamp, text.as_ref()) } -extern fn abort() -> ! { - println!("kernel called abort()"); - send(&RunAborted); - loop {} -} - extern fn rpc_send(service: u32, tag: CSlice, data: *const *const ()) { while !rpc_queue::empty() {} send(&RpcSend { @@ -139,7 +125,7 @@ extern fn rpc_send_async(service: u32, tag: CSlice, data: *const *const ()) rpc_proto::send_args(&mut writer, service, tag.as_ref(), data)?; writer.position() }; - proto::write_u32(&mut slice, length as u32) + proto::io::write_u32(&mut slice, length as u32) }).unwrap_or_else(|err| { assert!(err.kind() == std::io::ErrorKind::WriteZero); @@ -202,7 +188,7 @@ fn terminate(exception: &eh::Exception, mut backtrace: &mut [usize]) -> ! { extern fn watchdog_set(ms: i64) -> i32 { if ms < 0 { - artiq_raise!("ValueError", "cannot set a watchdog with a negative timeout") + raise!("ValueError", "cannot set a watchdog with a negative timeout") } send(&WatchdogSetRequest { ms: ms as u64 }); @@ -227,7 +213,7 @@ extern fn cache_put(key: CSlice, list: CSlice) { }); recv!(&CachePutReply { succeeded } => { if !succeeded { - artiq_raise!("CacheError", "cannot put into a busy cache row") + raise!("CacheError", "cannot put into a busy cache row") } }) } @@ -329,6 +315,11 @@ pub unsafe fn main() { #[no_mangle] pub extern fn exception_handler(vect: u32, _regs: *const u32, pc: u32, ea: u32) { - println!("exception {:?} at PC 0x{:x}, EA 0x{:x}", vect, pc, ea); - send(&RunAborted) + panic!("exception {:?} at PC 0x{:x}, EA 0x{:x}", vect, pc, ea) +} + +// We don't export this because libbase does. +// #[no_mangle] +pub extern fn abort() { + panic!("aborted") } diff --git a/artiq/firmware/ksupport/rtio.rs b/artiq/firmware/ksupport/rtio.rs index 53443e763..83c5e4741 100644 --- a/artiq/firmware/ksupport/rtio.rs +++ b/artiq/firmware/ksupport/rtio.rs @@ -1,6 +1,3 @@ -#[path = "../runtime/kernel_proto.rs"] -mod kernel_proto; - use core::ptr::{read_volatile, write_volatile}; use cslice::CSlice; use board::csr; @@ -46,25 +43,25 @@ unsafe fn process_exceptional_status(timestamp: i64, channel: i32, status: u32) } if status & RTIO_O_STATUS_UNDERFLOW != 0 { csr::rtio::o_underflow_reset_write(1); - artiq_raise!("RTIOUnderflow", + raise!("RTIOUnderflow", "RTIO underflow at {0} mu, channel {1}, slack {2} mu", timestamp, channel as i64, timestamp - get_counter()) } if status & RTIO_O_STATUS_SEQUENCE_ERROR != 0 { csr::rtio::o_sequence_error_reset_write(1); - artiq_raise!("RTIOSequenceError", + raise!("RTIOSequenceError", "RTIO sequence error at {0} mu, channel {1}", timestamp, channel as i64, 0) } if status & RTIO_O_STATUS_COLLISION != 0 { csr::rtio::o_collision_reset_write(1); - artiq_raise!("RTIOCollision", + raise!("RTIOCollision", "RTIO collision at {0} mu, channel {1}", timestamp, channel as i64, 0) } if status & RTIO_O_STATUS_BUSY != 0 { csr::rtio::o_busy_reset_write(1); - artiq_raise!("RTIOBusy", + raise!("RTIOBusy", "RTIO busy on channel {0}", channel as i64, 0, 0) } @@ -122,7 +119,7 @@ pub extern fn input_timestamp(timeout: i64, channel: i32) -> u64 { } if status & RTIO_I_STATUS_OVERFLOW != 0 { - artiq_raise!("RTIOOverflow", + raise!("RTIOOverflow", "RTIO input overflow on channel {0}", channel as i64, 0, 0); } @@ -145,7 +142,7 @@ pub extern fn input_data(channel: i32) -> i32 { if status & RTIO_I_STATUS_OVERFLOW != 0 { csr::rtio::i_overflow_reset_write(1); - artiq_raise!("RTIOOverflow", + raise!("RTIOOverflow", "RTIO input overflow on channel {0}", channel as i64, 0, 0); } diff --git a/artiq/firmware/libamp/Cargo.toml b/artiq/firmware/libamp/Cargo.toml new file mode 100644 index 000000000..2607f80c2 --- /dev/null +++ b/artiq/firmware/libamp/Cargo.toml @@ -0,0 +1,11 @@ +[package] +authors = ["M-Labs"] +name = "amp" +version = "0.0.0" + +[lib] +name = "amp" +path = "lib.rs" + +[dependencies] +board = { path = "../libboard" } diff --git a/artiq/firmware/libamp/lib.rs b/artiq/firmware/libamp/lib.rs new file mode 100644 index 000000000..df46ef0c0 --- /dev/null +++ b/artiq/firmware/libamp/lib.rs @@ -0,0 +1,6 @@ +#![no_std] + +extern crate board; + +pub mod mailbox; +pub mod rpc_queue; diff --git a/artiq/firmware/runtime/mailbox.rs b/artiq/firmware/libamp/mailbox.rs similarity index 100% rename from artiq/firmware/runtime/mailbox.rs rename to artiq/firmware/libamp/mailbox.rs diff --git a/artiq/firmware/runtime/rpc_queue.rs b/artiq/firmware/libamp/rpc_queue.rs similarity index 98% rename from artiq/firmware/runtime/rpc_queue.rs rename to artiq/firmware/libamp/rpc_queue.rs index f19befcec..8f9f40f96 100644 --- a/artiq/firmware/runtime/rpc_queue.rs +++ b/artiq/firmware/libamp/rpc_queue.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - use core::ptr::{read_volatile, write_volatile}; use core::slice; use board::{mem, cache}; diff --git a/artiq/firmware/libproto/Cargo.toml b/artiq/firmware/libproto/Cargo.toml new file mode 100644 index 000000000..487ae483b --- /dev/null +++ b/artiq/firmware/libproto/Cargo.toml @@ -0,0 +1,15 @@ +[package] +authors = ["M-Labs"] +name = "proto" +version = "0.0.0" + +[lib] +name = "proto" +path = "lib.rs" + +[dependencies] +byteorder = { version = "1.0", default-features = false } +cslice = { version = "0.3" } +log = { version = "0.3", default-features = false, optional = true } +std_artiq = { path = "../libstd_artiq", features = ["alloc"] } +dyld = { path = "../libdyld" } diff --git a/artiq/firmware/runtime/analyzer_proto.rs b/artiq/firmware/libproto/analyzer_proto.rs similarity index 97% rename from artiq/firmware/runtime/analyzer_proto.rs rename to artiq/firmware/libproto/analyzer_proto.rs index 8c103779f..27151b3bf 100644 --- a/artiq/firmware/runtime/analyzer_proto.rs +++ b/artiq/firmware/libproto/analyzer_proto.rs @@ -1,5 +1,5 @@ use std::io::{self, Write}; -use proto::*; +use io::*; #[derive(Debug)] pub struct Header { diff --git a/artiq/firmware/runtime/proto.rs b/artiq/firmware/libproto/io.rs similarity index 96% rename from artiq/firmware/runtime/proto.rs rename to artiq/firmware/libproto/io.rs index 21cdde62e..c91f606f1 100644 --- a/artiq/firmware/runtime/proto.rs +++ b/artiq/firmware/libproto/io.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - use std::io::{self, Read, Write}; use std::vec::Vec; use std::string::String; @@ -55,7 +53,8 @@ pub fn write_u64(writer: &mut Write, value: u64) -> io::Result<()> { pub fn read_bytes(reader: &mut Read) -> io::Result> { let length = read_u32(reader)?; - let mut value = vec![0; length as usize]; + let mut value = Vec::new(); + value.resize(length as usize, 0); reader.read_exact(&mut value)?; Ok(value) } diff --git a/artiq/firmware/runtime/kernel_proto.rs b/artiq/firmware/libproto/kernel_proto.rs similarity index 98% rename from artiq/firmware/runtime/kernel_proto.rs rename to artiq/firmware/libproto/kernel_proto.rs index a29895e73..1e776b876 100644 --- a/artiq/firmware/runtime/kernel_proto.rs +++ b/artiq/firmware/libproto/kernel_proto.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - use core::fmt; use dyld; diff --git a/artiq/firmware/libproto/lib.rs b/artiq/firmware/libproto/lib.rs new file mode 100644 index 000000000..97d95adad --- /dev/null +++ b/artiq/firmware/libproto/lib.rs @@ -0,0 +1,21 @@ +#![no_std] + +extern crate byteorder; +extern crate cslice; +#[cfg(feature = "log")] +#[macro_use] +extern crate log; + +extern crate dyld; +extern crate std_artiq as std; + +pub mod io; + +// Internal protocols. +pub mod kernel_proto; + +// External protocols. +pub mod analyzer_proto; +pub mod moninj_proto; +pub mod session_proto; +pub mod rpc_proto; diff --git a/artiq/firmware/runtime/moninj_proto.rs b/artiq/firmware/libproto/moninj_proto.rs similarity index 99% rename from artiq/firmware/runtime/moninj_proto.rs rename to artiq/firmware/libproto/moninj_proto.rs index ef287b696..15934b849 100644 --- a/artiq/firmware/runtime/moninj_proto.rs +++ b/artiq/firmware/libproto/moninj_proto.rs @@ -1,5 +1,5 @@ use std::io::{self, Read, Write}; -use proto::*; +use io::*; #[derive(Debug)] pub enum TtlMode { diff --git a/artiq/firmware/runtime/rpc_proto.rs b/artiq/firmware/libproto/rpc_proto.rs similarity index 99% rename from artiq/firmware/runtime/rpc_proto.rs rename to artiq/firmware/libproto/rpc_proto.rs index bae3ea079..0918e0637 100644 --- a/artiq/firmware/runtime/rpc_proto.rs +++ b/artiq/firmware/libproto/rpc_proto.rs @@ -1,9 +1,7 @@ -#![allow(dead_code)] - -use core::str; use std::io::{self, Read, Write}; +use std::str; use cslice::{CSlice, CMutSlice}; -use proto::*; +use io::*; use self::tag::{Tag, TagIterator, split_tag}; unsafe fn recv_value(reader: &mut Read, tag: Tag, data: &mut *mut (), @@ -76,7 +74,7 @@ unsafe fn recv_value(reader: &mut Read, tag: Tag, data: &mut *mut (), pub fn recv_return(reader: &mut Read, tag_bytes: &[u8], data: *mut (), alloc: &Fn(usize) -> io::Result<*mut ()>) -> io::Result<()> { let mut it = TagIterator::new(tag_bytes); - #[cfg(not(ksupport))] + #[cfg(feature = "log")] trace!("recv ...->{}", it); let tag = it.next().expect("truncated tag"); @@ -162,7 +160,7 @@ pub fn send_args(writer: &mut Write, service: u32, tag_bytes: &[u8], let (arg_tags_bytes, return_tag_bytes) = split_tag(tag_bytes); let mut args_it = TagIterator::new(arg_tags_bytes); - #[cfg(not(ksupport))] + #[cfg(feature = "log")] { let return_it = TagIterator::new(return_tag_bytes); trace!("send<{}>({})->{}", service, args_it, return_it); diff --git a/artiq/firmware/runtime/session_proto.rs b/artiq/firmware/libproto/session_proto.rs similarity index 99% rename from artiq/firmware/runtime/session_proto.rs rename to artiq/firmware/libproto/session_proto.rs index c30bf7eed..7448e1550 100644 --- a/artiq/firmware/runtime/session_proto.rs +++ b/artiq/firmware/libproto/session_proto.rs @@ -1,6 +1,7 @@ -use std::prelude::v1::*; use std::io::{self, Read, Write}; -use proto::*; +use std::vec::Vec; +use std::string::String; +use io::*; fn read_sync(reader: &mut Read) -> io::Result<()> { let mut sync = [0; 4]; diff --git a/artiq/firmware/runtime/Cargo.toml b/artiq/firmware/runtime/Cargo.toml index f82f104f6..1c7fcd2b0 100644 --- a/artiq/firmware/runtime/Cargo.toml +++ b/artiq/firmware/runtime/Cargo.toml @@ -13,16 +13,17 @@ path = "lib.rs" build_artiq = { path = "../libbuild_artiq" } [dependencies] +byteorder = { version = "1.0", default-features = false } +cslice = { version = "0.3" } +log = { version = "0.3", default-features = false, features = ["max_level_debug"] } +fringe = { version = "= 1.1.0", default-features = false, features = ["alloc"] } alloc_artiq = { path = "../liballoc_artiq" } std_artiq = { path = "../libstd_artiq", features = ["alloc"] } logger_artiq = { path = "../liblogger_artiq" } -cslice = { version = "0.3" } -log = { version = "0.3", default-features = false, features = ["max_level_debug"] } board = { path = "../libboard", features = ["uart_console"] } -dyld = { path = "../libdyld" } +proto = { path = "../libproto", features = ["log"] } +amp = { path = "../libamp" } drtioaux = { path = "../libdrtioaux" } -fringe = { version = "= 1.1.0", default-features = false, features = ["alloc"] } -byteorder = { version = "1.0", default-features = false } [dependencies.compiler_builtins] git = "https://github.com/rust-lang-nursery/compiler-builtins" diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index 8a09e189e..230545957 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -2,24 +2,28 @@ #![feature(compiler_builtins_lib, repr_simd, const_fn)] extern crate compiler_builtins; -extern crate alloc_artiq; -#[macro_use] -extern crate std_artiq as std; extern crate cslice; #[macro_use] extern crate log; -extern crate logger_artiq; extern crate byteorder; extern crate fringe; extern crate smoltcp; + +extern crate alloc_artiq; +#[macro_use] +extern crate std_artiq as std; +extern crate logger_artiq; #[macro_use] extern crate board; +extern crate proto; +extern crate amp; #[cfg(has_drtio)] extern crate drtioaux; -extern crate dyld; use std::boxed::Box; use smoltcp::wire::{EthernetAddress, IpAddress}; +use proto::{analyzer_proto, moninj_proto, rpc_proto, session_proto, kernel_proto}; +use amp::{mailbox, rpc_queue}; macro_rules! borrow_mut { ($x:expr) => ({ @@ -33,22 +37,11 @@ macro_rules! borrow_mut { mod config; mod ethmac; mod rtio_mgt; -mod mailbox; -mod rpc_queue; mod urc; mod sched; mod cache; -mod proto; -mod kernel_proto; -mod session_proto; -#[cfg(has_rtio_moninj)] -mod moninj_proto; -#[cfg(has_rtio_analyzer)] -mod analyzer_proto; -mod rpc_proto; - mod kernel; mod session; #[cfg(has_rtio_moninj)]