Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
From 32d087860abaf5b2374043db7034174aec06b885 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Tue, 31 Dec 2024 15:52:57 +0100
Subject: [PATCH] CMakeLists.txt: don't override the optimization level
zenoh-pico's CMakeLists.txt has some logic to provide its own compiler
optimization level: -O3 for release builds, -O0 for debug builds.
Unfortunately, using add_compile_options() means that those settings
take precedence over what the user can pass as custom compiler
flags. And this causes issues for example when doing a debug build
with _FORTIFY_SOURCE enabled, as _FORTIFY_SOURCE support in glibc is
incompatible with unoptimized builds causing this build failure:
/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/features.h:414:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
414 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
| ^~~~~~~
which is a warning, but as zenoh-pico builds with -Werror, it turns
into a build failure.
As it is unclear how CMakeLists.txt can pass a default -O level, while
allowing it to be overridden by the user, we simply remove those
optimization level options.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Upstream: https://github.com/eclipse-zenoh/zenoh-pico/pull/847
---
CMakeLists.txt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25b62fb5..623d13f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,15 +86,15 @@ string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
# Compile options
if(CMAKE_BUILD_TYPE MATCHES "RELEASE" OR "Release")
if(UNIX)
- add_compile_options(-pipe -O3)
+ add_compile_options(-pipe)
elseif(CMAKE_SYSTEM_NAME MATCHES "Generic")
- add_compile_options(-pipe -O3)
+ add_compile_options(-pipe)
endif()
else()
if(CMAKE_SYSTEM_NAME MATCHES "PICO")
- add_compile_options(-c -Wall -Wextra -Wno-unused -Wno-strict-prototypes -pipe -g -O0)
+ add_compile_options(-c -Wall -Wextra -Wno-unused -Wno-strict-prototypes -pipe -g)
elseif(UNIX)
- add_compile_options(-c -Wall -Wextra -Werror -Wshadow -Wunused -Wstrict-prototypes -pipe -g -O0)
+ add_compile_options(-c -Wall -Wextra -Werror -Wshadow -Wunused -Wstrict-prototypes -pipe -g)
# C99 pedantic doesn't like struct anonymous in unix header
if (NOT CMAKE_C_STANDARD STREQUAL "99")
add_compile_options(-Wpedantic)
@@ -103,7 +103,7 @@ else()
elseif(MSVC)
add_compile_options(/W4 /WX /Od /wd4127)
elseif(CMAKE_SYSTEM_NAME MATCHES "Generic")
- add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -pipe -g -O0)
+ add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -pipe -g)
endif()
endif()
--
2.47.1

View File

@@ -0,0 +1,199 @@
From 584e3d2cf8e879e5ad042f742a3d8656d7d98ed7 Mon Sep 17 00:00:00 2001
From: Jean-Roland Gosse <jean.roland.gosse@gmail.com>
Date: Thu, 10 Jul 2025 14:37:00 +0200
Subject: [PATCH] Fix compilation issues (#986)
* fix: compilation issues
* fix: stringop-overflow
* doc: add comment to _z_str_append function
Upstream: https://github.com/eclipse-zenoh/zenoh-pico/commit/60e635cbb1dc6be8eda559a913d4689845f0d62e
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
---
include/zenoh-pico/utils/string.h | 8 ++++++++
src/api/encoding.c | 4 ++--
src/protocol/codec/declarations.c | 4 ++++
src/protocol/codec/transport.c | 3 ++-
src/protocol/config.c | 8 +++-----
src/session/rx.c | 3 +++
src/transport/multicast/rx.c | 4 ++++
src/transport/unicast/rx.c | 4 ++++
8 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/include/zenoh-pico/utils/string.h b/include/zenoh-pico/utils/string.h
index e4ffd69d..2f56cb79 100644
--- a/include/zenoh-pico/utils/string.h
+++ b/include/zenoh-pico/utils/string.h
@@ -18,6 +18,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <string.h>
#ifdef __cplusplus
extern "C" {
@@ -63,6 +64,13 @@ size_t _z_strcnt(char const *haystack_start, const char *harstack_end, const cha
size_t _z_str_startswith(const char *s, const char *needle);
+// Must be used on a null terminated string with str[strlen(str) + 1] being valid memory.
+static inline void _z_str_append(char *str, const char c) {
+ size_t len = strlen(str);
+ str[len] = c;
+ str[len + 1] = '\0';
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/src/api/encoding.c b/src/api/encoding.c
index b4ff4cb1..16a5b9ff 100644
--- a/src/api/encoding.c
+++ b/src/api/encoding.c
@@ -19,6 +19,7 @@
#include <string.h>
#include "zenoh-pico.h"
+#include "zenoh-pico/utils/string.h"
#if Z_FEATURE_ENCODING_VALUES == 1
#define ENCODING_SCHEMA_SEPARATOR ';'
@@ -196,11 +197,10 @@ static z_result_t _z_encoding_convert_into_string(const z_loaned_encoding_t *enc
return _Z_ERR_SYSTEM_OUT_OF_MEMORY;
}
// Copy prefix
- char sep = ENCODING_SCHEMA_SEPARATOR;
(void)strncpy(value, prefix, prefix_len);
// Copy schema and separator
if (has_schema) {
- (void)strncat(value, &sep, 1);
+ _z_str_append(value, ENCODING_SCHEMA_SEPARATOR);
(void)strncat(value, _z_string_data(&encoding->schema), _z_string_len(&encoding->schema));
}
// Fill container
diff --git a/src/protocol/codec/declarations.c b/src/protocol/codec/declarations.c
index 905aad39..2146537e 100644
--- a/src/protocol/codec/declarations.c
+++ b/src/protocol/codec/declarations.c
@@ -163,6 +163,10 @@ z_result_t _z_declaration_encode(_z_wbuf_t *wbf, const _z_declaration_t *decl) {
case _Z_DECL_FINAL: {
ret = _z_decl_final_encode(wbf);
} break;
+
+ default:
+ ret = _Z_ERR_MESSAGE_SERIALIZATION_FAILED;
+ break;
}
return ret;
}
diff --git a/src/protocol/codec/transport.c b/src/protocol/codec/transport.c
index 894fb41d..51830cd1 100644
--- a/src/protocol/codec/transport.c
+++ b/src/protocol/codec/transport.c
@@ -217,11 +217,12 @@ z_result_t _z_init_encode(_z_wbuf_t *wbf, uint8_t header, const _z_t_msg_init_t
}
z_result_t _z_init_decode_ext(_z_msg_ext_t *extension, void *ctx) {
+ _ZP_UNUSED(ctx);
z_result_t ret = _Z_RES_OK;
- _z_t_msg_init_t *msg = (_z_t_msg_init_t *)ctx;
if (false) {
#if Z_FEATURE_FRAGMENTATION == 1
} else if (_Z_EXT_FULL_ID(extension->_header) == _Z_MSG_EXT_ID_INIT_PATCH) {
+ _z_t_msg_init_t *msg = (_z_t_msg_init_t *)ctx;
msg->_patch = (uint8_t)extension->_body._zint._val;
#endif
} else if (_Z_MSG_EXT_IS_MANDATORY(extension->_header)) {
diff --git a/src/protocol/config.c b/src/protocol/config.c
index 1cfcff9c..245e7c3d 100644
--- a/src/protocol/config.c
+++ b/src/protocol/config.c
@@ -21,6 +21,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/utils/pointers.h"
+#include "zenoh-pico/utils/string.h"
z_result_t _z_config_init(_z_config_t *ps) {
_z_str_intmap_init(ps);
@@ -142,15 +143,12 @@ size_t _z_str_intmap_strlen(const _z_str_intmap_t *s, uint8_t argc, _z_str_intma
void _z_str_intmap_onto_str(char *dst, size_t dst_len, const _z_str_intmap_t *s, uint8_t argc,
_z_str_intmapping_t argv[]) {
size_t len = dst_len;
- const char lsep = INT_STR_MAP_LIST_SEPARATOR;
- const char ksep = INT_STR_MAP_KEYVALUE_SEPARATOR;
-
dst[0] = '\0';
for (size_t i = 0; i < argc; i++) {
char *v = _z_str_intmap_get(s, argv[i]._key);
if (v != NULL) {
if (len > (size_t)0) {
- (void)strncat(dst, &lsep, 1); // List separator
+ _z_str_append(dst, INT_STR_MAP_LIST_SEPARATOR); // List separator
len = len - (size_t)1;
}
@@ -159,7 +157,7 @@ void _z_str_intmap_onto_str(char *dst, size_t dst_len, const _z_str_intmap_t *s,
len = len - strlen(argv[i]._str);
}
if (len > (size_t)0) {
- (void)strncat(dst, &ksep, 1); // KeyValue separator
+ _z_str_append(dst, INT_STR_MAP_KEYVALUE_SEPARATOR); // KeyValue separator
len = len - (size_t)1;
}
if (len > (size_t)0) {
diff --git a/src/session/rx.c b/src/session/rx.c
index d85f9d38..8556ce1d 100644
--- a/src/session/rx.c
+++ b/src/session/rx.c
@@ -93,6 +93,8 @@ static z_result_t _z_handle_declare(_z_session_t *zn, _z_n_msg_declare_t *decl,
static z_result_t _z_handle_request(_z_session_rc_t *zsrc, _z_session_t *zn, _z_n_msg_request_t *req,
z_reliability_t reliability) {
+ _ZP_UNUSED(reliability);
+ _ZP_UNUSED(zsrc);
switch (req->_tag) {
case _Z_REQUEST_QUERY:
#if Z_FEATURE_QUERYABLE == 1
@@ -158,6 +160,7 @@ static z_result_t _z_handle_response(_z_session_t *zn, _z_n_msg_response_t *resp
}
#else
_z_n_msg_response_clear(resp);
+ _ZP_UNUSED(zn);
#endif
return _Z_RES_OK;
}
diff --git a/src/transport/multicast/rx.c b/src/transport/multicast/rx.c
index 121406d0..47269b1a 100644
--- a/src/transport/multicast/rx.c
+++ b/src/transport/multicast/rx.c
@@ -294,6 +294,10 @@ static z_result_t _z_multicast_handle_fragment_inner(_z_transport_multicast_t *z
*dbuf_state = _Z_DBUF_STATE_NULL;
}
#else
+ _ZP_UNUSED(ztm);
+ _ZP_UNUSED(header);
+ _ZP_UNUSED(msg);
+ _ZP_UNUSED(entry);
_Z_INFO("Fragment dropped because fragmentation feature is deactivated");
#endif
return ret;
diff --git a/src/transport/unicast/rx.c b/src/transport/unicast/rx.c
index c5ccf932..43e1b4c8 100644
--- a/src/transport/unicast/rx.c
+++ b/src/transport/unicast/rx.c
@@ -248,6 +248,10 @@ static z_result_t _z_unicast_handle_fragment_inner(_z_transport_unicast_t *ztu,
*dbuf_state = _Z_DBUF_STATE_NULL;
}
#else
+ _ZP_UNUSED(ztu);
+ _ZP_UNUSED(header);
+ _ZP_UNUSED(msg);
+ _ZP_UNUSED(peer);
_Z_INFO("Fragment dropped because fragmentation feature is deactivated");
#endif
return ret;
--
2.50.1

View File

@@ -0,0 +1,18 @@
config BR2_PACKAGE_LIBZENOH_PICO
bool "libzenoh-pico"
# upstream hardcodes using asm("nop"), which is bogus and
# doesn't work on or1k
depends on !BR2_or1k
depends on BR2_TOOLCHAIN_HAS_THREADS
help
zenoh-pico is the Eclipse zenoh implementation that targets
constrained devices and offers a native C API. It is fully
compatible with its main Rust Zenoh implementation,
providing a lightweight implementation of most
functionalities.
https://github.com/eclipse-zenoh/zenoh-pico
comment "libzenoh-pico needs a toolchain w/ threads"
depends on !BR2_or1k
depends on !BR2_TOOLCHAIN_HAS_THREADS

View File

@@ -0,0 +1,3 @@
# Locally computed
sha256 822aaeafa47405c21b7935a1428b2ac796177ea35ac6b59580481c357edd2b78 libzenoh-pico-1.2.1.tar.gz
sha256 d386df32cf327bbb25abe894277d3d7e0f447bafc59f4ad362615b0136f30db5 LICENSE

View File

@@ -0,0 +1,14 @@
################################################################################
#
# libzenoh-pico
#
################################################################################
LIBZENOH_PICO_VERSION = 1.2.1
LIBZENOH_PICO_SITE = $(call github,eclipse-zenoh,zenoh-pico,$(LIBZENOH_PICO_VERSION))
LIBZENOH_PICO_LICENSE = Apache-2.0 or EPL-2.0
LIBZENOH_PICO_LICENSE_FILES = LICENSE
LIBZENOH_PICO_SUPPORTS_IN_SOURCE_BUILD = NO
LIBZENOH_PICO_INSTALL_STAGING = YES
$(eval $(cmake-package))