From ac83bfbd8ed653065648c74b087f6abec837f0c0 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 20 Aug 2017 11:28:57 -0400 Subject: [PATCH] runtime: add support for targets without SPI flash --- artiq/firmware/runtime/config_dummy.rs | 19 +++++++++++++++++++ artiq/firmware/runtime/lib.rs | 3 +++ 2 files changed, 22 insertions(+) create mode 100644 artiq/firmware/runtime/config_dummy.rs diff --git a/artiq/firmware/runtime/config_dummy.rs b/artiq/firmware/runtime/config_dummy.rs new file mode 100644 index 000000000..2680c9ab6 --- /dev/null +++ b/artiq/firmware/runtime/config_dummy.rs @@ -0,0 +1,19 @@ +pub fn read) -> R, R>(_key: &str, f: F) -> R { + f(Err(())) +} + +pub fn read_str) -> R, R>(_key: &str, f: F) -> R { + f(Err(())) +} + +pub fn write(_key: &str, _value: &[u8]) -> Result<(), ()> { + Err(()) +} + +pub fn remove(_key: &str) -> Result<(), ()> { + Err(()) +} + +pub fn erase() -> Result<(), ()> { + Err(()) +} diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index 67baaa08a..f679eba28 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -36,7 +36,10 @@ macro_rules! borrow_mut { }) } +#[cfg(has_spiflash)] mod config; +#[cfg(not(has_spiflash))] +#[path="config_dummy.rs"] mod config; mod ethmac; mod rtio_mgt;