Powered by WebAssembly, the Ocre runtime is available in both Zephyr and Linux variants and supports OCI-like application containers in a footprint up to 2000x lighter than traditional container runtimes like Docker.
With Ocre, developers can run the exact same application container binaries written in choice of programming language on both the Linux and Zephyr-based runtime versions spanning CPU and MCU-based devices.
Our mission is to make it as easy to develop and securely deploy apps for the billions of embedded devices in the physical world as it is in the cloud.
Ocre supports a range of features depending on the platform. The table below summarizes the current support:
Feature | Zephyr (native_sim, b_u585i_iot02a) | Linux x86_64 |
---|---|---|
Ocre Runtime | ✅ | ✅ |
Container Messaging | ✅ | ❌ |
GPIO | ✅ | ❌ |
Timers | ✅ | ❌ |
Sensors | ✅ | ❌ |
Networking | ❌ | ✅ |
Interactive Shell | ✅ | ❌ |
- Zephyr: Full feature set, including hardware integration and shell.
- Linux x86_64: Core runtime and networking only; hardware and shell features are not available.
This guide will help you build and run Ocre on both Zephyr (simulated and hardware) and Linux.
- Zephyr SDK (for Zephyr targets)
- Python 3 (for build tooling)
- CMake and make (for Linux builds)
- west (Zephyr meta-tool)
- git
Follow the Zephyr Getting Started Guide for your OS, including:
mkdir runtime && cd runtime
python3 -m venv .venv
source .venv/bin/activate
You may need to install python3-venv
on your system.
Install the west CLI tool, which is needed to build, run and manage Zephyr applications.
pip install west
west init -m [email protected]:project-ocre/ocre-runtime.git
west update
pip install -r zephyr/scripts/requirements.txt
git clone [email protected]:project-ocre/ocre-runtime.git
cd ocre-runtime
git submodule update --init --recursive
Ocre provides a convenient build.sh
script to simplify building and running for both Zephyr and Linux targets.
./build.sh -t <target> [-r] [-f <file1> [file2 ...]] [-b] <board> [-h]
-t <target>
: Required.z
for Zephyr,l
for Linux.-r
: Run after build (optional).-f <file(s)>
: Specify one or more input files (optional).-b <board>
: (Zephyr only) Select a zephyr board instead of the defaultnative_sim
:uw
-> b_u585i_iot02a + W5500ue
-> b_u585i_iot02a + ENC28J60your_option
-> any Zephyr-supported board
-h
: Show help.
Build and run for Zephyr native_sim:
./build.sh -t z -r
Build for Zephyr b_u585i_iot02a board:
./build.sh -t z -b
Build and run for Linux with a WASM file:
./build.sh -t l -r -f your_file.wasm
west build -b native_sim ./application -d build -- -DMODULE_EXT_ROOT=`pwd`/application
./build/zephyr/zephyr.exe
west build -b b_u585i_iot02a ./application -d build -- -DMODULE_EXT_ROOT=`pwd`/application
# Flash to board (requires hardware)
west flash
mkdir -p build
cd build
cmake .. -DTARGET_PLATFORM_NAME=Linux
make
./app your_file.wasm
- The
build.sh
script will automatically detect the target and handle build/run steps, including passing input files and selecting the correct Zephyr board. - For Zephyr, only the first file specified with
-f
is passed as the input file (see script for details). - For Linux, you can pass multiple WASM files as arguments to the built application.
- The script checks build success and only runs the application if the build completes successfully.
- The
mini-samples
directory contains a "Hello World" container, which is hardcoded as a C array. When Ocre is run without input file arguments, it executes this sample container by default. If an input file is provided, Zephyr will convert that file into a C array at build time and run it as a container. On Linux, this conversion does not occur — instead, Ocre simply opens and reads the provided file(s) directly from the filesystem.
./build.sh -t z -r -b ue
Target is: Zephyr
Building for b_u585i_iot02a with ENC28J60 support
Linking C executable zephyr/zephyr.elf
Ocre runtime started
Hello World from Ocre!
./build.sh -t l -r
Target is: Linux
[100%] Built target app
Ocre runtime started
Hello World from Ocre!
Distributed under the Apache License 2.0. See LICENSE for more information.
- Website: For a high-level overview of the Ocre project, and its goals, visit our website.
- Docs: For more detailed information about the Ocre runtime, visit Ocre docs.
- Wiki: For a full project overview, FAQs, project roadmap, and governance information, visit the Ocre Wiki.
- Slack: If you need support or simply want to discuss all things Ocre, head on over to our Slack channel (
#ocre
) on LFEdge's Slack org. - Mailing list: Join the Ocre Technical Steering Committee (TSC) mailing list to stay up to date with important project announcements, discussions, and meetings.