Skip to content

Request review before merge official branch#5

Open
Apaisal wants to merge 350 commits intoEmOne:developfrom
libcsp:develop
Open

Request review before merge official branch#5
Apaisal wants to merge 350 commits intoEmOne:developfrom
libcsp:develop

Conversation

@Apaisal
Copy link
Member

@Apaisal Apaisal commented Feb 8, 2026

Review before merging from the official

robamu and others added 30 commits December 2, 2024 06:18
Some pointer arguments were updated to `const` to indicate
immutability when no modification is necessary.

Signed-off-by: Robin Mueller <robin.mueller.m@gmail.com>
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Update Waf 2.1.4.

  NEW IN WAF 2.1.4
  ----------------
  * Prevent subprocesses from disrupting the main build process
    through inherited stdin
  * Fix a regression that prevents displaying help from
    custom commands

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
"abc" without NUL terminator is 3 bytes instead of 4 bytes. We don't
want to send NUL terminator on CSP packet.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
"abc" without NUL terminator is 3 bytes instead of 4 bytes. We don't
want to send NUL terminator on CSP packet.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
csp_if_zqmhub.c doesn't properly handle return values but depends on
assert().  For now, make compiler silent by marking them by
__maybe_unused.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Building samples and examples with CMake has been tedious, requiring
manual specification of each sample to build. This commit introduces a
new option, `CSP_BUILD_SAMPLES`, which simplifies the process.

With this option, you can now build all samples using the following
commands:

    cmake -B builddir -DCSP_BUILD_SAMPLES=1
    ninja -C builddir

This enhancement streamlines the workflow for building all samples.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Teach buildall.py how to build samples and examples using
`CSP_BUILD_SAMPLES`.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
"mps2_an385" was a old board name. With Zephyr Hardware Model
v2 (aka. HWMv2), it's been renamed to mps2/an385.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Add Python 3.12 for the Zephyr build test.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
When building libcsp with Zephyr RTOS, the compilation flags are
handled by the Zephyr Build System. Adding extra flags here causes
more harm than good.

This commit removes these flags completely.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
The CSP_SYSTEM_NAME variable is introduced to specify the kernel name
since CMAKE_SYSTEM_NAME does not recognize FreeRTOS.
This approach ensures flexibility for adding support for new kernels in
the future.
Removed an unnecessary trailing newline from the CMakeLists.txt file.
No functionality has been changed.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Replaced the use of CMAKE_SYSTEM_NAME with CSP_POSIX, CSP_FREERTOS,
and CSP_ZEPHYR across all CMakeLists.txt files. This simplifies
conditional branching by using these variables instead of relying on
explicit checks for CMAKE_SYSTEM_NAME.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Previously, Zephyr RTOS used "Zephyr" as the value for
CMAKE_SYSTEM_NAME.  To standardize behavior, CMAKE_SYSTEM_NAME is now
left unchanged, defaulting to "Generic" for systems unknown to CMake.

With CSP_SYSTEM_NAME introduced in recent commits, this update moves
Zephyr RTOS to use CSP_SYSTEM_NAME instead.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
`CMAKE_SYSTEM_NAME` is typically uppercase or capitalized, but our
FreeRTOS port uses lowercase. To handle this inconsistency, this
commit makes `CSP_SYSTEM_NAME` checks case-insensitive by converting
the value to lowercase before comparison.

This change ensures compatibility with various naming conventions.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Document the steps to build Python bindings using CMake. Include
necessary options and additional steps for enabling the routing table
and setting `PYTHONPATH` for usage.

Also, add an additional headline level for improved section structure.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Correct the PYTHONPATH path in the INSTALL document. The path
incorrectly used `build` instead of the consistent `builddir` used
throughout the document.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Include the missing file `src/interfaces/csp_if_tun.c` in
`wscript`. This file was introduced in commit `70e43adec06dea2` but
was not added to the waf build system.

Note that it was already added to CMake in commit `2f9adbfeb79ec6f`.
GitHub Actions recently updated `ubuntu-latest` from `ubuntu-22.04` to
`ubuntu-24.04`, causing documentation builds to fail with the
following error:

    Exception occurred:
      File "/home/runner/.local/lib/python3.12/site-packages/clang/cindex.py",
      line 4179, in get_cindex_library
        raise LibclangError(msg)

    clang.cindex.LibclangError: /usr/lib/llvm-14/lib/libclang-14.so: cannot open
    shared object file: No such file or directory. To provide a path to libclang
    use Config.set_library_path() or Config.set_library_file().

    The full traceback has been saved in /tmp/sphinx-err-424nf1r4.log, if you
    want to report the issue to the developers.
    Please also report this if it was a user error, so that a better error
    message can be provided next time.
    A bug report can be filed in the tracker at <https://github.com/sphinx-doc/
    sphinx/issues>. Thanks!
    gmake[2]: *** [CMakeFiles/docs.dir/build.make:73: html/index.html] Error 2
    gmake[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/docs.dir/all] Error 2
    gmake: *** [Makefile:91: all] Error 2
    Error: Process completed with exit code 2.

To resolve this, the workflows are rolled back to explicitly use
`ubuntu-22.04`.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Remove MacOS from GitHub Actions workflows as it is not currently
supported.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Building libcsp sometimes fails with specific GCC versions due to
changes in the default warning levels. This commit adds a matrix to
test builds with GCC versions 10 through 14.

The "exclude" strategy is used instead of "include" because, despite
GitHub Actions supporting matrix expansion, I could not make it work
in this case.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Update datalen to use `size_t` since `zmq_msg_size()` returns `size_t`
instead of `int`. Ensure strict type correctness.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Replace local declarations of csp_id_strip() and csp_id_setup_rx()
with `#include <csp/csp_id.h>` to use the existing declarations from
the header file.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Update datalen to use `size_t` since `zmq_msg_size()` returns `size_t`
instead of `int`. Ensure strict type correctness.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
The `zmq_msg_data()` function does not return a `const` value. While
using `const` is generally good practice for unmodified data, this
change is a preparatory step for an upcoming commit that modifies the
`rx_data`.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Add `csp_id_prepend_fixup_cspv1()` and `csp_id_strip_fixup_cspv1()` to
address a CSPv1 protocol issue where the ZMQ interface incorrectly
uses host byte order. These functions ensure compatibility with such
misbehaving interfaces.

Modify `csp_id1_prepend()` and `csp_id1_strip()` to accept an optional
`network_byte_order` flag for explicit byte-order control. These
remain internal APIs, with the new fixup functions being their only
current users.

Enhance compatibility by supporting interfaces that incorrectly use
host byte order in the CSPv1 protocol.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Update `csp_id1_prepend()` and `csp_id1_strip()` to clearly indicate
that the second parameter (`cspv1_fixup`) is used solely for handling
the fixup byte order quirk.

Simplify the endian conversion logic by always converting to
big-endian unconditionally:

    id1 = htobe32(id1_raw);

Subsequently, apply the fixup only if needed. This makes the intention
of converting to/from big-endian clearer.

No functionality should be changed.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
csp_id_prepend_fixup_cspv1 and csp_id_strip_fixup_cspv1 add
unnecessary code for configurations that do not require them. Enable
these functions only when CSP_FIXUP_V1_ZMQ_LITTLE_ENDIAN is non-zero.

This change reduces code size slightly compared to previous commits:

     text   data     bss     dec     hex filename
    80228   2952   15016   98196   17f94 builddir/libcsp.so
    79759   2936   15016   97711   17daf builddir/libcsp.so

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reintroduce the destination address as the first byte for ZMQ
interface with CSPv1. The destination address byte was removed in
commit `b3217c0f48d47192f2f` for CSPv2. This commit re-adds it when
using CSPv1.

Code changes include helper functions to handle destination address
addition/removal for CSPv1.

Signed-off-by: n-log-gos <nicolas.logioia@orbitalsystems.de>
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Address a CSPv1 protocol compatibility issue in the ZMQ interface. In
libcsp v1, the ZMQ interface incorrectly used host byte-order for the
CSP ID, leading to interoperability issues. Libcsp v2 corrected this
by enforcing big-endian encoding for the CSP ID, regardless of the
host system’s endianness.

But, this mismatch prevents libcsp v2 ZMQ interfaces from
communicating with nodes running libcsp v1 over CSPv1 protocol.

These commit adds compatibility between libcsp v2 and nodes running
libcsp v1 with CSPv1 protocol over ZMQ, ensuring consistent header
handling across systems.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
edvardxyz and others added 30 commits February 14, 2026 10:16
Previously, posix instances using CAN did not accept L2 and L3 broadcast
due to HW filtering
…sc (#824)

Previously, posix instances using CAN did not accept L2 and L3 broadcast
due to HW filtering

Co-authored-by: Johan De Claville Christiansen <johan@space-inventor.com>
The issue originates in the fact that L3 data is overriding L2 data in the csp_packet header.
This is resolved on the libcsp/libcsp/develop branch already, by removing the union.
We should consider actually returning an error.
Instead we still just override the last available route,
which seems to have been the previous intention.

Co-authored-by: edvard <edvard@space-inventor.com>
When it isn't exactly 40 characters long
Added `csp_zmqhub_<add/remove>_filters()` to change promisc settings after init
This is used for multicast-like operations, similar to the original concept of CAN
From old times when the RX buffer could fluctuate more, we used to reserve two times window in the rx_queue, but after optimization we find that only 1 time is required.
These are given funky names by gcc, like csp_buffer_pool.2, which make them difficult for static analysis tools to find and put into context.

Moving to file scope is only a slight scope increase which can be tolerated for the benefits of static analysis.
This might have to be 64-bit to get full nanosecond network time later. But for now, just to ensure it builds again, we add as uint32
* Remove packet copy when transmitting CSP packets

Credits to @MErdbruegger for suggesting this improvement.

* inlined helper function

and fix a few spellings

---------

Co-authored-by: Troels Jessen <troels@space-inventor.com>
Credits to @MErdbruegger for suggesting this improvement.
and fix a few spellings
This should not really be of any concern of libcsp
This is faster in most cases
size is protected with if as the user could have set invalid packet
length.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comments