From 830d8084b0a32956b59fe694b1ed5fc48226818c Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Fri, 2 Aug 2024 16:40:56 +0200 Subject: [PATCH] Update to Zephyr 3.7.0 --- west.yml | 2 +- zephyr/soc/riscv/servant/CMakeLists.txt | 1 + zephyr/soc/riscv/servant/cpu_idle.c | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 zephyr/soc/riscv/servant/cpu_idle.c diff --git a/west.yml b/west.yml index 1f14b1a..cc4c437 100644 --- a/west.yml +++ b/west.yml @@ -5,5 +5,5 @@ manifest: projects: - name: zephyr remote: zephyrproject-rtos - revision: v3.5.0 + revision: v3.7.0 import: true diff --git a/zephyr/soc/riscv/servant/CMakeLists.txt b/zephyr/soc/riscv/servant/CMakeLists.txt index ffe3a45..aee4e42 100644 --- a/zephyr/soc/riscv/servant/CMakeLists.txt +++ b/zephyr/soc/riscv/servant/CMakeLists.txt @@ -4,4 +4,5 @@ zephyr_sources( soc_irq.S vector.S + cpu_idle.c irq.c) diff --git a/zephyr/soc/riscv/servant/cpu_idle.c b/zephyr/soc/riscv/servant/cpu_idle.c new file mode 100644 index 0000000..dc318c6 --- /dev/null +++ b/zephyr/soc/riscv/servant/cpu_idle.c @@ -0,0 +1,22 @@ +#include +#include + +// Override arch_cpu_idle() and arch_cpu_atomic_idle() to prevent insertion +// of `wfi` instructions, which lock up our system. This was introduced in +// Zephyr 3.6.0 with commit 5fb6e267f629dedb8382da6bcad8018b1bb8930a. +// +// This is probably a hardware bug in SERV. This issue is tracked as #131. +// https://github.com/olofk/serv/issues/131 + +void arch_cpu_idle(void) +{ + sys_trace_idle(); + irq_unlock(MSTATUS_IEN); +} + +void arch_cpu_atomic_idle(unsigned int key) +{ + sys_trace_idle(); + irq_unlock(key); +} +