forked from M-Labs/zynq-rs
Compare commits
7 Commits
24c804e6f0
...
0cf28a92fd
Author | SHA1 | Date |
---|---|---|
morgan | 0cf28a92fd | |
morgan | c5e6deb44a | |
morgan | 4168eb63a7 | |
Sebastien Bourdeauducq | a43b8bf64e | |
Sebastien Bourdeauducq | 91bae572f9 | |
Sebastien Bourdeauducq | 301f9236e5 | |
Sebastien Bourdeauducq | 55b36ee37e |
|
@ -18,5 +18,5 @@ embedded-hal = "0.2"
|
||||||
libregister = { path = "../libregister" }
|
libregister = { path = "../libregister" }
|
||||||
libcortex_a9 = { path = "../libcortex_a9" }
|
libcortex_a9 = { path = "../libcortex_a9" }
|
||||||
libboard_zynq = { path = "../libboard_zynq" }
|
libboard_zynq = { path = "../libboard_zynq" }
|
||||||
libsupport_zynq = { path = "../libsupport_zynq", default-features = false, features = ["panic_handler"]}
|
libsupport_zynq = { path = "../libsupport_zynq", default-features = false, features = ["panic_handler", "dummy_fiq_handler"]}
|
||||||
libasync = { path = "../libasync" }
|
libasync = { path = "../libasync" }
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1697655685,
|
"lastModified": 1701389149,
|
||||||
"narHash": "sha256-79Kuv+QdgsVc+rkibuAgWHnh8IXrLBTOKg5nM0Qvux0=",
|
"narHash": "sha256-rU1suTIEd5DGCaAXKW6yHoCfR1mnYjOXQFOaH7M23js=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "80c1aab725151632ddc2a20caeb914e76dd0673c",
|
"rev": "5de0b32be6e85dc1a9404c75131316e4ffbc634c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-23.05",
|
"ref": "nixos-23.11",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
46
flake.nix
46
flake.nix
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
description = "Bare-metal Rust on Zynq-7000";
|
description = "Bare-metal Rust on Zynq-7000";
|
||||||
|
|
||||||
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
|
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.11;
|
||||||
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
||||||
|
|
||||||
outputs = { self, nixpkgs, mozilla-overlay }:
|
outputs = { self, nixpkgs, mozilla-overlay }:
|
||||||
|
@ -139,26 +139,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
cargo-xbuild = rustPlatform.buildRustPackage rec {
|
|
||||||
pname = "cargo-xbuild";
|
|
||||||
version = "0.6.5";
|
|
||||||
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "rust-osdev";
|
|
||||||
repo = pname;
|
|
||||||
rev = "v${version}";
|
|
||||||
sha256 = "18djvygq9v8rmfchvi2hfj0i6fhn36m716vqndqnj56fiqviwxvf";
|
|
||||||
};
|
|
||||||
cargoSha256 = "13sj9j9kl6js75h9xq0yidxy63vixxm9q3f8jil6ymarml5wkhx8";
|
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
|
||||||
description = "Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc";
|
|
||||||
homepage = "https://github.com/rust-osdev/cargo-xbuild";
|
|
||||||
license = with licenses; [ mit asl20 ];
|
|
||||||
maintainers = with maintainers; [ johntitor xrelkd ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mkbootimage = pkgs.stdenv.mkDerivation {
|
mkbootimage = pkgs.stdenv.mkDerivation {
|
||||||
pname = "mkbootimage";
|
pname = "mkbootimage";
|
||||||
version = "2.3dev";
|
version = "2.3dev";
|
||||||
|
@ -180,6 +160,7 @@
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp mkbootimage $out/bin
|
cp mkbootimage $out/bin
|
||||||
'';
|
'';
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fsbl = { board ? "zc706" }: pkgs.stdenv.mkDerivation {
|
fsbl = { board ? "zc706" }: pkgs.stdenv.mkDerivation {
|
||||||
|
@ -213,6 +194,10 @@
|
||||||
dontFixup = true;
|
dontFixup = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cargo-xbuild = pkgs.cargo-xbuild.overrideAttrs(oa: {
|
||||||
|
postPatch = "substituteInPlace src/sysroot.rs --replace 2021 2018";
|
||||||
|
});
|
||||||
|
|
||||||
build-crate = name: crate: features: rustPlatform.buildRustPackage rec {
|
build-crate = name: crate: features: rustPlatform.buildRustPackage rec {
|
||||||
name = "${crate}";
|
name = "${crate}";
|
||||||
|
|
||||||
|
@ -240,6 +225,7 @@
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
dontFixup = true;
|
dontFixup = true;
|
||||||
|
auditable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
targetCrates = target: {
|
targetCrates = target: {
|
||||||
|
@ -269,16 +255,16 @@
|
||||||
|
|
||||||
devShell.x86_64-linux = pkgs.mkShell {
|
devShell.x86_64-linux = pkgs.mkShell {
|
||||||
name = "zynq-rs-dev-shell";
|
name = "zynq-rs-dev-shell";
|
||||||
buildInputs = with pkgs; [
|
buildInputs = [
|
||||||
rust
|
rust
|
||||||
cacert
|
|
||||||
cargo-xbuild
|
cargo-xbuild
|
||||||
|
mkbootimage
|
||||||
|
|
||||||
openocd gdb
|
pkgs.openocd pkgs.gdb
|
||||||
openssh rsync
|
pkgs.openssh pkgs.rsync
|
||||||
llvmPackages_14.clang-unwrapped
|
pkgs.llvmPackages_14.clang-unwrapped
|
||||||
(python3.withPackages(ps: [ ps.pyftdi ]))
|
(pkgs.python3.withPackages(ps: [ ps.pyftdi ]))
|
||||||
mkbootimage ];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ impl InterruptController {
|
||||||
let m = (id.0 >> 2) as usize;
|
let m = (id.0 >> 2) as usize;
|
||||||
let n = (8 * (id.0 & 3)) as usize;
|
let n = (8 * (id.0 & 3)) as usize;
|
||||||
unsafe {
|
unsafe {
|
||||||
self.mpcore.icdiptr[m].modify(|mut icdiptr| *icdiptr.set_bits(n..=n+1, target_cpu as u32 + 1));
|
self.mpcore.icdiptr[m].modify(|mut icdiptr| *icdiptr.set_bits(n..=n+1, target_cpu as u32));
|
||||||
}
|
}
|
||||||
|
|
||||||
// sensitivity
|
// sensitivity
|
||||||
|
|
|
@ -34,6 +34,12 @@ pub fn isb() {
|
||||||
unsafe { llvm_asm!("isb" :::: "volatile") }
|
unsafe { llvm_asm!("isb" :::: "volatile") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Enable FIQ
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn enable_fiq() {
|
||||||
|
llvm_asm!("cpsie f":::: "volatile");
|
||||||
|
}
|
||||||
|
|
||||||
/// Enable IRQ
|
/// Enable IRQ
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn enable_irq() {
|
pub unsafe fn enable_irq() {
|
||||||
|
|
|
@ -12,9 +12,10 @@ target_redpitaya = ["libboard_zynq/target_redpitaya"]
|
||||||
target_kasli_soc = ["libboard_zynq/target_kasli_soc"]
|
target_kasli_soc = ["libboard_zynq/target_kasli_soc"]
|
||||||
panic_handler = []
|
panic_handler = []
|
||||||
dummy_irq_handler = []
|
dummy_irq_handler = []
|
||||||
|
dummy_fiq_handler = []
|
||||||
alloc_core = []
|
alloc_core = []
|
||||||
|
|
||||||
default = ["panic_handler", "dummy_irq_handler"]
|
default = ["panic_handler", "dummy_irq_handler", "dummy_fiq_handler"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
r0 = "1"
|
r0 = "1"
|
||||||
|
|
|
@ -42,6 +42,7 @@ interrupt_handler!(IRQ, irq, __irq_stack0_start, __irq_stack1_start, {
|
||||||
loop {}
|
loop {}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[cfg(feature = "dummy_fiq_handler")]
|
||||||
interrupt_handler!(FIQ, fiq, __irq_stack0_start, __irq_stack1_start, {
|
interrupt_handler!(FIQ, fiq, __irq_stack0_start, __irq_stack1_start, {
|
||||||
stdio::drop_uart();
|
stdio::drop_uart();
|
||||||
println!("FIQ");
|
println!("FIQ");
|
||||||
|
|
|
@ -54,6 +54,7 @@ unsafe extern "C" fn boot_core0() -> ! {
|
||||||
asm::dmb();
|
asm::dmb();
|
||||||
asm::dsb();
|
asm::dsb();
|
||||||
|
|
||||||
|
asm::enable_fiq();
|
||||||
asm::enable_irq();
|
asm::enable_irq();
|
||||||
main_core0();
|
main_core0();
|
||||||
panic!("return from main");
|
panic!("return from main");
|
||||||
|
@ -75,6 +76,7 @@ unsafe extern "C" fn boot_core1() -> ! {
|
||||||
asm::dmb();
|
asm::dmb();
|
||||||
asm::dsb();
|
asm::dsb();
|
||||||
|
|
||||||
|
asm::enable_fiq();
|
||||||
asm::enable_irq();
|
asm::enable_irq();
|
||||||
main_core1();
|
main_core1();
|
||||||
panic!("return from main_core1");
|
panic!("return from main_core1");
|
||||||
|
|
Loading…
Reference in New Issue