firmware: eliminate non-io uses of std_artiq from runtime.

Just replace these with references to alloc.
This commit is contained in:
whitequark 2018-05-14 18:27:17 +00:00
parent a100c73dfe
commit cf33ba748d
6 changed files with 17 additions and 20 deletions

View File

@ -1,6 +1,4 @@
use std::vec::Vec; use alloc::{Vec, String, BTreeMap};
use std::string::String;
use std::btree_map::BTreeMap;
#[derive(Debug)] #[derive(Debug)]
struct Entry { struct Entry {

View File

@ -1,6 +1,6 @@
use std::io::{self, Read}; use alloc::btree_map::BTreeMap;
use std::btree_map::BTreeMap;
use std::io::{self, Read};
use sched::Io; use sched::Io;
use sched::{TcpListener, TcpStream}; use sched::{TcpListener, TcpStream};
use board_misoc::{clock, csr}; use board_misoc::{clock, csr};

View File

@ -1,7 +1,6 @@
use std::mem; use core::mem;
use std::vec::Vec; use alloc::{Vec, String, BTreeMap};
use std::string::String;
use std::btree_map::BTreeMap;
use std::io::Write; use std::io::Write;
const ALIGNMENT: usize = 64; const ALIGNMENT: usize = 64;

View File

@ -3,14 +3,14 @@
use core::mem; use core::mem;
use core::result; use core::result;
use core::cell::{Cell, RefCell}; use core::cell::{Cell, RefCell};
use alloc::Vec;
use fringe::OwnedStack; use fringe::OwnedStack;
use fringe::generator::{Generator, Yielder, State as GeneratorState}; use fringe::generator::{Generator, Yielder, State as GeneratorState};
use smoltcp::wire::IpEndpoint; use smoltcp::wire::IpEndpoint;
use smoltcp::socket::{SocketHandle, SocketRef}; use smoltcp::socket::{SocketHandle, SocketRef};
use std::vec::Vec;
use std::io::{Read, Write, Result, Error, ErrorKind};
use board_misoc::clock; use board_misoc::clock;
use std::io::{Read, Write, Result, Error, ErrorKind};
use urc::Urc; use urc::Urc;
type SocketSet = ::smoltcp::socket::SocketSet<'static, 'static, 'static>; type SocketSet = ::smoltcp::socket::SocketSet<'static, 'static, 'static>;

View File

@ -1,11 +1,9 @@
use std::prelude::v1::*; use core::{mem, str, cell::{Cell, RefCell}, fmt::Write as FmtWrite};
use std::{mem, str}; use alloc::{Vec, String};
use std::cell::{Cell, RefCell};
use std::io::{self, Read, Write};
use std::error::Error;
use byteorder::{ByteOrder, NetworkEndian}; use byteorder::{ByteOrder, NetworkEndian};
use board_misoc::{ident, cache, config}; use board_misoc::{ident, cache, config};
use std::io::{self, Read, Write};
use {mailbox, rpc_queue, kernel}; use {mailbox, rpc_queue, kernel};
use urc::Urc; use urc::Urc;
use sched::{ThreadHandle, Io}; use sched::{ThreadHandle, Io};
@ -289,7 +287,9 @@ fn process_host_message(io: &Io,
match unsafe { kern_load(io, session, &kernel) } { match unsafe { kern_load(io, session, &kernel) } {
Ok(()) => host_write(stream, host::Reply::LoadCompleted), Ok(()) => host_write(stream, host::Reply::LoadCompleted),
Err(error) => { Err(error) => {
host_write(stream, host::Reply::LoadFailed(error.description()))?; let mut description = String::new();
write!(&mut description, "{}", error).unwrap();
host_write(stream, host::Reply::LoadFailed(&description))?;
kern_acknowledge() kern_acknowledge()
} }
}, },

View File

@ -1,6 +1,6 @@
use std::rc::Rc; use core::ops::Deref;
use std::ops::Deref; use core::fmt;
use std::fmt; use alloc::rc::Rc;
pub struct Urc<T: ?Sized>(Rc<T>); pub struct Urc<T: ?Sized>(Rc<T>);