Skip to content

Commit 3c6622a

Browse files
committed
Support for the ESP-IDF framework
1 parent c67765d commit 3c6622a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ jobs:
4242
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
4343
if: startsWith(matrix.rust, 'nightly')
4444
run: cargo check -Z features=dev_dep
45+
- name: Add rust-src
46+
if: startsWith(matrix.rust, 'nightly')
47+
run: rustup component add rust-src
48+
# - name: Check selected Tier 3 targets
49+
# if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
50+
# run: cargo check -Z build-std --target=riscv32imc-esp-espidf
4551
- run: cargo test
4652

4753
# Copied from: https://github.com/rust-lang/stacker/pull/19/files

src/reactor.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ cfg_if::cfg_if! {
4343
}
4444
}
4545

46+
#[cfg(not(target_os = "espidf"))]
47+
const TIMER_QUEUE_SIZE: usize = 1000;
48+
49+
/// ESP-IDF - being an embedded OS - does not need so many timers
50+
/// and this saves ~ 20K RAM which is a lot for an MCU with RAM < 400K
51+
#[cfg(target_os = "espidf")]
52+
const TIMER_QUEUE_SIZE: usize = 100;
53+
4654
const READ: usize = 0;
4755
const WRITE: usize = 1;
4856

@@ -98,7 +106,7 @@ impl Reactor {
98106
sources: Mutex::new(Slab::new()),
99107
events: Mutex::new(Vec::new()),
100108
timers: Mutex::new(BTreeMap::new()),
101-
timer_ops: ConcurrentQueue::bounded(1000),
109+
timer_ops: ConcurrentQueue::bounded(TIMER_QUEUE_SIZE),
102110
}
103111
})
104112
}

0 commit comments

Comments
 (0)