From feb24562d778a39de96ee25ae5da8e29a02e4d52 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 14 Mar 2026 13:12:44 +0100 Subject: [PATCH 01/13] feat(container/linux): install wasi-sysroot Signed-off-by: Marco Casaroli --- .devcontainer/linux/Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer/linux/Dockerfile b/.devcontainer/linux/Dockerfile index 6fb29f14..96c250c1 100644 --- a/.devcontainer/linux/Dockerfile +++ b/.devcontainer/linux/Dockerfile @@ -28,6 +28,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ clang-format \ clang-tools \ libclang-rt-dev \ + libclang-rt-dev-wasm32 \ + lld \ llvm \ net-tools \ sudo \ @@ -42,10 +44,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && apt-get clean -y\ && update-alternatives --install /usr/bin/python python /usr/bin/python3 50 -# Install wasi-sdk -RUN mkdir /opt/wasi-sdk && \ - curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-$(uname -m | sed s/aarch64/arm64/)-linux.tar.gz | \ - tar zxvf - --strip-components=1 -C /opt/wasi-sdk +# Install wasi-sysroot +RUN mkdir /opt/wasi-sysroot && \ + curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sysroot-$WASI_SDK_VERSION.0.tar.gz | \ + tar zxvf - --strip-components=1 -C /opt/wasi-sysroot FROM ocre-ci AS ocre-dev From 70b9ff6721a6e9ef905351bd8a370bb86117cae7 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 14 Mar 2026 13:12:53 +0100 Subject: [PATCH 02/13] feat(container/zephyr): install wasi-sysroot Signed-off-by: Marco Casaroli --- .devcontainer/zephyr/Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer/zephyr/Dockerfile b/.devcontainer/zephyr/Dockerfile index 57c48bb7..f2fb9156 100644 --- a/.devcontainer/zephyr/Dockerfile +++ b/.devcontainer/zephyr/Dockerfile @@ -32,8 +32,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gperf \ gpg \ jq \ + libclang-rt-dev-wasm32 \ libmagic1 \ libsdl2-dev \ + lld \ llvm \ make \ net-tools \ @@ -51,10 +53,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && apt-get clean -y\ && update-alternatives --install /usr/bin/python python /usr/bin/python3 50 -# Install wasi-sdk -RUN mkdir /opt/wasi-sdk && \ - curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-$(uname -m | sed s/aarch64/arm64/)-linux.tar.gz | \ - tar zxvf - --strip-components=1 -C /opt/wasi-sdk +# Install wasi-sysroot +RUN mkdir /opt/wasi-sysroot && \ + curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sysroot-$WASI_SDK_VERSION.0.tar.gz | \ + tar zxvf - --strip-components=1 -C /opt/wasi-sysroot RUN python -m venv /opt/zephyr-venv && \ . /opt/zephyr-venv/bin/activate && \ From c2a9fdd4f289d2a61de4af81fdece95dfeeb7b3f Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 14 Mar 2026 13:13:08 +0100 Subject: [PATCH 03/13] chore(ocre_sdk): bump Signed-off-by: Marco Casaroli --- ocre-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocre-sdk b/ocre-sdk index 8201db68..bc4ae7b4 160000 --- a/ocre-sdk +++ b/ocre-sdk @@ -1 +1 @@ -Subproject commit 8201db681e8b4ac447da62e612628923ebd7cdbc +Subproject commit bc4ae7b4027a99af93743f0f7b543349dfd1b261 From 9e35a7f37d87f8744668fb7d0f1154d30f316251 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 14 Mar 2026 13:22:55 +0100 Subject: [PATCH 04/13] feat(container/zephyr): riscv toolchains Signed-off-by: Marco Casaroli --- .devcontainer/zephyr/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/zephyr/Dockerfile b/.devcontainer/zephyr/Dockerfile index f2fb9156..ddc3434f 100644 --- a/.devcontainer/zephyr/Dockerfile +++ b/.devcontainer/zephyr/Dockerfile @@ -80,7 +80,9 @@ RUN . /opt/zephyr-venv/bin/activate && \ west sdk install --install-base /opt -t \ x86_64-zephyr-elf \ aarch64-zephyr-elf \ - arm-zephyr-eabi + arm-zephyr-eabi \ + riscv64-zephyr-elf + FROM base AS ocre-ci From 93d7e36133a93bfecfa085dc9c455c9a18940211 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 14 Mar 2026 13:23:14 +0100 Subject: [PATCH 05/13] ci(zephyr): build for qemu-riscv64 Signed-off-by: Marco Casaroli From da939e37b144a3c1383115de82f905bd118d9b24 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 14 Mar 2026 14:36:02 +0100 Subject: [PATCH 06/13] docs: update about wasi-sysroot Signed-off-by: Marco Casaroli --- docs/Devcontainers.md | 2 +- docs/NativeBuild.md | 36 ++++++++++-------------------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/docs/Devcontainers.md b/docs/Devcontainers.md index f3170904..f1c4d0e5 100644 --- a/docs/Devcontainers.md +++ b/docs/Devcontainers.md @@ -7,7 +7,7 @@ SPDX-License-Identifier: Apache-2.0 --> Devcontainers are tools that allows you to create and manage isolated development environments in containers. It provides a consistent and reproducible development environment across different machines and operating systems. -It is the fastest and easiest way to develop Ocre in Linux, macOS, and Windows. As it already comes preinstalled with all the necessary tools for building Ocre and the samples, including wasi-sdk. +It is the fastest and easiest way to develop Ocre in Linux, macOS, and Windows. As it already comes preinstalled with all the necessary tools for building Ocre and the samples, including wasi-sysroot. More information can be found at [the official Devcontainers documentation](https://containers.dev/). diff --git a/docs/NativeBuild.md b/docs/NativeBuild.md index 2fd69ec7..b4386df2 100644 --- a/docs/NativeBuild.md +++ b/docs/NativeBuild.md @@ -20,42 +20,26 @@ Our reference system is a Ubuntu 24.04 LTS, however these instructions can be ea ### Build Tools Ocre requires CMake and a C compiler such as GCC. For full testing support, we also use clang. -If we are checking out the Ocre repository, we also need Git to clone Ocre Runtime, and Wget to unpack the WASI-SDK. Install all with: +If we are checking out the Ocre repository, we also need Git to clone Ocre Runtime, and Wget to unpack wasi-sysroot. Install all with: ```sh sudo apt update -y -sudo apt install -y apt install build-essential git cmake clang wget +sudo apt install -y apt install build-essential git cmake clang wget libclang-rt-dev-wasm32 lld ``` -### WASI-SDK +### WASI Sysroot -For building WASM/WASI containers (including the test containers), we need the WASI-SDK. -Download a WASI-P1 compatible WASI-SDK from [the WASI SDK releases page](https://github.com/WebAssembly/wasi-sdk/releases) for your platform. The current recommended version is `wasi-sdk-29`. +For building WASM/WASI containers (including the test containers), we need the WASI Sysroot. +Download wasi-sysroot from [the WASI SDK releases page](https://github.com/WebAssembly/wasi-sdk/releases) for your platform. The current recommended version is `wasi-sysroot-29`. -This is usually installed under `/opt/wasi-sdk` for default easy usage without the need to set environment variables. +This is usually installed under `/opt/wasi-sysroot` for default easy usage without the need to set environment variables. -Download, unpack and install WASI SDK. Note that these are Linux binary packages. Make sure you replace `amd_64` with `arm64` in case your host is ARM64 based: +Download, unpack and install wasi-sysroot: ```sh -wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-29/wasi-sdk-29.0-amd_64-linux.tar.gz -tar -xzf wasi-sdk-29.0-amd_64-linux.tar.gz -sudo mv wasi-sdk-29.0-amd_64-linux /opt/wasi-sdk -``` - -You can check that WASI SDK is properly installed by checking the WASI clang version: - -```sh -/opt/wasi-sdk/bin/clang --version -``` - -The output should be similar to: - -``` -clang version 21.1.4-wasi-sdk (https://github.com/llvm/llvm-project 222fc11f2b8f25f6a0f4976272ef1bb7bf49521d) -Target: wasm32-unknown-wasi -Thread model: posix -InstalledDir: /opt/wasi-sdk/bin -Configuration file: /opt/wasi-sdk/bin/clang.cfg +wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-29/wasi-sysroot-29.0.tar.gz +tar -xzf wasi-sysroot-29.0.tar.gz +sudo mv wasi-sysroot-29.0 /opt/wasi-sysroot ``` ## Linux From 2f884f387bb1ef1c73b006cb79a9747abff86939 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 21 Mar 2026 16:13:14 +0100 Subject: [PATCH 07/13] chore: bump ocre-sdk Signed-off-by: Marco Casaroli --- ocre-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocre-sdk b/ocre-sdk index bc4ae7b4..859a55e8 160000 --- a/ocre-sdk +++ b/ocre-sdk @@ -1 +1 @@ -Subproject commit bc4ae7b4027a99af93743f0f7b543349dfd1b261 +Subproject commit 859a55e83720f3d3271e1ab6a2402a8d41855b6d From 8f9020d116722931b1d7e426f2e22cd5ebbc0838 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 21 Mar 2026 16:13:40 +0100 Subject: [PATCH 08/13] chore(state information): update for new ocre-sdk Signed-off-by: Marco Casaroli --- cmake/state_information.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/state_information.cmake b/cmake/state_information.cmake index 8f5a3574..d8e37532 100644 --- a/cmake/state_information.cmake +++ b/cmake/state_information.cmake @@ -9,15 +9,17 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/var/lib/ocre/images) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/var/lib/ocre/containers) if(OCRE_SDK_PRELOADED_IMAGES) + string(REPLACE ".wasm" "" OCRE_SDK_PRELOADED_IMAGES_STR "${OCRE_SDK_PRELOADED_IMAGES}") + include(ExternalProject) ExternalProject_Add( OcreSampleContainers + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../ocre-sdk" PREFIX "${CMAKE_CURRENT_BINARY_DIR}/OcreSampleContainers" + BUILD_COMMAND cmake --build . -- ${OCRE_SDK_PRELOADED_IMAGES_STR} BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/OcreSampleContainers/build" BUILD_ALWAYS TRUE INSTALL_COMMAND "" - SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../ocre-sdk" - CMAKE_ARGS "-DWAMR_ROOT_DIR=${CMAKE_CURRENT_LIST_DIR}/../wasm-micro-runtime" "-DCMAKE_VERBOSE_MAKEFILE=ON" ) endif() @@ -31,7 +33,7 @@ foreach(image IN ITEMS ${OCRE_SDK_PRELOADED_IMAGES}) message(STATUS "Adding sdk sample '${image}' to preloaded images") add_custom_target(${image} COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_BINARY_DIR}/OcreSampleContainers/build/${image} + ${CMAKE_CURRENT_BINARY_DIR}/OcreSampleContainers/build/dist/${image} ${CMAKE_CURRENT_BINARY_DIR}/var/lib/ocre/images/${image} DEPENDS OcreSampleContainers ) From 821cbff253d3e6b7331d51ad2f24964a55dc2c9f Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 21 Mar 2026 16:35:27 +0100 Subject: [PATCH 09/13] ci(b_u585): update to use new ocre-sdk build system Signed-off-by: Marco Casaroli --- .github/workflows/hardware-bu585.yml | 45 +++++++--------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/.github/workflows/hardware-bu585.yml b/.github/workflows/hardware-bu585.yml index f4aabbb9..85f74a66 100644 --- a/.github/workflows/hardware-bu585.yml +++ b/.github/workflows/hardware-bu585.yml @@ -44,26 +44,10 @@ jobs: strategy: matrix: sample: - - name: generic-hello-world - path: generic/hello-world - filename: hello-world.wasm - - name: generic-subscriber - path: generic/messaging/subscriber - filename: subscriber.wasm - - name: generic-publisher - path: generic/messaging/publisher - filename: publisher.wasm - - name: generic-blinky - path: generic/blinky - filename: blinky.wasm - - # Examples for future images to add - # - name: generic-filesystem-full - # path: generic/filesystem-full - # filename: filesystem-full.wasm - # - name: b_u585i-modbus-server - # path: board_specific/b_u585i_iot02a/modbus-server - # filename: modbus-server.wasm + - hello-world + - subscriber + - publisher + - blinky steps: - name: Cleanup workspace @@ -80,26 +64,17 @@ jobs: - name: Build WASM sample run: | - SAMPLE_DIR=$GITHUB_WORKSPACE/ocre-runtime/ocre-sdk/${{ matrix.sample.path }} - if [ ! -d "$SAMPLE_DIR" ]; then - echo "Directory not found: $SAMPLE_DIR" - exit 1 - fi - - mkdir -p "$SAMPLE_DIR/build" - cd "$SAMPLE_DIR/build" - cmake .. -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk.cmake - make - - env: - WASI_SDK_PATH: /opt/wasi-sdk + mkdir -p "ocre-runtime/ocre-sdk/build" + cd "ocre-runtime/ocre-sdk/build" + cmake .. + make ${{ matrix.sample }} # Saving files to the runner so avoid uploading .wasm files as artifacts individually, uploaded in separate step - name: Save .wasm artifact locally if: always() run: | - mkdir /var/ocre-ci-files/wasm/${{ matrix.sample.name }}/ - cp "ocre-runtime/ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.name }}/${{ matrix.sample.filename }}" + mkdir /var/ocre-ci-files/wasm/${{ matrix.sample }}/ + cp "ocre-runtime/ocre-sdk/build/dist/${{ matrix.sample }}.wasm" "/var/ocre-ci-files/wasm/${{ matrix.sample }}/${{ matrix.sample }}.wasm" artifact-wasm-files: name: Artifact built .wasm Files From d22bf6b4b7b85ea855d9978151a9ced2972d0bd0 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 21 Mar 2026 17:33:47 +0100 Subject: [PATCH 10/13] chore(ocre-sdk): bump Signed-off-by: Marco Casaroli --- ocre-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocre-sdk b/ocre-sdk index 859a55e8..adb62665 160000 --- a/ocre-sdk +++ b/ocre-sdk @@ -1 +1 @@ -Subproject commit 859a55e83720f3d3271e1ab6a2402a8d41855b6d +Subproject commit adb626651f8a6c52a05e8aaf5abb2c2882fd1e98 From 3b4d26f89241cc342d35bc798a58cd0e63722a32 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sat, 21 Mar 2026 17:34:03 +0100 Subject: [PATCH 11/13] chore: rename sleep5_return0 Signed-off-by: Marco Casaroli --- tests/system/posix/CMakeLists.txt | 2 +- tests/system/zephyr/container/CMakeLists.txt | 2 +- tests/system/zephyr/context/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/system/posix/CMakeLists.txt b/tests/system/posix/CMakeLists.txt index 051540b0..71d11b23 100644 --- a/tests/system/posix/CMakeLists.txt +++ b/tests/system/posix/CMakeLists.txt @@ -10,7 +10,7 @@ set(CMAKE_C_COMPILER /usr/bin/clang) list(APPEND OCRE_SDK_PRELOADED_IMAGES "return0.wasm" "return1.wasm" - "sleep_5_return_0.wasm" + "sleep5_return0.wasm" ) if (SANITIZER) diff --git a/tests/system/zephyr/container/CMakeLists.txt b/tests/system/zephyr/container/CMakeLists.txt index 4ae6e372..32204662 100644 --- a/tests/system/zephyr/container/CMakeLists.txt +++ b/tests/system/zephyr/container/CMakeLists.txt @@ -12,7 +12,7 @@ list(APPEND EXTRA_DTC_OVERLAY_FILE fstab.overlay) list(APPEND OCRE_SDK_PRELOADED_IMAGES "return0.wasm" "return1.wasm" - "sleep_5_return_0.wasm" + "sleep5_return0.wasm" "hello-world.wasm" "blinky.wasm" ) diff --git a/tests/system/zephyr/context/CMakeLists.txt b/tests/system/zephyr/context/CMakeLists.txt index 853590f5..fd40d5af 100644 --- a/tests/system/zephyr/context/CMakeLists.txt +++ b/tests/system/zephyr/context/CMakeLists.txt @@ -12,7 +12,7 @@ list(APPEND EXTRA_DTC_OVERLAY_FILE fstab.overlay) list(APPEND OCRE_SDK_PRELOADED_IMAGES "return0.wasm" "return1.wasm" - "sleep_5_return_0.wasm" + "sleep5_return0.wasm" "hello-world.wasm" "filesystem.wasm" "blinky.wasm" From 3e04b9b30110911d54255958435062f4d9325e9a Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sun, 22 Mar 2026 08:14:10 +0100 Subject: [PATCH 12/13] chore(ocre-sdk): bump Signed-off-by: Marco Casaroli --- ocre-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocre-sdk b/ocre-sdk index adb62665..584f19ee 160000 --- a/ocre-sdk +++ b/ocre-sdk @@ -1 +1 @@ -Subproject commit adb626651f8a6c52a05e8aaf5abb2c2882fd1e98 +Subproject commit 584f19ee058195b297caa570d9f5676fde326143 From d7cd64fd1013ff3dfc48c135f8b8e453a69f2ec0 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sun, 22 Mar 2026 08:24:49 +0100 Subject: [PATCH 13/13] build(state_information): pass WAMR_ROOT path Signed-off-by: Marco Casaroli --- cmake/state_information.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/state_information.cmake b/cmake/state_information.cmake index d8e37532..a1d91bf5 100644 --- a/cmake/state_information.cmake +++ b/cmake/state_information.cmake @@ -20,6 +20,7 @@ if(OCRE_SDK_PRELOADED_IMAGES) BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/OcreSampleContainers/build" BUILD_ALWAYS TRUE INSTALL_COMMAND "" + CMAKE_ARGS "-DWAMR_ROOT:STRING=${CMAKE_CURRENT_LIST_DIR}/../wasm-micro-runtime" ) endif()