Compare commits

..

8 Commits

18 changed files with 59 additions and 65 deletions

23
flake.lock generated
View File

@ -11,11 +11,11 @@
"src-pythonparser": "src-pythonparser" "src-pythonparser": "src-pythonparser"
}, },
"locked": { "locked": {
"lastModified": 1734418848, "lastModified": 1734333183,
"narHash": "sha256-FiK84edtdmpJ3FUA58XAUmDDp4oVPgupmf1CcgJ6rC0=", "narHash": "sha256-iVzdaE3x5Ob2nArtF7S3xuUIVxXiO7RCmXKYgS4ltcs=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "366bb0fc59dbe4d5f544908b0f3e31f8eb19f7c1", "rev": "c65520ab0184149e57d6d9c104e334055186fd67",
"revCount": 9121, "revCount": 9120,
"type": "git", "type": "git",
"url": "https://github.com/m-labs/artiq.git" "url": "https://github.com/m-labs/artiq.git"
}, },
@ -229,17 +229,18 @@
"rust-overlay": "rust-overlay_2" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1734668221, "lastModified": 1734336632,
"narHash": "sha256-X0U2yPmlsD3VLBZQyfWv8qw04Qn0qFWIONJUPPigB0U=", "narHash": "sha256-Y87aN0z8B/KRUg8dgoKrTNHZTHtC9hEQKlxRx2+szNs=",
"ref": "refs/heads/master", "ref": "bump_to_llvm15",
"rev": "213529cf7a50aa1b2d9ffdf575e3e38202ff9bd6", "rev": "f18cc91c1b5ebf0aadc59724d1f69f037da44c7f",
"revCount": 666, "revCount": 664,
"type": "git", "type": "git",
"url": "https://git.m-labs.hk/m-labs/zynq-rs" "url": "https://git.m-labs.hk/srenblad/zynq-rs/"
}, },
"original": { "original": {
"ref": "bump_to_llvm15",
"type": "git", "type": "git",
"url": "https://git.m-labs.hk/m-labs/zynq-rs" "url": "https://git.m-labs.hk/srenblad/zynq-rs/"
} }
} }
}, },

View File

@ -2,7 +2,7 @@
description = "ARTIQ port to the Zynq-7000 platform"; description = "ARTIQ port to the Zynq-7000 platform";
inputs.artiq.url = git+https://github.com/m-labs/artiq.git; inputs.artiq.url = git+https://github.com/m-labs/artiq.git;
inputs.zynq-rs.url = git+https://git.m-labs.hk/m-labs/zynq-rs; inputs.zynq-rs.url = git+https://git.m-labs.hk/srenblad/zynq-rs/?ref=bump_to_llvm15;
inputs.zynq-rs.inputs.nixpkgs.follows = "artiq/nixpkgs"; inputs.zynq-rs.inputs.nixpkgs.follows = "artiq/nixpkgs";
outputs = { self, zynq-rs, artiq }: outputs = { self, zynq-rs, artiq }:
@ -126,8 +126,8 @@
outputHashes = { outputHashes = {
"tar-no-std-0.1.8" = "sha256-xm17108v4smXOqxdLvHl9CxTCJslmeogjm4Y87IXFuM="; "tar-no-std-0.1.8" = "sha256-xm17108v4smXOqxdLvHl9CxTCJslmeogjm4Y87IXFuM=";
"nalgebra-0.32.6" = "sha256-ZbQQZbM3A5cJ4QbujtUxkrI0/qGlI4UzfahtyQnvMZA="; "nalgebra-0.32.6" = "sha256-ZbQQZbM3A5cJ4QbujtUxkrI0/qGlI4UzfahtyQnvMZA=";
"core_io-0.1.0" = "sha256-0HINFWRiJx8pjMgUOL/CS336ih7SENSRh3Kah9LPRrw="; "core_io-0.1.0" = "sha256-tepvvnkDTYDJ3uvuuSJISevYFkl802GHBHSwn1fXKJE=";
"fatfs-0.3.6" = "sha256-Nz9hCq/1YgSXF8ltJ5ZawV0Hc8WV44KNK0tJdVnNb4U="; "fatfs-0.3.6" = "sha256-Z6iueATKemecxleUd5vzWMNq0PHS7hD422PXOiyDHUM=";
}; };
}; };

6
src/Cargo.lock generated
View File

@ -89,7 +89,7 @@ checksum = "20b1438ef42c655665a8ab2c1c6d605a305f031d38d9be689ddfef41a20f3aa2"
[[package]] [[package]]
name = "core_io" name = "core_io"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.m-labs.hk/M-Labs/rs-core_io.git?rev=e9d3edf027#e9d3edf0272502b0dd6c26e8a4869c2912657615" source = "git+https://git.m-labs.hk/srenblad/rs-core_io.git?branch=main#0af646fef07b2e2ac90b5aae998fd28c93efdbc1"
[[package]] [[package]]
name = "crc" name = "crc"
@ -138,7 +138,7 @@ dependencies = [
[[package]] [[package]]
name = "fatfs" name = "fatfs"
version = "0.3.6" version = "0.3.6"
source = "git+https://git.m-labs.hk/M-Labs/rust-fatfs.git?rev=4b5e420084#4b5e420084fd1c4a9c105680b687523909b6469c" source = "git+https://git.m-labs.hk/srenblad/rust-fatfs.git?branch=main#62a8cafc1561eda34448ed2fcedaf87f26a63030"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"byteorder", "byteorder",
@ -390,7 +390,7 @@ checksum = "c75de51135344a4f8ed3cfe2720dc27736f7711989703a0b43aadf3753c55577"
[[package]] [[package]]
name = "nalgebra" name = "nalgebra"
version = "0.32.6" version = "0.32.6"
source = "git+https://git.m-labs.hk/M-Labs/nalgebra.git?rev=ad42410ab0#ad42410ab0abb014229e3ff6bc6ccd39ca92d5d1" source = "git+https://git.m-labs.hk/srenblad/nalgebra.git?rev=ad42410ab0#ad42410ab0abb014229e3ff6bc6ccd39ca92d5d1"
dependencies = [ dependencies = [
"approx", "approx",
"num-complex", "num-complex",

View File

@ -1,4 +1,12 @@
{ {
"abi-blacklist": [
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"win64",
"sysv64"
],
"arch": "arm", "arch": "arm",
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
"emit-debug-gdb-scripts": false, "emit-debug-gdb-scripts": false,
@ -13,6 +21,7 @@
"os": "none", "os": "none",
"panic-strategy": "abort", "panic-strategy": "abort",
"requires-uwtable": true, "requires-uwtable": true,
"force-unwind-tables": "yes",
"relocation-model": "static", "relocation-model": "static",
"target-c-int-width": "32", "target-c-int-width": "32",
"target-endian": "little", "target-endian": "little",

View File

@ -20,7 +20,7 @@ build_zynq = { path = "../libbuild_zynq" }
log = "0.4" log = "0.4"
log_buffer = { version = "1.2" } log_buffer = { version = "1.2" }
crc = { version = "1.7", default-features = false } crc = { version = "1.7", default-features = false }
core_io = { git = "https://git.m-labs.hk/M-Labs/rs-core_io.git", rev = "e9d3edf027", features = ["collections"] } core_io = { git = "https://git.m-labs.hk/srenblad/rs-core_io.git", branch = "main" }
embedded-hal = "0.2" embedded-hal = "0.2"
nb = "1.0" nb = "1.0"
void = { version = "1", default-features = false } void = { version = "1", default-features = false }

View File

@ -5,8 +5,7 @@ pub const MAX_PACKET: usize = 1024;
// maximum size of arbitrary payloads // maximum size of arbitrary payloads
// used by satellite -> master analyzer, subkernel exceptions // used by satellite -> master analyzer, subkernel exceptions
pub const SAT_PAYLOAD_MAX_SIZE: usize = /*max size*/ pub const SAT_PAYLOAD_MAX_SIZE: usize = /*max size*/MAX_PACKET - /*CRC*/4 - /*packet ID*/1 - /*last*/1 - /*length*/2;
MAX_PACKET - /*CRC*/4 - /*packet ID*/1 - /*last*/1 - /*length*/2;
// used by DDMA, subkernel program data (need to provide extra ID and destination) // used by DDMA, subkernel program data (need to provide extra ID and destination)
pub const MASTER_PAYLOAD_MAX_SIZE: usize = SAT_PAYLOAD_MAX_SIZE - /*source*/1 - /*destination*/1 - /*ID*/4; pub const MASTER_PAYLOAD_MAX_SIZE: usize = SAT_PAYLOAD_MAX_SIZE - /*source*/1 - /*destination*/1 - /*ID*/4;

View File

@ -8,7 +8,7 @@ name = "io"
path = "lib.rs" path = "lib.rs"
[dependencies] [dependencies]
core_io = { git = "https://git.m-labs.hk/M-Labs/rs-core_io.git", rev = "e9d3edf027", features = ["collections"] } core_io = { git = "https://git.m-labs.hk/srenblad/rs-core_io.git", branch = "main" }
byteorder = { version = "1.0", default-features = false, optional = true } byteorder = { version = "1.0", default-features = false, optional = true }
libsupport_zynq = { path = "@@ZYNQ_RS@@/libsupport_zynq", default-features = false, features = ["alloc_core"] } libsupport_zynq = { path = "@@ZYNQ_RS@@/libsupport_zynq", default-features = false, features = ["alloc_core"] }

View File

@ -1,6 +1,5 @@
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
use alloc::vec::Vec; use alloc::vec::Vec;
use core::arch::asm;
use core_io::{Error as IoError, Read, Write}; use core_io::{Error as IoError, Read, Write};
@ -48,9 +47,6 @@ impl<T: AsRef<[u8]>> Read for Cursor<T> {
let len = buf.len().min(data.len()); let len = buf.len().min(data.len());
// ``copy_from_slice`` generates AXI bursts, use a regular loop instead // ``copy_from_slice`` generates AXI bursts, use a regular loop instead
for i in 0..len { for i in 0..len {
unsafe {
asm!("", options(preserves_flags, nostack, readonly));
}
buf[i] = data[i]; buf[i] = data[i];
} }
self.pos += len; self.pos += len;
@ -63,9 +59,6 @@ impl Write for Cursor<&mut [u8]> {
let data = &mut self.inner[self.pos..]; let data = &mut self.inner[self.pos..];
let len = buf.len().min(data.len()); let len = buf.len().min(data.len());
for i in 0..len { for i in 0..len {
unsafe {
asm!("", options(preserves_flags, nostack, readonly));
}
data[i] = buf[i]; data[i] = buf[i];
} }
self.pos += len; self.pos += len;

View File

@ -1,6 +1,5 @@
#![no_std] #![no_std]
#![feature(never_type)] #![feature(never_type)]
#![feature(asm)]
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
extern crate alloc; extern crate alloc;

View File

@ -12,7 +12,7 @@ build_zynq = { path = "../libbuild_zynq" }
cslice = "0.3" cslice = "0.3"
log = "0.4" log = "0.4"
nb = "0.1" nb = "0.1"
core_io = { git = "https://git.m-labs.hk/M-Labs/rs-core_io.git", rev = "e9d3edf027", features = ["collections"] } core_io = { git = "https://git.m-labs.hk/srenblad/rs-core_io.git", branch = "main" }
byteorder = { version = "1.3", default-features = false } byteorder = { version = "1.3", default-features = false }
void = { version = "1", default-features = false } void = { version = "1", default-features = false }
log_buffer = { version = "1.2" } log_buffer = { version = "1.2" }
@ -34,7 +34,7 @@ io = { path = "../libio" }
libboard_artiq = { path = "../libboard_artiq" } libboard_artiq = { path = "../libboard_artiq" }
[dependencies.nalgebra] [dependencies.nalgebra]
git = "https://git.m-labs.hk/M-Labs/nalgebra.git" git = "https://git.m-labs.hk/srenblad/nalgebra.git"
rev = "ad42410ab0" rev = "ad42410ab0"
default-features = false default-features = false
features = ["libm", "alloc"] features = ["libm", "alloc"]

View File

@ -96,36 +96,30 @@ struct ExceptionBuffer {
} }
static mut EXCEPTION_BUFFER: ExceptionBuffer = ExceptionBuffer { static mut EXCEPTION_BUFFER: ExceptionBuffer = ExceptionBuffer {
uw_exceptions: [const { uw_exceptions: [const { uw::_Unwind_Exception {
uw::_Unwind_Exception { exception_class: EXCEPTION_CLASS,
exception_class: EXCEPTION_CLASS, exception_cleanup: cleanup,
exception_cleanup: cleanup, private: [0; uw::unwinder_private_data_size],
private: [0; uw::unwinder_private_data_size], }}; MAX_INFLIGHT_EXCEPTIONS],
}
}; MAX_INFLIGHT_EXCEPTIONS],
exceptions: [None; MAX_INFLIGHT_EXCEPTIONS + 1], exceptions: [None; MAX_INFLIGHT_EXCEPTIONS + 1],
exception_stack: [-1; MAX_INFLIGHT_EXCEPTIONS + 1], exception_stack: [-1; MAX_INFLIGHT_EXCEPTIONS + 1],
backtrace: [(0, 0); MAX_BACKTRACE_SIZE], backtrace: [(0, 0); MAX_BACKTRACE_SIZE],
backtrace_size: 0, backtrace_size: 0,
stack_pointers: [const { stack_pointers: [const { StackPointerBacktrace {
StackPointerBacktrace { stack_pointer: 0,
stack_pointer: 0, initial_backtrace_size: 0,
initial_backtrace_size: 0, current_backtrace_size: 0,
current_backtrace_size: 0, }}; MAX_INFLIGHT_EXCEPTIONS + 1],
}
}; MAX_INFLIGHT_EXCEPTIONS + 1],
exception_count: 0, exception_count: 0,
}; };
pub unsafe extern "C" fn reset_exception_buffer() { pub unsafe extern "C" fn reset_exception_buffer() {
trace!("reset exception buffer"); trace!("reset exception buffer");
EXCEPTION_BUFFER.uw_exceptions = [const { EXCEPTION_BUFFER.uw_exceptions = [const { uw::_Unwind_Exception {
uw::_Unwind_Exception { exception_class: EXCEPTION_CLASS,
exception_class: EXCEPTION_CLASS, exception_cleanup: cleanup,
exception_cleanup: cleanup, private: [0; uw::unwinder_private_data_size],
private: [0; uw::unwinder_private_data_size], }}; MAX_INFLIGHT_EXCEPTIONS];
}
}; MAX_INFLIGHT_EXCEPTIONS];
EXCEPTION_BUFFER.exceptions = [None; MAX_INFLIGHT_EXCEPTIONS + 1]; EXCEPTION_BUFFER.exceptions = [None; MAX_INFLIGHT_EXCEPTIONS + 1];
EXCEPTION_BUFFER.exception_stack = [-1; MAX_INFLIGHT_EXCEPTIONS + 1]; EXCEPTION_BUFFER.exception_stack = [-1; MAX_INFLIGHT_EXCEPTIONS + 1];
EXCEPTION_BUFFER.backtrace_size = 0; EXCEPTION_BUFFER.backtrace_size = 0;

View File

@ -82,7 +82,7 @@ pub extern "C" fn dma_record_stop(duration: i64, enable_ddma: bool) {
#[inline(always)] #[inline(always)]
unsafe fn dma_record_output_prepare(timestamp: i64, target: i32, words: usize) { unsafe fn dma_record_output_prepare(timestamp: i64, target: i32, words: usize) {
// See gateware/rtio/dma.py. // See gateware/rtio/dma.py.
const HEADER_LENGTH: usize = /*length*/ 1 + /*channel*/3 + /*timestamp*/8 + /*address*/1; const HEADER_LENGTH: usize = /*length*/1 + /*channel*/3 + /*timestamp*/8 + /*address*/1;
let length = HEADER_LENGTH + /*data*/words * 4; let length = HEADER_LENGTH + /*data*/words * 4;
let buffer = &mut RECORDER.as_mut().unwrap().buffer; let buffer = &mut RECORDER.as_mut().unwrap().buffer;

View File

@ -1,5 +1,4 @@
#![no_std] #![no_std]
#![allow(incomplete_features)]
#![feature(c_variadic)] #![feature(c_variadic)]
#![feature(const_btree_new)] #![feature(const_btree_new)]
#![feature(inline_const)] #![feature(inline_const)]

View File

@ -20,7 +20,7 @@ num-derive = "0.3"
cslice = "0.3" cslice = "0.3"
log = "0.4" log = "0.4"
embedded-hal = "0.2" embedded-hal = "0.2"
core_io = { git = "https://git.m-labs.hk/M-Labs/rs-core_io.git", rev = "e9d3edf027", features = ["collections"] } core_io = { git = "https://git.m-labs.hk/srenblad/rs-core_io.git", branch = "main" }
crc = { version = "1.7", default-features = false } crc = { version = "1.7", default-features = false }
byteorder = { version = "1.3", default-features = false } byteorder = { version = "1.3", default-features = false }
void = { version = "1", default-features = false } void = { version = "1", default-features = false }

View File

@ -10,11 +10,15 @@ use io::Cursor;
#[cfg(has_drtio)] #[cfg(has_drtio)]
use ksupport::rpc; use ksupport::rpc;
use ksupport::{kernel, resolve_channel_name}; use ksupport::{kernel, resolve_channel_name};
#[cfg(has_drtio)]
use libasync::delay;
use libasync::{smoltcp::{Sockets, TcpStream}, use libasync::{smoltcp::{Sockets, TcpStream},
task}; task};
use libboard_artiq::drtio_routing; use libboard_artiq::drtio_routing;
#[cfg(feature = "target_kasli_soc")] #[cfg(feature = "target_kasli_soc")]
use libboard_zynq::error_led::ErrorLED; use libboard_zynq::error_led::ErrorLED;
#[cfg(has_drtio)]
use libboard_zynq::time::Milliseconds;
use libboard_zynq::{self as zynq, use libboard_zynq::{self as zynq,
smoltcp::{self, smoltcp::{self,
iface::{EthernetInterfaceBuilder, NeighborCache}, iface::{EthernetInterfaceBuilder, NeighborCache},

View File

@ -54,7 +54,7 @@ use_field_init_shorthand = false
force_explicit_abi = true force_explicit_abi = true
condense_wildcard_suffixes = false condense_wildcard_suffixes = false
color = "Auto" color = "Auto"
required_version = "1.4.37" required_version = "1.4.32"
unstable_features = false unstable_features = false
disable_all_formatting = false disable_all_formatting = false
skip_children = false skip_children = false
@ -65,4 +65,4 @@ report_todo = "Never"
report_fixme = "Never" report_fixme = "Never"
ignore = [] ignore = []
emit_mode = "Files" emit_mode = "Files"
make_backup = false make_backup = false

View File

@ -16,7 +16,7 @@ build_zynq = { path = "../libbuild_zynq" }
[dependencies] [dependencies]
log = { version = "0.4", default-features = false } log = { version = "0.4", default-features = false }
byteorder = { version = "1.3", default-features = false } byteorder = { version = "1.3", default-features = false }
core_io = { git = "https://git.m-labs.hk/M-Labs/rs-core_io.git", rev = "e9d3edf027", features = ["collections"] } core_io = { git = "https://git.m-labs.hk/srenblad/rs-core_io.git", branch = "main" }
crc = { version = "1.7", default-features = false } crc = { version = "1.7", default-features = false }
cslice = "0.3" cslice = "0.3"
embedded-hal = "0.2" embedded-hal = "0.2"

View File

@ -396,13 +396,9 @@ impl<'a> Manager<'_> {
self.session = Session::new(id); self.session = Session::new(id);
self.control.restart(); self.control.restart();
self.control.tx.send(kernel::Message::LoadRequest( self.control
self.kernels .tx
.get(&id) .send(kernel::Message::LoadRequest(self.kernels.get(&id).ok_or_else(|| Error::KernelNotFound)?.library.clone()));
.ok_or_else(|| Error::KernelNotFound)?
.library
.clone(),
));
let reply = self.control.rx.recv(); let reply = self.control.rx.recv();
match reply { match reply {
kernel::Message::LoadCompleted => Ok(()), kernel::Message::LoadCompleted => Ok(()),