This commit is contained in:
2025-02-26 15:42:57 +01:00
parent 884bc29146
commit e23f8cb81e
8 changed files with 189 additions and 42 deletions

View File

@ -13,3 +13,4 @@ categories = ["embedded", "no-std", "hardware-support"]
[dependencies]
cortex-ar = { path = "../../cortex-ar/cortex-ar" }
zynq7000-rt = { path = "../zynq7000-rt" }
zynq7000 = { path = "../zynq7000" }

View File

@ -2,9 +2,12 @@
#![no_main]
use core::panic::PanicInfo;
use cortex_r_a::asm::nop;
use cortex_ar::asm::nop;
use zynq7000_rt as _;
/// One user LED is MIO7
const ZEDBOARD_LED_MASK: u32 = 1 << 7;
/// Entry point (not called like a normal main function)
#[unsafe(no_mangle)]
pub extern "C" fn boot_core(cpu_id: u32) -> ! {
@ -16,8 +19,14 @@ pub extern "C" fn boot_core(cpu_id: u32) -> ! {
#[unsafe(export_name = "main")]
pub fn main() -> ! {
let mut gpio = unsafe { zynq7000::Gpio::new_mmio_fixed() };
gpio.write_xgpiops_dirm_offset(ZEDBOARD_LED_MASK);
gpio.write_xgpiops_outen_offset(ZEDBOARD_LED_MASK);
loop {
nop();
gpio.modify_xgpiops_data_offset(|v| v ^ ZEDBOARD_LED_MASK);
for _ in 0..1_000_000 {
nop();
}
}
}