Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,14 @@ jobs:
- name: Build ARM
run: |
cmake -B build/arm -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=cmake/arm-cortex-m4.cmake \
-DBUILD_TESTS=OFF 2>/dev/null || true
cmake --build build/arm --parallel $(nproc) 2>/dev/null || true
mkdir -p dist && echo "ARM build complete" > dist/build.txt
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/toolchain-arm-cortex-m4.cmake \
-DEAI_BUILD_TESTS=OFF
cmake --build build/arm --parallel $(nproc)
- uses: actions/upload-artifact@v4
with:
name: eai-arm
path: |
build/arm/**/*.elf
build/arm/**/*.bin
dist/
path: build/arm/**/*.a
if-no-files-found: error
retention-days: 90

# ── Release ───────────────────────────────────────────────────────────────
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ if(ANDROID)
set(EAI_PLATFORM_ANDROID ON)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Generic")
set(EAI_PLATFORM_LINUX OFF)
set(EAI_PLATFORM_BAREMETAL ON)
set(EAI_BUILD_CLI OFF)
endif()

# ========== Modules ==========

# Common library (shared contracts + utilities)
Expand Down
4 changes: 4 additions & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ target_include_directories(eai_common PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

if(NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
target_compile_definitions(eai_common PUBLIC EAI_HAS_HOST_SOCKETS)
endif()

if(UNIX)
target_link_libraries(eai_common PUBLIC m)
endif()
Expand Down
14 changes: 12 additions & 2 deletions common/src/tools_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#include <stdlib.h>
#include <time.h>

#ifdef _WIN32
#if defined(EAI_HAS_HOST_SOCKETS) && defined(_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
typedef SOCKET sock_t;
#define SOCK_INVALID INVALID_SOCKET
#define sock_close closesocket
#else
#elif defined(EAI_HAS_HOST_SOCKETS)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
Expand Down Expand Up @@ -121,6 +121,7 @@ eai_status_t eai_tool_device_read_sensor_register(eai_tool_registry_t *reg)

/* ========== http.get ========== */

#ifdef EAI_HAS_HOST_SOCKETS
static eai_status_t tool_http_get_exec(const eai_kv_t *args, int arg_count,
eai_tool_result_t *result)
{
Expand Down Expand Up @@ -279,6 +280,13 @@ eai_status_t eai_tool_http_get_register(eai_tool_registry_t *reg)
tool.exec = tool_http_get_exec;
return eai_tool_register(reg, &tool);
}
#else
eai_status_t eai_tool_http_get_register(eai_tool_registry_t *reg)
{
(void)reg;
return EAI_ERR_UNSUPPORTED;
}
#endif

/* ========== preference.set ========== */

Expand Down Expand Up @@ -426,8 +434,10 @@ eai_status_t eai_tools_register_builtins(eai_tool_registry_t *reg)
s = eai_tool_device_read_sensor_register(reg);
if (s != EAI_OK) return s;

#ifdef EAI_HAS_HOST_SOCKETS
s = eai_tool_http_get_register(reg);
if (s != EAI_OK) return s;
#endif

s = eai_tool_pref_set_register(reg);
if (s != EAI_OK) return s;
Expand Down
18 changes: 18 additions & 0 deletions framework/src/connector_modbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
#include <stdio.h>
#include <stdlib.h>

#ifndef EAI_HAS_HOST_SOCKETS
static eai_status_t modbus_unsupported(eai_fw_connector_t *conn,
const eai_kv_t *params, int param_count)
{
(void)conn;
(void)params;
(void)param_count;
return EAI_ERR_UNSUPPORTED;
}

const eai_connector_ops_t eai_connector_modbus_ops = {
.name = "modbus",
.type = EAI_CONN_MODBUS,
.connect = modbus_unsupported,
};
#else

#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
Expand Down Expand Up @@ -257,3 +274,4 @@ const eai_connector_ops_t eai_connector_modbus_ops = {
.write = modbus_write,
.subscribe = NULL,
};
#endif
18 changes: 18 additions & 0 deletions framework/src/connector_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
#include <stdio.h>
#include <stdlib.h>

#ifndef EAI_HAS_HOST_SOCKETS
static eai_status_t mqtt_unsupported(eai_fw_connector_t *conn,
const eai_kv_t *params, int param_count)
{
(void)conn;
(void)params;
(void)param_count;
return EAI_ERR_UNSUPPORTED;
}

const eai_connector_ops_t eai_connector_mqtt_ops = {
.name = "mqtt",
.type = EAI_CONN_MQTT,
.connect = mqtt_unsupported,
};
#else

#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
Expand Down Expand Up @@ -378,3 +395,4 @@ const eai_connector_ops_t eai_connector_mqtt_ops = {
.write = mqtt_write,
.subscribe = mqtt_subscribe,
};
#endif
18 changes: 18 additions & 0 deletions framework/src/connector_opcua.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
#include <stdio.h>
#include <stdlib.h>

#ifndef EAI_HAS_HOST_SOCKETS
static eai_status_t opcua_unsupported(eai_fw_connector_t *conn,
const eai_kv_t *params, int param_count)
{
(void)conn;
(void)params;
(void)param_count;
return EAI_ERR_UNSUPPORTED;
}

const eai_connector_ops_t eai_connector_opcua_ops = {
.name = "opcua",
.type = EAI_CONN_OPCUA,
.connect = opcua_unsupported,
};
#else

#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
Expand Down Expand Up @@ -284,3 +301,4 @@ const eai_connector_ops_t eai_connector_opcua_ops = {
.write = opcua_write,
.subscribe = NULL,
};
#endif
16 changes: 14 additions & 2 deletions min/src/router.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include <stdio.h>
#include <stdlib.h>

#ifdef _WIN32
#if defined(EAI_HAS_HOST_SOCKETS) && defined(_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
typedef SOCKET sock_t;
#define SOCK_INVALID INVALID_SOCKET
#define sock_close closesocket
#else
#elif defined(EAI_HAS_HOST_SOCKETS)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
Expand Down Expand Up @@ -73,6 +73,7 @@ eai_route_target_t eai_min_router_decide(const eai_min_router_t *router,
}

/* Parse host and port from endpoint URL */
#ifdef EAI_HAS_HOST_SOCKETS
static void parse_endpoint(const char *endpoint, char *host, size_t host_size,
int *port, char *path, size_t path_size, int *use_https)
{
Expand Down Expand Up @@ -257,3 +258,14 @@ eai_status_t eai_min_router_infer_cloud(eai_min_router_t *router,

return EAI_OK;
}
#else
eai_status_t eai_min_router_infer_cloud(eai_min_router_t *router,
const eai_inference_input_t *in,
eai_inference_output_t *out)
{
(void)router;
(void)in;
(void)out;
return EAI_ERR_UNSUPPORTED;
}
#endif
Loading