Skip to content

Commit bf44ceb

Browse files
committed
* Fix CMake PATH parser for Windows to handle parent folder paths correctly.
The build system encountered an error during compilation of the Esp32c3 (RISC-V) module on Windows. The issue was traced to incorrect handling of "/../" (parent folder path) in folder addresses within the "always-run-cargo.dummy-baee278.bat" file used by CMake. This fix resolves the issue, enabling successful compilation. Signed-off-by: Coskun Ergan <[email protected]>
1 parent 089d2ef commit bf44ceb

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,24 @@ endfunction()
6060

6161
function(get_include_dirs target dirs)
6262
get_target_property(include_dirs ${target} INTERFACE_INCLUDE_DIRECTORIES)
63+
get_target_property(nostdinc_include ${target} nostdinc_include)
64+
65+
if(nostdinc_include)
66+
if(NOT include_dirs)
67+
set(include_dirs "")
68+
endif()
69+
list(APPEND include_dirs "${nostdinc_include}")
70+
endif()
71+
72+
# normalize this path "/../"
6373
if(include_dirs)
74+
set(normalized_dirs "")
75+
foreach(dir IN LISTS include_dirs)
76+
file(TO_CMAKE_PATH "${dir}" normalized_dir)
77+
file(REAL_PATH "${normalized_dir}" resolved_dir BASE_DIRECTORY "${CMAKE_SOURCE_DIR}")
78+
list(APPEND normalized_dirs "${resolved_dir}")
79+
endforeach()
80+
string(REPLACE ";" " " include_dirs "${normalized_dirs}")
6481
set(${dirs} "${include_dirs}" PARENT_SCOPE)
6582
else()
6683
set(${dirs} "" PARENT_SCOPE)

dt-rust.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
- "nordic,nrf51-flash-controller"
3838
- "raspberrypi,pico-flash-controller"
3939
- "zephyr,sim-flash"
40+
- "espressif,esp32-flash-controller"
41+
- "st,stm32-flash-controller"
4042
level: 0
4143
actions:
4244
- !Instance

zephyr-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn main() -> Result<()> {
7676
.derive_copy(false)
7777
.allowlist_function("k_.*")
7878
.allowlist_function("gpio_.*")
79-
.allowlist_function("auxdisplay_.*")
79+
.allowlist_function("eeprom_.*")
8080
.allowlist_function("flash_.*")
8181
.allowlist_function("zr_.*")
8282
.allowlist_item("GPIO_.*")

zephyr-sys/wrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extern int errno;
4242
#include <zephyr/logging/log.h>
4343
#include <zephyr/bluetooth/bluetooth.h>
4444
#include <zephyr/drivers/flash.h>
45-
#include <zephyr/drivers/auxdisplay.h>
45+
#include <zephyr/drivers/eeprom.h>
4646
#include <zephyr/irq.h>
4747

4848
/*

zephyr/src/device/gpio.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ mod async_io {
3131
use embassy_sync::waitqueue::AtomicWaker;
3232
use zephyr_sys::{
3333
device, gpio_add_callback, gpio_callback, gpio_init_callback, gpio_pin_interrupt_configure,
34-
gpio_pin_interrupt_configure_dt, gpio_port_pins_t, GPIO_INT_EDGE_FALLING, GPIO_INT_EDGE_RISING,
35-
ZR_GPIO_INT_MODE_DISABLE_ONLY,
34+
gpio_pin_interrupt_configure_dt, gpio_port_pins_t, GPIO_INT_EDGE_FALLING,
35+
GPIO_INT_EDGE_RISING, ZR_GPIO_INT_MODE_DISABLE_ONLY,
3636
};
3737

3838
use crate::sync::atomic::{AtomicBool, AtomicU32};
@@ -212,15 +212,17 @@ mod async_io {
212212
self.pin.data.register(self.pin.pin.pin, cx.waker());
213213

214214
let mode = match self.level {
215-
0 => GPIO_INT_EDGE_FALLING/*GPIO_INT_LEVEL_LOW*/,
216-
1 => GPIO_INT_EDGE_RISING/*GPIO_INT_LEVEL_HIGH*/,
215+
0 => GPIO_INT_EDGE_FALLING,
216+
1 => GPIO_INT_EDGE_RISING,
217217
_ => unreachable!(),
218218
};
219219

220220
unsafe {
221221
gpio_pin_interrupt_configure_dt(&self.pin.pin, mode);
222222

223-
if self.level == zephyr_sys::gpio_pin_get_raw(self.pin.pin.port,self.pin.pin.pin) as u8 {
223+
if self.level
224+
== zephyr_sys::gpio_pin_get_raw(self.pin.pin.port, self.pin.pin.pin) as u8
225+
{
224226
let cb = self.pin.data.callback.get();
225227
GpioStatic::callback_handler(self.pin.pin.port, cb, 1 << self.pin.pin.pin);
226228
}

0 commit comments

Comments
 (0)