From df83aef101a2e267630fa16c79eeb9015b2cbcaf Mon Sep 17 00:00:00 2001 From: Stephen Berard Date: Fri, 8 Dec 2023 10:16:16 +0100 Subject: [PATCH] Corrects Zephyr include files for current versions of Zephyr (#2881) This fixes bug #2880. Zephyr 3.2 made changes to how headers are reference (see [release notes](https://docs.zephyrproject.org/latest/releases/release-notes-3.2.html)). Work item [49578](https://github.com/zephyrproject-rtos/zephyr/issues/49578) deprecated the old headers names. The current WAMR codebase references these old headers, thus causing compile errors with current versions of Zephyr. This update adds #ifdefs around the header names. With this change, compiling with Zephyr 3.2.0 and above will use the new header files. Prior versions will use the existing code. --- core/app-mgr/app-manager/platform/zephyr/app_mgr_zephyr.c | 6 ++++++ .../gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c | 8 ++++++-- .../src/platform/zephyr/display_ili9340.h | 5 +++++ .../gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c | 5 +++++ .../vgl-wasm-runtime/src/platform/zephyr/XPT2046.c | 8 ++++++-- .../src/platform/zephyr/display_ili9340.h | 5 +++++ .../vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c | 5 +++++ 7 files changed, 38 insertions(+), 4 deletions(-) diff --git a/core/app-mgr/app-manager/platform/zephyr/app_mgr_zephyr.c b/core/app-mgr/app-manager/platform/zephyr/app_mgr_zephyr.c index 650e536f1..68147c062 100644 --- a/core/app-mgr/app-manager/platform/zephyr/app_mgr_zephyr.c +++ b/core/app-mgr/app-manager/platform/zephyr/app_mgr_zephyr.c @@ -6,8 +6,14 @@ #include "app_manager.h" #include "bh_platform.h" #include + +#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */ #include #include +#else +#include +#endif + #if 0 #include #endif diff --git a/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c b/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c index cdad9dac2..5502cfd89 100644 --- a/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c +++ b/samples/gui/wasm-runtime-wgl/src/platform/zephyr/XPT2046.c @@ -10,8 +10,12 @@ #include #include "drivers/spi.h" -#include "zephyr.h" -#include "kernel.h" +#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */ +#include +#include +#else +#include +#endif #if USE_XPT2046 diff --git a/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.h b/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.h index f72279d69..ddc396e1d 100644 --- a/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.h +++ b/samples/gui/wasm-runtime-wgl/src/platform/zephyr/display_ili9340.h @@ -7,7 +7,12 @@ #define ZEPHYR_DRIVERS_DISPLAY_DISPLAY_ILI9340_H_ #include "board_config.h" #include + +#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */ #include +#else +#include +#endif #define ILI9340_CMD_ENTER_SLEEP 0x10 #define ILI9340_CMD_EXIT_SLEEP 0x11 diff --git a/samples/gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c b/samples/gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c index 6a88f8007..9ce0c11cd 100644 --- a/samples/gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c +++ b/samples/gui/wasm-runtime-wgl/src/platform/zephyr/iwasm_main.c @@ -31,7 +31,12 @@ xpt2046_init(void); extern void wgl_init(); +#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */ #include +#else +#include +#endif + #include #include diff --git a/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.c b/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.c index d59b6c9b7..e3948e2f2 100644 --- a/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.c +++ b/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/XPT2046.c @@ -10,8 +10,12 @@ #include #include "drivers/spi.h" -#include "zephyr.h" -#include "kernel.h" +#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */ +#include +#include +#else +#include +#endif #if USE_XPT2046 diff --git a/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.h b/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.h index 4eb11e2d1..39257a29a 100644 --- a/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.h +++ b/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/display_ili9340.h @@ -7,7 +7,12 @@ #define ZEPHYR_DRIVERS_DISPLAY_DISPLAY_ILI9340_H_ #include "board_config.h" #include + +#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */ #include +#else +#include +#endif #define ILI9340_CMD_ENTER_SLEEP 0x10 #define ILI9340_CMD_EXIT_SLEEP 0x11 diff --git a/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c b/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c index dceb5786b..10f498026 100644 --- a/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c +++ b/samples/littlevgl/vgl-wasm-runtime/src/platform/zephyr/iwasm_main.c @@ -16,7 +16,12 @@ #include "connection_native_api.h" #include "display_indev.h" +#if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */ #include +#else +#include +#endif + #include #include