Compare commits

..

No commits in common. "d5402d899f3e0e6ad125cabca002763aa87fe46a" and "38f4d6cd2e7a0c2122bff674e04d4c251fc76b3b" have entirely different histories.

11 changed files with 77 additions and 201 deletions

View File

@ -8,7 +8,7 @@ device_db = {
"arguments": {
"host": "192.168.1.52",
"ref_period": 1e-9,
"ref_multiplier": 8,
"ref_multiplier": 1,
"target": "cortexa9"
}
},

View File

@ -11,11 +11,11 @@
"src-pythonparser": "src-pythonparser"
},
"locked": {
"lastModified": 1666191362,
"narHash": "sha256-5LiuCM+pPJU+dV6teQ0D4GLPh1KVUP96Wyjlso6EJ84=",
"lastModified": 1661404661,
"narHash": "sha256-j3l/plOlK2Hcd4XIC32PDfKvqUY8Apr9sBeczyJ/L8A=",
"ref": "master",
"rev": "e5c621751f64b54ac90fa793303c3af8351291cf",
"revCount": 8200,
"rev": "b705862ecd014b0c3b69051c1c822f13ce8aeea2",
"revCount": 8144,
"type": "git",
"url": "https://github.com/m-labs/artiq.git"
},
@ -26,7 +26,6 @@
},
"artiq-comtools": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"artiq",
"nixpkgs"
@ -37,11 +36,11 @@
]
},
"locked": {
"lastModified": 1664405593,
"narHash": "sha256-yP441NerlLGig7n+9xHsx8yCtZ+Ggd0VqfBSzc20E04=",
"lastModified": 1654007592,
"narHash": "sha256-vaDFhE1ItjqtIcinC/6RAJGbj44pxxMUEeQUa3FtgEE=",
"owner": "m-labs",
"repo": "artiq-comtools",
"rev": "15ddac62813ef623a076ccf982b3bc63d314e651",
"rev": "cb73281154656ee8f74db1866859e31bf42755cd",
"type": "github"
},
"original": {
@ -50,29 +49,14 @@
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mozilla-overlay": {
"flake": false,
"locked": {
"lastModified": 1664789696,
"narHash": "sha256-UGWJHQShiwLCr4/DysMVFrYdYYHcOqAOVsWNUu+l6YU=",
"lastModified": 1657214286,
"narHash": "sha256-rO/4oymKXU09wG2bcTt4uthPCp1XsBZjxuCJo3yVXNs=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "80627b282705101e7b38e19ca6e8df105031b072",
"rev": "0508a66e28a5792fdfb126bbf4dec1029c2509e0",
"type": "github"
},
"original": {
@ -84,11 +68,11 @@
"mozilla-overlay_2": {
"flake": false,
"locked": {
"lastModified": 1664789696,
"narHash": "sha256-UGWJHQShiwLCr4/DysMVFrYdYYHcOqAOVsWNUu+l6YU=",
"lastModified": 1657214286,
"narHash": "sha256-rO/4oymKXU09wG2bcTt4uthPCp1XsBZjxuCJo3yVXNs=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "80627b282705101e7b38e19ca6e8df105031b072",
"rev": "0508a66e28a5792fdfb126bbf4dec1029c2509e0",
"type": "github"
},
"original": {
@ -115,11 +99,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1666056570,
"narHash": "sha256-e7EkIY68Tp7NKyp9JSHh6CgPPdsKYYWxiL4wZQN8Cwg=",
"lastModified": 1657123678,
"narHash": "sha256-cowVkScfUPlbBXUp08MeVk/wgm9E1zp1uC+9no2hZYw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "47edaa313fc3767ce3026037a5b62352f22f3602",
"rev": "316b762afdb9e142a803f29c49a88b4a47db80ee",
"type": "github"
},
"original": {
@ -144,11 +128,11 @@
]
},
"locked": {
"lastModified": 1664319253,
"narHash": "sha256-hycJAgy+NFF9f5I6++7yo8KdhMSyKCPKJazRPxeedI4=",
"lastModified": 1654830914,
"narHash": "sha256-tratXcWu6Dgzd0Qd9V6EMjuNlE9qDN1pKFhP+Gt0b64=",
"owner": "m-labs",
"repo": "sipyco",
"rev": "d58ded7280e0f020be2446d4fee70f4393e6045f",
"rev": "58b0935f7ae47659abee5b5792fa594153328d6f",
"type": "github"
},
"original": {
@ -160,11 +144,11 @@
"src-migen": {
"flake": false,
"locked": {
"lastModified": 1662111470,
"narHash": "sha256-IPyhoFZLhY8d3jHB8jyvGdbey7V+X5eCzBZYSrJ18ec=",
"lastModified": 1656649178,
"narHash": "sha256-A91sZRrprEuPOtIUVxm6wX5djac9wnNZQ4+cU1nvJPc=",
"owner": "m-labs",
"repo": "migen",
"rev": "639e66f4f453438e83d86dc13491b9403bbd8ec6",
"rev": "0fb91737090fe45fd764ea3f71257a4c53c7a4ae",
"type": "github"
},
"original": {
@ -176,11 +160,11 @@
"src-misoc": {
"flake": false,
"locked": {
"lastModified": 1665395741,
"narHash": "sha256-7ULMGBPPn5NxZX6rdxU5GheoSNBiJklHQEVf04jU9tI=",
"lastModified": 1649324486,
"narHash": "sha256-Mw/fQS3lHFvCm7L1k63joRkz5uyijQfywcOq+X2+o2s=",
"ref": "master",
"rev": "4fb0730db4c5de7e86f82fa3bd204e6c4608af85",
"revCount": 2427,
"rev": "f1dc58d2b8c222ba41c25cee4301626625f46e43",
"revCount": 2420,
"submodules": true,
"type": "git",
"url": "https://github.com/m-labs/misoc.git"
@ -216,11 +200,11 @@
]
},
"locked": {
"lastModified": 1665118676,
"narHash": "sha256-9hX80tRMFNehL7jSUrlctKMe7k8Br14O93gr9P5Zl7w=",
"lastModified": 1661505762,
"narHash": "sha256-gXML1pez4LvYxuAG9AX3inKq0e7+D8SvNd/tW4OwXu4=",
"ref": "master",
"rev": "0a3a7776520fa0359fe7dbf40146b9bd22bbc0f8",
"revCount": 622,
"rev": "92b3f3e1dd14fb2e53868665d95bbea4270da33e",
"revCount": 621,
"type": "git",
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
},

View File

@ -134,7 +134,7 @@
cargoLock = {
lockFile = src/Cargo.lock;
outputHashes = {
"libasync-0.0.0" = "sha256-9hX80tRMFNehL7jSUrlctKMe7k8Br14O93gr9P5Zl7w=";
"libasync-0.0.0" = "sha256-gXML1pez4LvYxuAG9AX3inKq0e7+D8SvNd/tW4OwXu4=";
};
};

52
src/Cargo.lock generated
View File

@ -138,9 +138,9 @@ dependencies = [
[[package]]
name = "futures"
version = "0.3.24"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c"
checksum = "ab30e97ab6aacfe635fad58f22c2bb06c8b685f7421eb1e064a729e2a5f481fa"
dependencies = [
"futures-channel",
"futures-core",
@ -152,9 +152,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.24"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050"
checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1"
dependencies = [
"futures-core",
"futures-sink",
@ -162,21 +162,21 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.24"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115"
[[package]]
name = "futures-io"
version = "0.3.24"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5"
[[package]]
name = "futures-macro"
version = "0.3.24"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17"
checksum = "0db9cce532b0eae2ccf2766ab246f114b56b9cf6d445e00c2549fbc100ca045d"
dependencies = [
"proc-macro2",
"quote",
@ -185,21 +185,21 @@ dependencies = [
[[package]]
name = "futures-sink"
version = "0.3.24"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56"
checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765"
[[package]]
name = "futures-task"
version = "0.3.24"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1"
checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306"
[[package]]
name = "futures-util"
version = "0.3.24"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577"
dependencies = [
"futures-core",
"futures-macro",
@ -221,7 +221,7 @@ dependencies = [
[[package]]
name = "libasync"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#0a3a7776520fa0359fe7dbf40146b9bd22bbc0f8"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#92b3f3e1dd14fb2e53868665d95bbea4270da33e"
dependencies = [
"embedded-hal",
"libcortex_a9",
@ -253,7 +253,7 @@ dependencies = [
[[package]]
name = "libboard_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#0a3a7776520fa0359fe7dbf40146b9bd22bbc0f8"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#92b3f3e1dd14fb2e53868665d95bbea4270da33e"
dependencies = [
"bit_field",
"embedded-hal",
@ -278,7 +278,7 @@ dependencies = [
[[package]]
name = "libconfig"
version = "0.1.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#0a3a7776520fa0359fe7dbf40146b9bd22bbc0f8"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#92b3f3e1dd14fb2e53868665d95bbea4270da33e"
dependencies = [
"core_io",
"fatfs",
@ -289,7 +289,7 @@ dependencies = [
[[package]]
name = "libcortex_a9"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#0a3a7776520fa0359fe7dbf40146b9bd22bbc0f8"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#92b3f3e1dd14fb2e53868665d95bbea4270da33e"
dependencies = [
"bit_field",
"libregister",
@ -305,7 +305,7 @@ checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565"
[[package]]
name = "libregister"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#0a3a7776520fa0359fe7dbf40146b9bd22bbc0f8"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#92b3f3e1dd14fb2e53868665d95bbea4270da33e"
dependencies = [
"bit_field",
"vcell",
@ -315,7 +315,7 @@ dependencies = [
[[package]]
name = "libsupport_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#0a3a7776520fa0359fe7dbf40146b9bd22bbc0f8"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#92b3f3e1dd14fb2e53868665d95bbea4270da33e"
dependencies = [
"cc",
"compiler_builtins",
@ -503,9 +503,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.101"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2"
checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13"
dependencies = [
"proc-macro2",
"quote",
@ -514,9 +514,9 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.4"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
[[package]]
name = "unwind"

View File

@ -118,7 +118,7 @@ class GenericStandalone(SoCCore):
platform.toolchain.bitstream_commands.extend([
"set_property BITSTREAM.GENERAL.COMPRESS True [current_design]",
])
ident = description["variant"]
ident = self.__class__.__name__
if self.acpki:
ident = "acpki_" + ident
SoCCore.__init__(self, platform=platform, csr_data_width=32, ident=ident)
@ -204,7 +204,7 @@ class GenericMaster(SoCCore):
platform.toolchain.bitstream_commands.extend([
"set_property BITSTREAM.GENERAL.COMPRESS True [current_design]",
])
ident = description["variant"]
ident = self.__class__.__name__
if self.acpki:
ident = "acpki_" + ident
SoCCore.__init__(self, platform=platform, csr_data_width=32, ident=ident)
@ -329,7 +329,7 @@ class GenericSatellite(SoCCore):
platform.toolchain.bitstream_commands.extend([
"set_property BITSTREAM.GENERAL.COMPRESS True [current_design]",
])
ident = description["variant"]
ident = self.__class__.__name__
if self.acpki:
ident = "acpki_" + ident
SoCCore.__init__(self, platform=platform, csr_data_width=32, ident=ident)

View File

@ -22,8 +22,6 @@ use futures::{select_biased, future::FutureExt};
use libasync::{smoltcp::{Sockets, TcpStream}, task};
use libconfig::{Config, net_settings};
use libboard_artiq::drtio_routing;
#[cfg(feature = "target_kasli_soc")]
use libboard_zynq::error_led::ErrorLED;
use crate::proto_async::*;
use crate::kernel;
@ -492,61 +490,3 @@ pub fn main(timer: GlobalTimer, cfg: Config) {
Instant::from_millis(timer.get_time().0 as i32)
});
}
pub fn soft_panic_main(timer: GlobalTimer, cfg: Config) -> ! {
let net_addresses = net_settings::get_addresses(&cfg);
info!("network addresses: {}", net_addresses);
let eth = zynq::eth::Eth::eth0(net_addresses.hardware_addr.0.clone());
const RX_LEN: usize = 64;
// Number of transmission buffers (minimum is two because with
// one, duplicate packet transmission occurs)
const TX_LEN: usize = 64;
let eth = eth.start_rx(RX_LEN);
let mut eth = eth.start_tx(TX_LEN);
let neighbor_cache = NeighborCache::new(alloc::collections::BTreeMap::new());
let mut iface = match net_addresses.ipv6_addr {
Some(addr) => {
let ip_addrs = [
IpCidr::new(net_addresses.ipv4_addr, 0),
IpCidr::new(net_addresses.ipv6_ll_addr, 0),
IpCidr::new(addr, 0)
];
EthernetInterfaceBuilder::new(&mut eth)
.ethernet_addr(net_addresses.hardware_addr)
.ip_addrs(ip_addrs)
.neighbor_cache(neighbor_cache)
.finalize()
}
None => {
let ip_addrs = [
IpCidr::new(net_addresses.ipv4_addr, 0),
IpCidr::new(net_addresses.ipv6_ll_addr, 0)
];
EthernetInterfaceBuilder::new(&mut eth)
.ethernet_addr(net_addresses.hardware_addr)
.ip_addrs(ip_addrs)
.neighbor_cache(neighbor_cache)
.finalize()
}
};
Sockets::init(32);
mgmt::start(cfg);
// getting eth settings disables the LED as it resets GPIO
// need to re-enable it here
#[cfg(feature = "target_kasli_soc")]
{
let mut err_led = ErrorLED::error_led();
err_led.toggle(true);
}
Sockets::run(&mut iface, || {
Instant::from_millis(timer.get_time().0 as i32)
});
}

View File

@ -222,15 +222,12 @@ extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32
if &__text_start as *const u32 <= pc && pc < &__text_end as *const u32 {
length = (&__exidx_end as *const EXIDX_Entry).offset_from(&__exidx_start) as u32;
start = &__exidx_start;
} else if KERNEL_IMAGE != ptr::null() {
} else {
let exidx = KERNEL_IMAGE.as_ref()
.expect("dl_unwind_find_exidx kernel image")
.library.get().as_ref().unwrap().exidx();
length = exidx.len() as u32;
start = exidx.as_ptr();
} else {
length = 0;
start = ptr::null();
}
*len_ptr = length;
}

View File

@ -109,7 +109,7 @@ pub fn main_core0() {
gic::InterruptController::gic(mpcore::RegisterBlock::mpcore()).enable_interrupts();
init_gateware();
info!("gateware ident: {}", identifier_read(&mut [0; 64]));
info!("detected gateware: {}", identifier_read(&mut [0; 64]));
i2c::init();

View File

@ -1,6 +1,6 @@
use futures::{future::poll_fn, task::Poll};
use libasync::{smoltcp::TcpStream, task};
use libboard_zynq::{smoltcp, slcr};
use libboard_zynq::smoltcp;
use libconfig::Config;
use core::cell::RefCell;
use alloc::{rc::Rc, vec::Vec, string::String};
@ -44,7 +44,6 @@ pub enum Request {
ClearLog = 2,
PullLog = 7,
SetLogFilter = 3,
Reboot = 5,
SetUartLogFilter = 6,
ConfigRead = 12,
@ -56,7 +55,6 @@ pub enum Request {
pub enum Reply {
Success = 1,
LogContent = 2,
RebootImminent = 3,
Error = 6,
ConfigData = 7,
}
@ -229,12 +227,6 @@ async fn handle_connection(
warn!("erase failed");
write_i8(stream, Reply::Error as i8).await?;
}
},
Request::Reboot => {
info!("rebooting");
write_i8(stream, Reply::RebootImminent as i8).await?;
stream.flush().await?;
slcr::reboot();
}
}
}

View File

@ -3,21 +3,20 @@ use libregister::RegisterR;
use libcortex_a9::regs::MPIDR;
use unwind::backtrace;
#[cfg(feature = "target_kasli_soc")]
use libboard_zynq::error_led::ErrorLED;
use crate::comms::soft_panic_main;
use log::error;
use libboard_zynq::timer::GlobalTimer;
use libconfig::Config;
static mut PANICKED: [bool; 2] = [false; 2];
static mut SOFT_PANICKED: bool = false;
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
let id = MPIDR.read().cpu_id() as usize;
let soft_panicked = unsafe { SOFT_PANICKED };
print!("Core {} panic at ", id);
print!("Core {} ", id);
unsafe {
if PANICKED[id] {
println!("nested panic!");
loop {}
}
PANICKED[id] = true;
}
print!("panic at ");
if let Some(location) = info.location() {
print!("{}:{}:{}", location.file(), location.line(), location.column());
} else {
@ -28,20 +27,6 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
} else {
println!("");
}
unsafe {
// soft panics only allowed for core 0
if PANICKED[id] && (SOFT_PANICKED || id == 1) {
println!("nested panic!");
loop {}
}
SOFT_PANICKED = true;
PANICKED[id] = true;
}
#[cfg(feature = "target_kasli_soc")]
{
let mut err_led = ErrorLED::error_led();
err_led.toggle(true);
}
println!("Backtrace: ");
let _ = backtrace(|ip| {
// Backtrace gives us the return address, i.e. the address after the delay slot,
@ -49,28 +34,6 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
print!("{:#08x} ", ip - 2 * 4);
});
println!("\nEnd backtrace");
if !soft_panicked && id == 0 {
soft_panic(info);
}
loop {}
}
fn soft_panic(info: &core::panic::PanicInfo) -> ! {
// write panic info to log, so coremgmt can also read it
if let Some(location) = info.location() {
error!("panic at {}:{}:{}", location.file(), location.line(), location.column());
} else {
error!("panic at unknown location");
}
if let Some(message) = info.message() {
error!("panic message: {}", message);
}
let timer = GlobalTimer::start();
let cfg = match Config::new() {
Ok(cfg) => cfg,
Err(_) => {
Config::new_dummy()
}
};
soft_panic_main(timer, cfg);
}

View File

@ -1,4 +1,4 @@
use log::{info, warn};
use log::{info, warn, error};
use libboard_zynq::timer::GlobalTimer;
use embedded_hal::blocking::delay::DelayMs;
use libconfig::Config;
@ -95,7 +95,7 @@ fn init_rtio(timer: &mut GlobalTimer, _clk: RtioClock) {
if locked {
info!("RTIO PLL locked");
} else {
panic!("RTIO PLL failed to lock");
error!("RTIO PLL failed to lock");
}
unsafe {