You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-75Lines changed: 34 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,39 +2,28 @@
2
2
3
3
The Ocre SDK provides a modular C-based API for building portable embedded applications that compile to WebAssembly. It includes both headers and source files, enabling flexible integration across platforms. This repository also contains a wide range of generic and board-specific examples that demonstrate real-world use cases.
4
4
5
-
All examples are designed to be executed inside the [Ocre Runtime](https://github.com/project-ocre/ocre-runtime), a lightweight WASI-compatible runtime tailored for embedded-style workloads.
5
+
All examples are designed to be built using [wasi-sdk](https://github.com/WebAssembly/wasi-sdk) and executed inside the [Ocre Runtime](https://github.com/project-ocre/ocre-runtime), a lightweight WASI-compatible runtime tailored for embedded-style workloads.
6
6
7
7
## Repository Structure
8
-
9
8
```
10
9
├── ocre-api # Core SDK: headers + sources
11
10
├── generic # Platform-independent examples
12
-
│ ├── blinky, echo-server, filesystem, etc.
13
-
│ └── build folders per sample
14
-
├── board_specific # Hardware-targeted examples
15
-
│ ├── arduino_portenta_h7
11
+
│ ├── blinky, echo-server, filesystem, etc.
12
+
│ └── build folders per sample
13
+
├── board_specific # Hardware-targeted examples
14
+
│ ├── arduino_portenta_h7
16
15
│ └── b_u585i_iot02a
17
16
├── testing # Testing and potentially faulty images.
18
-
│ └── return0, return1, pthread, etc.
17
+
│ └── return0, return1, pthread, etc.
19
18
├── wasm-micro-runtime # External module
20
19
```
21
20
22
-
## Getting Started
23
-
24
-
### System requirements
21
+
Each sample includes:
22
+
- CMakeLists.txt for build configuration
23
+
- A build/ directory (created during compilation)
24
+
- Optional subfolders like src/, fs/, or IMU/ depending on the sample
25
25
26
-
To build the samples, you need LLVM, LLD, Clang 12+, wasm32 runtime libraries. You also need cmake, make and **\***. Install all on an Ubuntu 22 with:
27
-
28
-
```sh
29
-
sudo apt install \
30
-
cmake \
31
-
clang \
32
-
libclang-rt-dev-wasm32 \
33
-
lld \
34
-
llvm
35
-
```
36
-
37
-
Alternatively, you can use the Ocre devcontainer. Check Ocre documentation for more information.
26
+
## Getting Started
38
27
39
28
### Clone the Repository
40
29
@@ -50,65 +39,40 @@ Or add the SDK as a submodule to your own project:
Make sure the ocre-api folder is accessible to your build system.
54
43
55
-
The default sysroot can be set up automatically. From the root of this repository:
44
+
## Building with wasi-sdk
45
+
All examples are designed to compile to .wasm using [wasi-sdk](https://github.com/WebAssembly/wasi-sdk).
56
46
57
-
```sh
58
-
mkdir build
59
-
cd build
60
-
cmake ..
61
-
make sysroot
62
-
```
47
+
> **Note:** By default, we expect the WASI SDK toolchain file to be located at:
48
+
>
49
+
> `/opt/wasi-sdk/share/cmake/wasi-sdk.cmake`
50
+
>
51
+
> This is typically set in each sample's `CMakeLists.txt`. You can modify this path as needed for your environment.
63
52
64
-
The `sysroot` Make target will download the wasi-sysroot, then compile `lib_socket_ext` and `ocre_api`, and populate them into the `sysroot` directory on the root of this repository.
65
-
66
-
It is also possible to specify a different WAMR root, used for building `lib_socket_ext`, through the `WAMR_ROOT` CMake variable, if you do not want to use the included git submodule:
67
-
68
-
```sh
69
-
cmake .. -DWAMR_ROOT=~/ocre/wasm-micro-runtime
70
-
```
71
-
72
-
## Build Samples
73
-
74
-
### From the ocre-sdk build directory
75
-
76
-
Alternatively, the `all` Make target will build most of the generic samples and testing containers:
77
-
78
-
```sh
79
-
make
80
-
```
53
+
### Build Instructions
54
+
Each sample can be built independently. Here's a generic flow
81
55
82
-
You can also build a specific sample, for example:
83
-
84
-
```sh
85
-
make hello-world
86
-
```
87
-
88
-
The built files are stord in the `dist` directory inside the current build directory:
89
-
90
-
```sh
91
-
ls dist
56
+
```bash
57
+
cd generic/blinky
58
+
mkdir -p build &&cd build
59
+
cmake ..
60
+
cmake --build .
92
61
```
62
+
This will generate a .wasm binary in the build/ directory.
93
63
94
-
### From each sample's directory
64
+
Repeat the same process for any other sample—whether under generic/ or board_specific/
95
65
96
-
Assumming, you already have the sysroot installed into the `sysroot` directory, it is possible to build each sample from their own directory, for example:
66
+
## Running with Ocre Runtime
67
+
All compiled .wasm samples are compatible with the [Ocre Runtime](https://github.com/project-ocre/ocre-runtime), which provides a lightweight execution environment for WASI modules.
97
68
98
-
```sh
99
-
cd generic/hello-world
100
-
mkdir build
101
-
cd build
102
-
cmake ..
103
-
make
69
+
Example:
70
+
```bash
71
+
app build/hello-world.wasm
104
72
```
105
73
106
-
The built file is stored in the current build directory.
107
-
108
74
## Example Categories
109
-
110
75
### Generic Samples
111
-
112
76
- blinky
113
77
- hello-world
114
78
- echo-server
@@ -117,20 +81,15 @@ The built file is stored in the current build directory.
These demonstrate hardware-specific integrations while still leveraging the common ocre-api.
126
-
87
+
These demonstrate hardware-specific integrations while still leveraging the common ocre-api.
127
88
## SDK Highlights
128
-
129
89
- Header and source-based SDK (ocre-api)
130
90
- Modular CMake-based build system
131
91
- Runtime execution via Ocre Runtime
132
92
- Extensible for new boards and applications
133
93
134
94
## Contributing
135
-
136
95
Want to add a new board or example? Fork the repo, create your sample under generic/ or board_specific/, and submit a pull request. Contributions are welcome
0 commit comments