Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6c637537f065
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b7f6bfffeb73
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Jan 26, 2017

  1. Copy the full SHA
    31e5f9a View commit details
  2. Copy the full SHA
    b7f6bff View commit details
8 changes: 4 additions & 4 deletions artiq/firmware/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion artiq/firmware/libbuild_artiq/lib.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ extern crate walkdir;

use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::io::{Write, BufRead, BufReader};
use std::path::Path;
use std::process::Command;

@@ -27,6 +27,12 @@ pub fn git_describe() {
.unwrap();
let id = id.split("-").collect::<Vec<_>>();
let id = format!("{}+{}.{}", id[0], id[1], id[2]);

let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("git-describe");
let mut f = File::create(&dest_path).unwrap();
f.write(id.as_bytes()).unwrap();

println!("cargo:rust-cfg=git_describe={:?}", id);

println!("cargo:rerun-if-changed=../../../.git/HEAD");
2 changes: 1 addition & 1 deletion artiq/firmware/runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -23,6 +23,6 @@ byteorder = { version = "1.0", default-features = false }

[dependencies.smoltcp]
git = "https://github.com/m-labs/smoltcp"
rev = "a20f89f"
rev = "ebee5b7"
default-features = false
features = ["use_alloc", "use_collections", "use_log"]#, "verbose"]
5 changes: 5 additions & 0 deletions artiq/firmware/runtime/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;
use std::vec::Vec;
use std::string::String;
use libc::{c_void, c_char, c_int, c_uint};

extern {
@@ -44,6 +45,10 @@ pub fn read_to_end(key: &str) -> Vec<u8> {
value
}

pub fn read_string(key: &str) -> String {
String::from_utf8(read_to_end(key)).unwrap()
}

pub fn write(key: &str, buf: &[u8]) -> Result<(), ()> {
let key_c = c_str!(key);
let result = unsafe {
31 changes: 27 additions & 4 deletions artiq/firmware/runtime/lib.rs
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ extern crate smoltcp;
extern crate board;

use std::boxed::Box;
use smoltcp::wire::{EthernetAddress, IpAddress};

extern {
fn readchar() -> libc::c_char;
@@ -59,7 +60,7 @@ mod analyzer;
fn startup() {
board::clock::init();
info!("ARTIQ runtime starting...");
info!("software version {}", cfg!(git_describe));
info!("software version {}", include_str!(concat!(env!("OUT_DIR"), "/git-describe")));
info!("gateware version {}", board::ident(&mut [0; 64]));

let t = board::clock::get_ms();
@@ -81,6 +82,30 @@ fn startup() {
#[cfg(has_converter_spi)]
board::ad9154::init().expect("cannot initialize ad9154");

let hardware_addr;
match EthernetAddress::parse(&config::read_string("mac")) {
Err(()) => {
hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x01]);
warn!("using default MAC address {}; consider changing it", hardware_addr);
}
Ok(addr) => {
hardware_addr = addr;
info!("using MAC address {}", hardware_addr);
}
}

let protocol_addr;
match IpAddress::parse(&config::read_string("ip")) {
Err(()) | Ok(IpAddress::Unspecified) => {
protocol_addr = IpAddress::v4(192, 168, 1, 50);
info!("using default IP address {}", protocol_addr);
}
Ok(addr) => {
protocol_addr = addr;
info!("using IP address {}", protocol_addr);
}
}

fn _net_trace_writer<U>(printer: smoltcp::wire::PrettyPrinter<U>)
where U: smoltcp::wire::pretty_print::PrettyPrint {
print!("\x1b[37m{}\x1b[0m", printer)
@@ -90,11 +115,9 @@ fn startup() {
// let net_device = smoltcp::phy::Tracer::<_, smoltcp::wire::EthernetFrame<&[u8]>>
// ::new(net_device, _net_trace_writer);
let arp_cache = smoltcp::iface::SliceArpCache::new([Default::default(); 8]);
let hardware_addr = smoltcp::wire::EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x01]);
let protocol_addrs = [smoltcp::wire::IpAddress::v4(192, 168, 1, 50)];
let mut interface = smoltcp::iface::EthernetInterface::new(
Box::new(net_device), Box::new(arp_cache) as Box<smoltcp::iface::ArpCache>,
hardware_addr, protocol_addrs);
hardware_addr, [protocol_addr]);

let mut scheduler = sched::Scheduler::new();
let io = scheduler.io();
2 changes: 1 addition & 1 deletion artiq/firmware/satman/lib.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ extern crate board;
fn startup() {
board::clock::init();
info!("ARTIQ satellite manager starting...");
info!("software version {}", cfg!(git_describe));
info!("software version {}", include_str!(concat!(env!("OUT_DIR"), "/git-describe")));
info!("gateware version {}", board::ident(&mut [0; 64]));

loop {}