Skip to content

Commit 8ab65d6

Browse files
authored
Squashed updates: build-run workflow, submodule revisions, platform support, and feature enhancements (#77)
- Refactored build-run workflow for Linux: improved execution flow, artifact handling, and logging - Updated WAMR and Zephyr submodules to internal and main branches - Stabilized system initialization, messaging, and platform abstraction - Enhanced documentation: updated README and MAINTAINERS.md - Added support for U585 onboard sensors and OCRE container networking - Fixed native simulation run command and improved input path resolution - Corrected stack allocation for dynamic threads Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
1 parent b71ab6a commit 8ab65d6

13 files changed

Lines changed: 194 additions & 34 deletions

File tree

.github/workflows/build.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ jobs:
3535
run: |
3636
west build --pristine -b native_sim ./application -d build -- -DMODULE_EXT_ROOT=$(pwd)/application
3737
38+
- name: Upload build native_sim artifact
39+
if: job.status == 'success'
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: zephyr-build-native-sim
43+
path: build/
44+
3845
- name: Build b_u585i_iot02a
3946
if: runner.environment == 'self-hosted'
4047
run: |
@@ -47,6 +54,40 @@ jobs:
4754
name: firmware
4855
path: build/zephyr/zephyr.bin
4956

57+
run-zephyr-native-sim:
58+
runs-on: zephyr-xlarge-runner
59+
needs: build-zephyr
60+
container:
61+
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
62+
options: --user root
63+
steps:
64+
- name: Download Zephyr build artifacts
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: zephyr-build-native-sim
68+
path: build/
69+
70+
- name: Run Zephyr binary and check output
71+
working-directory: build/zephyr/
72+
run: |
73+
EXPECTED_LOG="Hello World from Ocre!"
74+
echo "Running Zephyr (native_sim)..."
75+
chmod +x zephyr.exe
76+
stdbuf -oL -eL timeout 20s ./zephyr.exe | tee zephyr_app.log
77+
echo "===== Checking for expected log ====="
78+
if grep -q "$EXPECTED_LOG" zephyr_app.log; then
79+
echo "[OK] Found expected log: $EXPECTED_LOG"
80+
else
81+
echo "[ERROR] Expected log not found: $EXPECTED_LOG"
82+
exit 1
83+
fi
84+
85+
- name: Upload app logs
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: zephyr-app-log
89+
path: build/zephyr/zephyr_app.log
90+
5091
build-linux:
5192
runs-on: ubuntu-latest
5293
steps:
@@ -64,6 +105,43 @@ jobs:
64105
run: |
65106
cd application
66107
./build.sh -t l
108+
109+
- name: Upload build artifacts
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: linux-build
113+
path: application/build/
114+
115+
run-linux:
116+
runs-on: ubuntu-latest
117+
needs: build-linux
118+
steps:
119+
- name: Download Linux build artifacts
120+
uses: actions/download-artifact@v4
121+
with:
122+
name: linux-build
123+
path: application/build/
124+
125+
- name: Run Linux binary and check output
126+
working-directory: application/build
127+
run: |
128+
EXPECTED_LOG="Hello World from Ocre!"
129+
chmod +x app
130+
echo "Running application..."
131+
stdbuf -oL -eL timeout 20s ./app | tee linux_app.log
132+
echo "===== Checking for expected log ====="
133+
if grep -q "$EXPECTED_LOG" linux_app.log; then
134+
echo "[OK] Found expected log: $EXPECTED_LOG"
135+
else
136+
echo "[ERROR] Expected log not found: $EXPECTED_LOG"
137+
exit 1
138+
fi
139+
140+
- name: Upload app logs
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: linux-app-log
144+
path: application/build/linux_app.log
67145

68146
flash:
69147
needs: build-zephyr

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "wasm-micro-runtime"]
22
path = wasm-micro-runtime
3-
url = https://github.com/bytecodealliance/wasm-micro-runtime.git
4-
branch = dev/zephyr_file_socket
3+
url = https://github.com/project-ocre/wasm-micro-runtime.git
4+
branch = staging

Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,10 @@ config IMU_SENSOR
212212
help
213213
Enable support for the custom IMU sensor.
214214

215+
config OCRE_NETWORKING
216+
bool "Enable container networking support"
217+
default n
218+
help
219+
Enable networking support for containers.
220+
215221
endmenu

boards/b_u585i_iot02a.conf

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,28 @@ CONFIG_GPIO=y
88
CONFIG_I2C=y
99
CONFIG_SPI=y
1010

11-
# ENC28J60 Ethernet driver
12-
CONFIG_ETH_ENC28J60=y
11+
# W5500 Ethernet driver
12+
CONFIG_ETH_W5500=y
1313
CONFIG_NET_L2_ETHERNET=y
14-
CONFIG_LSM6DSO=y
1514

1615
# Ocre Sensors support
1716
CONFIG_SENSOR=y
1817
CONFIG_OCRE_SENSORS=y
18+
CONFIG_RNG_SENSOR=y
19+
20+
CONFIG_SENSOR_SHELL=y
21+
CONFIG_SENSOR_INFO=y
22+
23+
# Onboard sensors
24+
CONFIG_ISM330DHCX=y
25+
CONFIG_LPS22HH=y
26+
CONFIG_HTS221=y
27+
CONFIG_IIS2MDC=y
28+
CONFIG_VEML7700=y
1929

2030
# Ocre options
2131
CONFIG_OCRE_CONTAINER_FILESYSTEM=y
2232

23-
# Specific sensor drivers
24-
CONFIG_RNG_SENSOR=y
25-
CONFIG_IMU_SENSOR=y
26-
CONFIG_LSM6DSO=y
27-
2833
# Ocre GPIO Support
2934
CONFIG_OCRE_GPIO=y
3035
CONFIG_OCRE_GPIO_MAX_PORTS=8
@@ -43,3 +48,15 @@ CONFIG_LINKER_LAST_SECTION_ID=y
4348

4449
CONFIG_MM_DRV=y
4550
CONFIG_MM_DRV_PAGE_SIZE=4096
51+
52+
# Networking options
53+
CONFIG_NET_TCP=y
54+
CONFIG_NET_MAX_CONN=10
55+
56+
# Zephyr Virtual File System (ZVFS) options. Needed for container filesystem and sockets
57+
CONFIG_ZVFS_OPEN_MAX=15
58+
CONFIG_ZVFS_EVENTFD_MAX=10
59+
CONFIG_NET_SOCKETS_POLL_MAX=10
60+
61+
# Enable container networking support
62+
CONFIG_OCRE_NETWORKING=y

boards/b_u585i_iot02a.overlay

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
devices {
3939
compatible = "custom,devices";
4040
status = "okay";
41-
device_list = <&rng_device &ism330dhcx>;
41+
device_list = <&rng_device &ism330dhcx &lps22hh &hts221 &iis2mdc &veml6030>;
4242
};
4343

4444
reserved-memory {
@@ -154,34 +154,44 @@
154154
};
155155
};
156156

157+
// Add labels for sensors defined in the board .dtsi file, and any other user configuration
158+
// This is required so we can reference them in the devices block above, which is used by ocre_sensors
157159
&i2c2 {
158-
pinctrl-0 = <&i2c2_scl_ph4 &i2c2_sda_ph5>;
159-
pinctrl-names = "default";
160-
status = "okay";
161-
clock-frequency = <I2C_BITRATE_FAST>;
162-
163-
ism330dhcx: ism330dhcx@6b {
164-
compatible = "st,ism330dhcx";
165-
reg = <0x6b>;
166-
drdy-gpios = <&gpioe 11 GPIO_ACTIVE_HIGH>;
167-
status = "okay";
160+
ism330dhcx: ism330dhcx@6b {
168161
label = "imu";
162+
status = "okay";
169163
accel-odr = <4>; // 104 Hz
170164
accel-range = <4>; // ±4 g
171165
gyro-odr = <4>; // 104 Hz
172166
gyro-range = <250>; // ±250 dps
173-
};
167+
};
168+
lps22hh: lps22hh@5d {
169+
label = "pressure";
170+
status = "okay";
171+
};
172+
hts221: hts221@5f {
173+
label = "humidity";
174+
status = "okay";
175+
};
176+
iis2mdc: iis2mdc@1e {
177+
label = "magnetometer";
178+
status = "okay";
179+
};
180+
veml6030: veml6030@10 {
181+
label = "light";
182+
status = "okay";
183+
};
174184
};
175185

176186
&spi1 {
177-
enc28j60: ethernet@0 {
187+
eth0: ethernet@0 {
178188
status = "okay";
179189
reg = <0>;
180-
compatible = "microchip,enc28j60";
181-
int-gpios = <&gpioc 1 GPIO_ACTIVE_LOW>;
182-
spi-max-frequency = <10000000>;
190+
// W5500 Ethernet Shield
191+
compatible = "wiznet,w5500";
192+
int-gpios = <&gpiod 15 GPIO_ACTIVE_LOW>;
193+
spi-max-frequency = <32000000>;
183194
local-mac-address = [ 00 80 00 01 02 03 ];
184-
full-duplex;
185195
};
186196
};
187197

boards/enc28j60.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ENC28J60 Ethernet driver
2+
CONFIG_ETH_ENC28J60=y
3+
CONFIG_ETH_W5500=n

boards/enc28j60.overlay

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
&spi1 {
2+
eth0: ethernet@0 {
3+
status = "okay";
4+
reg = <0>;
5+
compatible = "microchip,enc28j60";
6+
int-gpios = <&gpioc 1 GPIO_ACTIVE_LOW>;
7+
spi-max-frequency = <10000000>;
8+
local-mac-address = [ 00 80 00 01 02 03 ];
9+
full-duplex;
10+
};
11+
};

boards/native_sim.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=262144
3333
CONFIG_GPIO=y
3434

3535
# Ocre options
36-
CONFIG_OCRE_CONTAINER_FILESYSTEM=y
36+
CONFIG_OCRE_CONTAINER_FILESYSTEM=y

prj.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ CONFIG_ZCBOR_VERBOSE=n
1616

1717
CONFIG_THREAD_RUNTIME_STATS=y # Needed by the latest version of WARM for time APIs
1818

19+
# Allow for dynamically created threads
20+
CONFIG_DYNAMIC_THREAD=y
21+
CONFIG_DYNAMIC_THREAD_ALLOC=y
22+
1923
# File system
2024
CONFIG_FILE_SYSTEM=y
2125
#CONFIG_DISK_ACCESS=y
@@ -41,7 +45,6 @@ CONFIG_ZVFS_POLL_MAX=5
4145

4246
CONFIG_NET_DHCPV4=y
4347

44-
4548
# MCU Boot options
4649
CONFIG_BOOTLOADER_MCUBOOT=n
4750
CONFIG_IMG_MANAGER=y

src/samples-mini/zephyr/main.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,25 @@
1717
#include <ocre/ocre_input_file.h>
1818
#endif
1919

20+
#include <zephyr/net/net_if.h>
21+
2022
void create_sample_container();
23+
int ocre_network_init();
2124

2225
int main(int argc, char *argv[]) {
2326
ocre_cs_ctx ctx;
2427
ocre_container_init_arguments_t args;
2528
char *container_filename = "hello";
2629

30+
#ifdef CONFIG_OCRE_NETWORKING
31+
int net_status = ocre_network_init();
32+
if (net_status < 0) {
33+
printf("Unable to connect to network\n");
34+
} else {
35+
printf("Network is UP\n");
36+
}
37+
#endif
38+
2739
ocre_app_storage_init();
2840

2941
// Step 1: Initialize the Ocre runtime
@@ -76,3 +88,23 @@ void create_sample_container(char *file_name) {
7688
fs_write(&f, &wasm_binary, wasm_binary_len);
7789
fs_close(&f);
7890
}
91+
92+
int ocre_network_init() {
93+
94+
struct net_if *iface = net_if_get_default();
95+
net_dhcpv4_start(iface);
96+
97+
printf("Waiting for network to be ready...\n");
98+
99+
int sleep_cnt = 0;
100+
while (!net_if_is_up(iface) && (sleep_cnt < 10)) {
101+
k_sleep(K_MSEC(200));
102+
sleep_cnt++;
103+
}
104+
105+
if (!net_if_is_up(iface)) {
106+
return -ENOTCONN;
107+
}
108+
109+
return 0;
110+
}

0 commit comments

Comments
 (0)