commit
58280048e3
5
ci.sh
5
ci.sh
@ -196,8 +196,9 @@ cargo batch \
|
|||||||
--- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \
|
--- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \
|
||||||
$BUILD_EXTRA
|
$BUILD_EXTRA
|
||||||
|
|
||||||
# temporarily disabled: broken by nightly update and/or clock settings update.
|
|
||||||
rm out/tests/stm32f429zi/stop
|
rm out/tests/stm32wb55rg/wpan_mac
|
||||||
|
rm out/tests/stm32wb55rg/wpan_ble
|
||||||
|
|
||||||
if [[ -z "${TELEPROBE_TOKEN-}" ]]; then
|
if [[ -z "${TELEPROBE_TOKEN-}" ]]; then
|
||||||
echo No teleprobe token found, skipping running HIL tests
|
echo No teleprobe token found, skipping running HIL tests
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
|
use atomic_polyfill::{compiler_fence, Ordering};
|
||||||
use cortex_m::peripheral::SCB;
|
use cortex_m::peripheral::SCB;
|
||||||
use embassy_executor::*;
|
use embassy_executor::*;
|
||||||
|
|
||||||
@ -67,10 +68,8 @@ impl Executor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn on_wakeup_irq(&mut self) {
|
unsafe fn on_wakeup_irq(&mut self) {
|
||||||
trace!("low power: on wakeup irq");
|
|
||||||
|
|
||||||
self.time_driver.resume_time();
|
self.time_driver.resume_time();
|
||||||
trace!("low power: resume time");
|
trace!("low power: resume");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(self) fn stop_with_rtc(&mut self, rtc: &'static Rtc) {
|
pub(self) fn stop_with_rtc(&mut self, rtc: &'static Rtc) {
|
||||||
@ -82,21 +81,18 @@ impl Executor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn configure_pwr(&mut self) {
|
fn configure_pwr(&mut self) {
|
||||||
trace!("low power: configure_pwr");
|
|
||||||
|
|
||||||
self.scb.clear_sleepdeep();
|
self.scb.clear_sleepdeep();
|
||||||
|
|
||||||
|
compiler_fence(Ordering::SeqCst);
|
||||||
|
|
||||||
if !low_power_ready() {
|
if !low_power_ready() {
|
||||||
trace!("low power: configure_pwr: low power not ready");
|
trace!("low power: not ready to stop");
|
||||||
return;
|
} else if self.time_driver.pause_time().is_err() {
|
||||||
|
trace!("low power: failed to pause time");
|
||||||
|
} else {
|
||||||
|
trace!("low power: stop");
|
||||||
|
self.scb.set_sleepdeep();
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.time_driver.pause_time().is_err() {
|
|
||||||
trace!("low power: configure_pwr: time driver failed to pause");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
trace!("low power: enter stop...");
|
|
||||||
self.scb.set_sleepdeep();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run the executor.
|
/// Run the executor.
|
||||||
|
@ -111,8 +111,7 @@ static CLOCK_REFCOUNT: AtomicU32 = AtomicU32::new(0);
|
|||||||
|
|
||||||
#[cfg(feature = "low-power")]
|
#[cfg(feature = "low-power")]
|
||||||
pub fn low_power_ready() -> bool {
|
pub fn low_power_ready() -> bool {
|
||||||
trace!("clock refcount: {}", CLOCK_REFCOUNT.load(Ordering::SeqCst));
|
// trace!("clock refcount: {}", CLOCK_REFCOUNT.load(Ordering::SeqCst));
|
||||||
|
|
||||||
CLOCK_REFCOUNT.load(Ordering::SeqCst) == 0
|
CLOCK_REFCOUNT.load(Ordering::SeqCst) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,25 +112,26 @@ impl super::Rtc {
|
|||||||
pub(crate) fn stop_wakeup_alarm(&self, cs: critical_section::CriticalSection) -> Option<embassy_time::Duration> {
|
pub(crate) fn stop_wakeup_alarm(&self, cs: critical_section::CriticalSection) -> Option<embassy_time::Duration> {
|
||||||
use crate::interrupt::typelevel::Interrupt;
|
use crate::interrupt::typelevel::Interrupt;
|
||||||
|
|
||||||
trace!("rtc: stop wakeup alarm at {}", self.instant());
|
if RTC::regs().cr().read().wute() {
|
||||||
|
trace!("rtc: stop wakeup alarm at {}", self.instant());
|
||||||
|
|
||||||
self.write(false, |regs| {
|
self.write(false, |regs| {
|
||||||
regs.cr().modify(|w| w.set_wutie(false));
|
regs.cr().modify(|w| w.set_wutie(false));
|
||||||
regs.cr().modify(|w| w.set_wute(false));
|
regs.cr().modify(|w| w.set_wute(false));
|
||||||
regs.isr().modify(|w| w.set_wutf(false));
|
regs.isr().modify(|w| w.set_wutf(false));
|
||||||
|
|
||||||
crate::pac::EXTI
|
crate::pac::EXTI
|
||||||
.pr(0)
|
.pr(0)
|
||||||
.modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true));
|
.modify(|w| w.set_line(RTC::EXTI_WAKEUP_LINE, true));
|
||||||
|
|
||||||
<RTC as crate::rtc::sealed::Instance>::WakeupInterrupt::unpend();
|
<RTC as crate::rtc::sealed::Instance>::WakeupInterrupt::unpend();
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(stop_time) = self.stop_time.borrow(cs).take() {
|
|
||||||
Some(self.instant() - stop_time)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.stop_time
|
||||||
|
.borrow(cs)
|
||||||
|
.take()
|
||||||
|
.map(|stop_time| self.instant() - stop_time)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "low-power")]
|
#[cfg(feature = "low-power")]
|
||||||
|
@ -340,7 +340,11 @@ impl RtcDriver {
|
|||||||
#[cfg(feature = "low-power")]
|
#[cfg(feature = "low-power")]
|
||||||
/// Set the rtc but panic if it's already been set
|
/// Set the rtc but panic if it's already been set
|
||||||
pub(crate) fn set_rtc(&self, rtc: &'static Rtc) {
|
pub(crate) fn set_rtc(&self, rtc: &'static Rtc) {
|
||||||
critical_section::with(|cs| assert!(self.rtc.borrow(cs).replace(Some(rtc)).is_none()));
|
critical_section::with(|cs| {
|
||||||
|
rtc.stop_wakeup_alarm(cs);
|
||||||
|
|
||||||
|
assert!(self.rtc.borrow(cs).replace(Some(rtc)).is_none())
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "low-power")]
|
#[cfg(feature = "low-power")]
|
||||||
|
@ -14,6 +14,7 @@ use embassy_stm32::low_power::{stop_with_rtc, Executor};
|
|||||||
use embassy_stm32::rcc::RtcClockSource;
|
use embassy_stm32::rcc::RtcClockSource;
|
||||||
use embassy_stm32::rtc::{Rtc, RtcConfig};
|
use embassy_stm32::rtc::{Rtc, RtcConfig};
|
||||||
use embassy_stm32::time::Hertz;
|
use embassy_stm32::time::Hertz;
|
||||||
|
use embassy_stm32::Config;
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use static_cell::make_static;
|
use static_cell::make_static;
|
||||||
|
|
||||||
@ -45,7 +46,9 @@ async fn task_2() {
|
|||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn async_main(spawner: Spawner) {
|
async fn async_main(spawner: Spawner) {
|
||||||
let mut config = config();
|
let _ = config();
|
||||||
|
|
||||||
|
let mut config = Config::default();
|
||||||
|
|
||||||
config.rcc.lse = Some(Hertz(32_768));
|
config.rcc.lse = Some(Hertz(32_768));
|
||||||
config.rcc.rtc = Some(RtcClockSource::LSE);
|
config.rcc.rtc = Some(RtcClockSource::LSE);
|
||||||
|
Loading…
Reference in New Issue
Block a user