Compare commits

...

16 Commits

16 changed files with 48 additions and 38 deletions

36
flake.lock generated
View File

@ -11,11 +11,11 @@
"src-pythonparser": "src-pythonparser" "src-pythonparser": "src-pythonparser"
}, },
"locked": { "locked": {
"lastModified": 1738745577, "lastModified": 1739435991,
"narHash": "sha256-3pOrZSUb9XHyR6zSG5Ykfo+1+piMXTUjf6RYu/JziNU=", "narHash": "sha256-mmS2XPIh9EeUGvJQYmlHV0k/UCYmQ0HFmhhETKW/t2k=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "9558dd20e1cf3aa0afcaf1acf29202350c040cdc", "rev": "77029874364ff8493081e8000ef964c9ba1ca965",
"revCount": 9146, "revCount": 9155,
"type": "git", "type": "git",
"url": "https://github.com/m-labs/artiq.git" "url": "https://github.com/m-labs/artiq.git"
}, },
@ -70,11 +70,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1736883708, "lastModified": 1739214665,
"narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=", "narHash": "sha256-26L8VAu3/1YRxS8MHgBOyOM8xALdo6N0I04PgorE7UM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "eb62e6aa39ea67e0b8018ba8ea077efe65807dc8", "rev": "64e75cd44acf21c7933d61d7721e812eac1b5a0a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -158,11 +158,11 @@
"src-migen": { "src-migen": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1737001477, "lastModified": 1738906518,
"narHash": "sha256-5Rv7R8OO/CsjdDreo+vCUO7dIrTD+70meV5rIvHOGDk=", "narHash": "sha256-GproDJowtcgbccsT+I0mObzFhE483shcS8MSszKXwlc=",
"owner": "m-labs", "owner": "m-labs",
"repo": "migen", "repo": "migen",
"rev": "28e913e7114dae485747ccd8f9fd436ada2195f0", "rev": "2828df54594673653a641ab551caf6c6b1bfeee5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -174,11 +174,11 @@
"src-misoc": { "src-misoc": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1737003678, "lastModified": 1739428011,
"narHash": "sha256-YGswRUz5QH28FsVK0j4n/Op6ptFTPPdEOir0JkxfSa0=", "narHash": "sha256-ymvkR6ldCp+Kj29YGnaVuoM9Vi2GNxaqPlK0DWOCcgQ=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "3c2054c43309d2fa3b72c5435f90c2357f2908af", "rev": "47a3d8096dfae234599fd5406807cf2d92b6a351",
"revCount": 2465, "revCount": 2473,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/m-labs/misoc.git" "url": "https://github.com/m-labs/misoc.git"
@ -229,11 +229,11 @@
"rust-overlay": "rust-overlay_2" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1736951160, "lastModified": 1739437497,
"narHash": "sha256-bOiSeKEIwSJb62qjT7mqb0JQiqSEYMt6eFuDdGi+7Cw=", "narHash": "sha256-hqsma8ZGBwAcr0OJBcqZLlT8EuhcCW7aYe96Nz153Bs=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "19efdafce7b212cce95ea9b3a20e6f1d388aba9e", "rev": "1c3912e34e43f087a8427509dfb3785b04b6a33e",
"revCount": 667, "revCount": 679,
"type": "git", "type": "git",
"url": "https://git.m-labs.hk/m-labs/zynq-rs" "url": "https://git.m-labs.hk/m-labs/zynq-rs"
}, },

View File

@ -135,13 +135,13 @@
pkgs.gnumake pkgs.gnumake
(pkgs.python3.withPackages(ps: [ ps.jsonschema artiqpkgs.migen migen-axi artiqpkgs.misoc artiqpkgs.artiq ])) (pkgs.python3.withPackages(ps: [ ps.jsonschema artiqpkgs.migen migen-axi artiqpkgs.misoc artiqpkgs.artiq ]))
zynqpkgs.cargo-xbuild zynqpkgs.cargo-xbuild
pkgs.llvmPackages_13.llvm pkgs.llvmPackages_14.llvm
pkgs.llvmPackages_13.clang-unwrapped pkgs.llvmPackages_14.clang-unwrapped
]; ];
buildPhase = '' buildPhase = ''
export ZYNQ_REV=${zynqRev} export ZYNQ_REV=${zynqRev}
export XARGO_RUST_SRC="${rust}/lib/rustlib/src/rust/library" export XARGO_RUST_SRC="${rust}/lib/rustlib/src/rust/library"
export CLANG_EXTRA_INCLUDE_DIR="${pkgs.llvmPackages_13.clang-unwrapped.lib}/lib/clang/13.0.1/include" export CLANG_EXTRA_INCLUDE_DIR="${pkgs.llvmPackages_14.clang-unwrapped.lib}/lib/clang/14.0.6/include"
export CARGO_HOME=$(mktemp -d cargo-home.XXX) export CARGO_HOME=$(mktemp -d cargo-home.XXX)
export ZYNQ_RS=${zynq-rs} export ZYNQ_RS=${zynq-rs}
make TARGET=${target} GWARGS="${if json == null then "-V ${variant}" else json}" ${fwtype} make TARGET=${target} GWARGS="${if json == null then "-V ${variant}" else json}" ${fwtype}
@ -376,8 +376,8 @@
name = "artiq-zynq-dev-shell"; name = "artiq-zynq-dev-shell";
buildInputs = with pkgs; [ buildInputs = with pkgs; [
rust rust
llvmPackages_13.llvm llvmPackages_14.llvm
llvmPackages_13.clang-unwrapped llvmPackages_14.clang-unwrapped
gnumake gnumake
cacert cacert
zynqpkgs.cargo-xbuild zynqpkgs.cargo-xbuild
@ -392,7 +392,7 @@
]; ];
ZYNQ_REV="${zynqRev}"; ZYNQ_REV="${zynqRev}";
XARGO_RUST_SRC = "${rust}/lib/rustlib/src/rust/library"; XARGO_RUST_SRC = "${rust}/lib/rustlib/src/rust/library";
CLANG_EXTRA_INCLUDE_DIR = "${pkgs.llvmPackages_13.clang-unwrapped.lib}/lib/clang/13.0.1/include"; CLANG_EXTRA_INCLUDE_DIR = "${pkgs.llvmPackages_14.clang-unwrapped.lib}/lib/clang/14.0.6/include";
ZYNQ_RS = "${zynq-rs}"; ZYNQ_RS = "${zynq-rs}";
OPENOCD_ZYNQ = "${zynq-rs}/openocd"; OPENOCD_ZYNQ = "${zynq-rs}/openocd";
SZL = "${zynqpkgs.szl}"; SZL = "${zynqpkgs.szl}";

View File

@ -1,7 +1,6 @@
[target.armv7-none-eabihf] [target.armv7-none-eabihf]
rustflags = [ rustflags = [
"-C", "link-arg=-Tlink.x", "-C", "link-arg=-Tlink.x",
"-C", "target-feature=a9,armv7-a,neon",
"-C", "target-cpu=cortex-a9", "-C", "target-cpu=cortex-a9",
] ]

4
src/Cargo.lock generated
View File

@ -82,9 +82,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "compiler_builtins" name = "compiler_builtins"
version = "0.1.49" version = "0.1.70"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20b1438ef42c655665a8ab2c1c6d605a305f031d38d9be689ddfef41a20f3aa2" checksum = "80873f979f0a344a4ade87c2f70d9ccf5720b83b10c97ec7cd745895d021e85a"
[[package]] [[package]]
name = "core_io" name = "core_io"

View File

@ -4,7 +4,7 @@
"emit-debug-gdb-scripts": false, "emit-debug-gdb-scripts": false,
"env": "", "env": "",
"executables": true, "executables": true,
"features": "+v7,+vfp3,-d32,+thumb2,-neon", "features": "+v7,+vfp3,-d32,+thumb2,+neon,+a9,+armv7-a",
"is-builtin": false, "is-builtin": false,
"linker": "rust-lld", "linker": "rust-lld",
"linker-flavor": "ld.lld", "linker-flavor": "ld.lld",

View File

@ -1,4 +1,4 @@
use core::slice; use core::{arch::asm, slice};
use core_io::{Error as IoError, ErrorKind as IoErrorKind}; use core_io::{Error as IoError, ErrorKind as IoErrorKind};
use crc; use crc;
@ -39,6 +39,7 @@ pub fn copy_work_buffer(src: *mut u32, dst: *mut u32, len: isize) {
// fix for artiq-zynq#344 // fix for artiq-zynq#344
unsafe { unsafe {
for i in 0..(len / 4) { for i in 0..(len / 4) {
asm!("", options(preserves_flags, nostack, readonly));
*dst.offset(i) = *src.offset(i); *dst.offset(i) = *src.offset(i);
} }
} }

View File

@ -1,3 +1,5 @@
use core::arch::asm;
use libboard_zynq::{println, stdio}; use libboard_zynq::{println, stdio};
use libcortex_a9::{interrupt_handler, regs::MPIDR}; use libcortex_a9::{interrupt_handler, regs::MPIDR};
use libregister::RegisterR; use libregister::RegisterR;

View File

@ -1,7 +1,6 @@
#![no_std] #![no_std]
#![feature(never_type)] #![feature(never_type)]
#![feature(naked_functions)] #![feature(naked_functions)]
#![feature(asm)]
extern crate core_io; extern crate core_io;
extern crate crc; extern crate crc;

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

@ -1,4 +1,5 @@
use core::sync::atomic::{AtomicBool, Ordering}; use core::{arch::asm,
sync::atomic::{AtomicBool, Ordering}};
use libboard_zynq::{gic, mpcore, println, stdio}; use libboard_zynq::{gic, mpcore, println, stdio};
use libcortex_a9::{asm, interrupt_handler, notify_spin_lock, regs::MPIDR, spin_lock_yield}; use libcortex_a9::{asm, interrupt_handler, notify_spin_lock, regs::MPIDR, spin_lock_yield};

View File

@ -8,7 +8,7 @@ use dyld::{self, elf::EXIDX_Entry, Library};
use libboard_zynq::{gic, mpcore}; use libboard_zynq::{gic, mpcore};
use libcortex_a9::{asm::{dsb, isb}, use libcortex_a9::{asm::{dsb, isb},
cache::{bpiall, dcci_slice, iciallu}, cache::{bpiall, dcci_slice, iciallu},
enable_fpu, sync_channel}; sync_channel};
use libsupport_zynq::ram; use libsupport_zynq::ram;
use log::{debug, error, info}; use log::{debug, error, info};
@ -25,12 +25,14 @@ extern "C" {
} }
unsafe fn attribute_writeback(typeinfo: *const ()) { unsafe fn attribute_writeback(typeinfo: *const ()) {
#[repr(C)]
struct Attr { struct Attr {
offset: usize, offset: usize,
tag: CSlice<'static, u8>, tag: CSlice<'static, u8>,
name: CSlice<'static, u8>, name: CSlice<'static, u8>,
} }
#[repr(C)]
struct Type { struct Type {
attributes: *const *const Attr, attributes: *const *const Attr,
objects: *const *const (), objects: *const *const (),
@ -126,7 +128,6 @@ impl KernelImage {
#[no_mangle] #[no_mangle]
pub extern "C" fn main_core1() { pub extern "C" fn main_core1() {
enable_fpu();
debug!("Core1 started"); debug!("Core1 started");
ram::init_alloc_core1(); ram::init_alloc_core1();

View File

@ -1,10 +1,8 @@
#![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)]
#![feature(naked_functions)] #![feature(naked_functions)]
#![feature(asm)]
#[macro_use] #[macro_use]
extern crate alloc; extern crate alloc;

View File

@ -4,6 +4,7 @@
#![feature(alloc_error_handler)] #![feature(alloc_error_handler)]
#![feature(const_btree_new)] #![feature(const_btree_new)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
#![feature(lang_items)]
#[macro_use] #[macro_use]
extern crate alloc; extern crate alloc;

View File

@ -71,3 +71,7 @@ fn soft_panic(info: &core::panic::PanicInfo) -> ! {
}; };
soft_panic_main(timer, cfg); soft_panic_main(timer, cfg);
} }
#[lang = "eh_personality"]
#[no_mangle]
pub extern "C" fn rust_eh_personality() {}

View File

@ -19,7 +19,7 @@ fn_single_line = false
where_single_line = true where_single_line = true
imports_indent = "Visual" imports_indent = "Visual"
imports_layout = "Mixed" imports_layout = "Mixed"
merge_imports = true imports_granularity = "Crate"
group_imports = "StdExternalCrate" group_imports = "StdExternalCrate"
reorder_imports = true reorder_imports = true
reorder_modules = true reorder_modules = true
@ -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.38"
unstable_features = false unstable_features = false
disable_all_formatting = false disable_all_formatting = false
skip_children = false skip_children = false

View File

@ -1,6 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#![feature(alloc_error_handler, never_type, panic_info_message)] #![feature(alloc_error_handler, never_type, panic_info_message)]
#![feature(lang_items)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -1810,3 +1811,7 @@ pub fn panic_fmt(info: &core::panic::PanicInfo) -> ! {
loop {} loop {}
} }
#[lang = "eh_personality"]
#[no_mangle]
pub extern "C" fn rust_eh_personality() {}