From 22531b14c0205df2f1c6a8c18535f1e47f2515ea Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 28 Apr 2020 19:46:33 +0800 Subject: [PATCH] sync with zc706 repos --- Cargo.lock | 10 ++++----- runtime/link.x | 49 +++++++++++++++++++++++-------------------- runtime/src/comms.rs | 2 +- runtime/src/kernel.rs | 7 +++---- szl/link.x | 45 +++++++++++++++++++++------------------ szl/src/main.rs | 5 +---- 6 files changed, 61 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9b53e06..9013815 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,7 +150,7 @@ dependencies = [ [[package]] name = "libasync" version = "0.0.0" -source = "git+https://git.m-labs.hk/M-Labs/zc706.git#614b1ef350edd8576fc71292fc89cf79a1810aba" +source = "git+https://git.m-labs.hk/M-Labs/zc706.git#83ff37e10e721c436246fbf4a945af9516121d00" dependencies = [ "embedded-hal", "libcortex_a9", @@ -162,7 +162,7 @@ dependencies = [ [[package]] name = "libboard_zynq" version = "0.0.0" -source = "git+https://git.m-labs.hk/M-Labs/zc706.git#614b1ef350edd8576fc71292fc89cf79a1810aba" +source = "git+https://git.m-labs.hk/M-Labs/zc706.git#83ff37e10e721c436246fbf4a945af9516121d00" dependencies = [ "bit_field", "embedded-hal", @@ -177,7 +177,7 @@ dependencies = [ [[package]] name = "libcortex_a9" version = "0.0.0" -source = "git+https://git.m-labs.hk/M-Labs/zc706.git#614b1ef350edd8576fc71292fc89cf79a1810aba" +source = "git+https://git.m-labs.hk/M-Labs/zc706.git#83ff37e10e721c436246fbf4a945af9516121d00" dependencies = [ "bit_field", "libregister", @@ -186,7 +186,7 @@ dependencies = [ [[package]] name = "libregister" version = "0.0.0" -source = "git+https://git.m-labs.hk/M-Labs/zc706.git#614b1ef350edd8576fc71292fc89cf79a1810aba" +source = "git+https://git.m-labs.hk/M-Labs/zc706.git#83ff37e10e721c436246fbf4a945af9516121d00" dependencies = [ "bit_field", "vcell", @@ -196,7 +196,7 @@ dependencies = [ [[package]] name = "libsupport_zynq" version = "0.0.0" -source = "git+https://git.m-labs.hk/M-Labs/zc706.git#614b1ef350edd8576fc71292fc89cf79a1810aba" +source = "git+https://git.m-labs.hk/M-Labs/zc706.git#83ff37e10e721c436246fbf4a945af9516121d00" dependencies = [ "compiler_builtins", "libboard_zynq", diff --git a/runtime/link.x b/runtime/link.x index 9d9e33c..5860fb1 100644 --- a/runtime/link.x +++ b/runtime/link.x @@ -1,8 +1,5 @@ ENTRY(_boot_cores); -STACK_SIZE = 0x8000; -HEAP_SIZE = 0x1000000; - /* Provide some defaults */ PROVIDE(Reset = _boot_cores); PROVIDE(UndefinedInstruction = Reset); @@ -15,7 +12,7 @@ PROVIDE(FIQ = Reset); MEMORY { - SDRAM : ORIGIN = 0x00100000, LENGTH = 0x1FF00000 + SDRAM : ORIGIN = 0x00100000, LENGTH = 0x1FF00000 } SECTIONS @@ -37,35 +34,41 @@ SECTIONS *(.data .data.*); } > SDRAM - .bss (NOLOAD) : ALIGN(0x4000) + .bss (NOLOAD) : ALIGN(4) { - /* Aligned to 16 kB */ + __bss_start = .; KEEP(*(.bss.l1_table)); *(.bss .bss.*); . = ALIGN(4); + __bss_end = .; } > SDRAM - __bss_start = ADDR(.bss); - __bss_end = ADDR(.bss) + SIZEOF(.bss); - .heap (NOLOAD) : ALIGN(0x1000) + .heap (NOLOAD) : ALIGN(8) { - . += HEAP_SIZE; + __heap_start = .; + . += 0x1000000; + __heap_end = .; } > SDRAM - __heap_start = ADDR(.heap); - __heap_end = ADDR(.heap) + SIZEOF(.heap); - .stack (NOLOAD) : ALIGN(0x1000) + .stack1 (NOLOAD) : ALIGN(8) { - . += STACK_SIZE; + __stack1_end = .; + . += 0x1000000; + __stack1_start = .; } > SDRAM - __stack_end = ADDR(.stack); - __stack_start = ADDR(.stack) + SIZEOF(.stack); - /DISCARD/ : - { - /* Unused exception related info that only wastes space */ - *(.ARM.exidx); - *(.ARM.exidx.*); - *(.ARM.extab.*); - } + .stack0 (NOLOAD) : ALIGN(8) + { + __stack0_end = .; + . += 0x1000000; + __stack0_start = .; + } > SDRAM + + /DISCARD/ : + { + /* Unused exception related info that only wastes space */ + *(.ARM.exidx); + *(.ARM.exidx.*); + *(.ARM.extab.*); + } } diff --git a/runtime/src/comms.rs b/runtime/src/comms.rs index 5f15bb9..51796ff 100644 --- a/runtime/src/comms.rs +++ b/runtime/src/comms.rs @@ -194,7 +194,7 @@ pub fn main(timer: GlobalTimer) { Sockets::init(32); - let control: Rc> = Rc::new(RefCell::new(kernel::Control::start(8192))); + let control: Rc> = Rc::new(RefCell::new(kernel::Control::start())); task::spawn(async move { loop { let stream = TcpStream::accept(1381, 2048, 2048).await.unwrap(); diff --git a/runtime/src/kernel.rs b/runtime/src/kernel.rs index a1ce03e..18fffaf 100644 --- a/runtime/src/kernel.rs +++ b/runtime/src/kernel.rs @@ -21,15 +21,14 @@ static CHANNEL_0TO1: Mutex>> = Mutex::new static CHANNEL_1TO0: Mutex>> = Mutex::new(None); pub struct Control { - core1: Core1>, + core1: Core1, pub tx: sync_channel::Sender, pub rx: sync_channel::Receiver, } impl Control { - pub fn start(stack_size: usize) -> Self { - let stack = vec![0; stack_size / 4]; - let core1 = Core1::start(stack); + pub fn start() -> Self { + let core1 = Core1::start(); let (core0_tx, core1_rx) = sync_channel(4); let (core1_tx, core0_rx) = sync_channel(4); diff --git a/szl/link.x b/szl/link.x index bc6bebe..a98d5a9 100644 --- a/szl/link.x +++ b/szl/link.x @@ -1,7 +1,5 @@ ENTRY(_boot_cores); -STACK_SIZE = 0x8000; - /* Provide some defaults */ PROVIDE(Reset = _boot_cores); PROVIDE(UndefinedInstruction = Reset); @@ -14,9 +12,9 @@ PROVIDE(FIQ = Reset); MEMORY { - /* 256 kB On-Chip Memory */ - OCM : ORIGIN = 0, LENGTH = 0x30000 - OCM3 : ORIGIN = 0xFFFF0000, LENGTH = 0x10000 + /* 256 kB On-Chip Memory */ + OCM : ORIGIN = 0, LENGTH = 0x30000 + OCM3 : ORIGIN = 0xFFFF0000, LENGTH = 0x10000 } SECTIONS @@ -38,27 +36,34 @@ SECTIONS *(.data .data.*); } > OCM - .bss (NOLOAD) : ALIGN(0x4000) + .bss (NOLOAD) : ALIGN(4) { - /* Aligned to 16 kB */ + __bss_start = .; KEEP(*(.bss.l1_table)); *(.bss .bss.*); . = ALIGN(4); + __bss_end = .; } > OCM - __bss_start = ADDR(.bss); - __bss_end = ADDR(.bss) + SIZEOF(.bss); - .stack (NOLOAD) : ALIGN(0x1000) { - . += STACK_SIZE; + .stack1 (NOLOAD) : ALIGN(8) + { + __stack1_end = .; + . += 0x4000; + __stack1_start = .; } > OCM - __stack_end = ADDR(.stack); - __stack_start = ADDR(.stack) + SIZEOF(.stack); - /DISCARD/ : - { - /* Unused exception related info that only wastes space */ - *(.ARM.exidx); - *(.ARM.exidx.*); - *(.ARM.extab.*); - } + .stack0 (NOLOAD) : ALIGN(8) + { + __stack0_end = .; + . += 0x4000; + __stack0_start = .; + } > OCM + + /DISCARD/ : + { + /* Unused exception related info that only wastes space */ + *(.ARM.exidx); + *(.ARM.exidx.*); + *(.ARM.extab.*); + } } diff --git a/szl/src/main.rs b/szl/src/main.rs index c5f46be..1a8fb65 100644 --- a/szl/src/main.rs +++ b/szl/src/main.rs @@ -14,8 +14,6 @@ use libboard_zynq::{ use libsupport_zynq::{boot, logger}; -static mut STACK_CORE1: [u32; 512] = [0; 512]; - extern "C" { fn unlzma_simple(buf: *const u8, in_len: i32, output: *mut u8, @@ -49,8 +47,7 @@ pub fn main_core0() { if result < 0 { error!("decompression failed"); } else { - let core1_stack = unsafe { &mut STACK_CORE1[..] }; - boot::Core1::start(core1_stack); + boot::Core1::start(); info!("executing payload"); unsafe { (mem::transmute::<*mut u8, fn()>(ddr.ptr::()))();