misc runtime patch #103

Merged
sb10q merged 3 commits from pca006132/artiq-zynq:runtime into master 2020-09-02 10:15:52 +08:00
7 changed files with 15 additions and 11 deletions

View File

@ -15,7 +15,7 @@ let
version = "0.1.0";
src = ./src;
cargoSha256 = "0mf4jyhirkz3grcp2459b8rhw36xkx3rhpz6af0j4knyxb2w707n";
cargoSha256 = "1r8yjzixkknivawi286iyjjhaf5q8ll3a53q54dc9m9dhx20358b";
nativeBuildInputs = [
pkgs.gnumake

10
src/Cargo.lock generated
View File

@ -187,7 +187,7 @@ dependencies = [
[[package]]
name = "libasync"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#a73df780d0d0e757738f27feac162904f5bf93f9"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#157439bc88cbb18bb40009428acf1fdee800e32e"
dependencies = [
"embedded-hal",
"libcortex_a9",
@ -199,7 +199,7 @@ dependencies = [
[[package]]
name = "libboard_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#a73df780d0d0e757738f27feac162904f5bf93f9"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#157439bc88cbb18bb40009428acf1fdee800e32e"
dependencies = [
"bit_field",
"embedded-hal",
@ -233,7 +233,7 @@ dependencies = [
[[package]]
name = "libcortex_a9"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#a73df780d0d0e757738f27feac162904f5bf93f9"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#157439bc88cbb18bb40009428acf1fdee800e32e"
dependencies = [
"bit_field",
"libregister",
@ -249,7 +249,7 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]]
name = "libregister"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#a73df780d0d0e757738f27feac162904f5bf93f9"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#157439bc88cbb18bb40009428acf1fdee800e32e"
dependencies = [
"bit_field",
"vcell",
@ -259,7 +259,7 @@ dependencies = [
[[package]]
name = "libsupport_zynq"
version = "0.0.0"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#a73df780d0d0e757738f27feac162904f5bf93f9"
source = "git+https://git.m-labs.hk/M-Labs/zynq-rs.git#157439bc88cbb18bb40009428acf1fdee800e32e"
dependencies = [
"compiler_builtins",
"libboard_zynq",

View File

@ -24,7 +24,7 @@ overflow-checks = false
panic = "abort"
debug = true
codegen-units = 1
opt-level = 's'
opt-level = 2
lto = true
[patch.crates-io]

View File

@ -49,10 +49,10 @@ SECTIONS
.heap (NOLOAD) : ALIGN(8)
{
__heap0_start = .;
. += 0x800000;
. += 0x8000000;
__heap0_end = .;
__heap1_start = .;
. += 0x800000;
. += 0x8000000;
__heap1_end = .;
} > SDRAM

View File

@ -1,7 +1,7 @@
use libcortex_a9::sync_channel::{Sender, Receiver};
use libsupport_zynq::boot::Core1;
use super::{CHANNEL_0TO1, CHANNEL_1TO0, INIT_LOCK, Message};
use super::{CHANNEL_0TO1, CHANNEL_1TO0, CHANNEL_SEM, INIT_LOCK, Message};
use crate::irq::restart_core1;
use core::mem::{forget, replace};
@ -12,6 +12,7 @@ pub struct Control {
}
fn get_channels() -> (Sender<'static, Message>, Receiver<'static, Message>) {
CHANNEL_SEM.wait();
let mut core0_tx = None;
while core0_tx.is_none() {
core0_tx = CHANNEL_0TO1.lock().take();

View File

@ -20,6 +20,7 @@ use super::{
rpc::rpc_send_async,
INIT_LOCK,
CHANNEL_0TO1, CHANNEL_1TO0,
CHANNEL_SEM,
KERNEL_CHANNEL_0TO1, KERNEL_CHANNEL_1TO0,
KERNEL_IMAGE,
Message,
@ -159,6 +160,7 @@ pub fn main_core1() {
}
*CHANNEL_0TO1.lock() = Some(core0_tx);
*CHANNEL_1TO0.lock() = Some(core0_rx);
CHANNEL_SEM.signal();
// set on load, cleared on start
let mut loaded_kernel = None;

View File

@ -1,7 +1,7 @@
use core::ptr;
use alloc::{vec::Vec, string::String};
use libcortex_a9::{mutex::Mutex, sync_channel};
use libcortex_a9::{mutex::Mutex, sync_channel, semaphore::Semaphore};
use crate::eh_artiq;
mod control;
@ -48,6 +48,7 @@ pub enum Message {
static CHANNEL_0TO1: Mutex<Option<sync_channel::Sender<'static, Message>>> = Mutex::new(None);
static CHANNEL_1TO0: Mutex<Option<sync_channel::Receiver<'static, Message>>> = Mutex::new(None);
static CHANNEL_SEM: Semaphore = Semaphore::new(0, 1);
static mut KERNEL_CHANNEL_0TO1: Option<sync_channel::Receiver<'static, Message>> = None;
static mut KERNEL_CHANNEL_1TO0: Option<sync_channel::Sender<'static, Message>> = None;