Skip to content

Commit 4a87842

Browse files
authored
Merge branch 'develop' into master
2 parents 91386b6 + b68e4e3 commit 4a87842

File tree

128 files changed

+3616
-1444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3616
-1444
lines changed

.github/workflows/build-test.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build and Test
22
on: [push, pull_request]
33
jobs:
4-
run-test:
4+
run-tests:
55
strategy:
66
fail-fast: false
77
matrix:
@@ -49,7 +49,21 @@ jobs:
4949
CXX: ${{ matrix.compiler.CXX }}
5050
run: python3 ./examples/buildall.py ${{ matrix.arch }} --build-system=${{ matrix.buildsystem }}
5151

52-
- name: Run Tests
52+
- name: Run Loopback Test
5353
run: |
5454
./build/examples/csp_arch
5555
./build/examples/csp_server_client -t
56+
57+
- name: Run ZMQ Client Test
58+
run: |
59+
./build/examples/zmqproxy &
60+
./build/examples/csp_server -z localhost -a 1 -t &
61+
./build/examples/csp_client -z localhost -a 2 -C 1 -t
62+
pkill zmqproxy
63+
64+
- name: Run ZMQ Server Test
65+
run: |
66+
./build/examples/zmqproxy &
67+
./build/examples/csp_client -z localhost -a 2 -C 1 -t &
68+
./build/examples/csp_server -z localhost -a 1 -t
69+
pkill zmqproxy
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Sphinx Docs Build
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
jobs:
8+
build-docs:
9+
if: github.repository_owner == 'libcsp'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout the repository
13+
uses: actions/checkout@v4
14+
15+
- name: Setup packages on Linux
16+
if: ${{ runner.os == 'Linux' }}
17+
working-directory: ./doc
18+
run: |
19+
sudo apt install libclang-dev
20+
pip3 install -r requirements.txt
21+
22+
- name: Build
23+
run: |
24+
cmake -B build-docs -S doc
25+
cmake --build build-docs
26+
27+
- name: Deploy
28+
uses: peaceiris/actions-gh-pages@v3
29+
if: ${{ github.event_name == 'push' }}
30+
with:
31+
publish_branch: gh-pages
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
publish_dir: ./build-docs/html
34+
force_orphan: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ GPATH
2323
GRTAGS
2424
GTAGS
2525
.vscode/
26+
build-docs

CMakeLists.txt

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ option(CSP_USE_RDP "Reliable Datagram Protocol" ON)
3333
option(CSP_USE_HMAC "Hash-based message authentication code" ON)
3434
option(CSP_USE_PROMISC "Promiscious mode" ON)
3535
option(CSP_USE_DEDUP "Packet deduplication" ON)
36+
option(CSP_USE_RTABLE "Use routing table" OFF)
3637

3738
option(CSP_ENABLE_PYTHON3_BINDINGS "Build Python3 binding" OFF)
3839

@@ -52,13 +53,34 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
5253
find_package(Threads REQUIRED)
5354
find_package(PkgConfig)
5455

55-
pkg_search_module(LIBZMQ libzmq)
56-
pkg_search_module(LIBSOCKETCAN libsocketcan)
56+
if(PKG_CONFIG_FOUND)
57+
pkg_search_module(LIBZMQ libzmq)
58+
if(${LIBZMQ_FOUND})
59+
message(STATUS "Found ${LIBZMQ_LINK_LIBRARIES} ${LIBZMQ_VERSION}")
60+
set(CSP_HAVE_LIBZMQ 1)
61+
else()
62+
message(NOTICE "No libzmq found")
63+
endif()
64+
65+
pkg_search_module(LIBSOCKETCAN libsocketcan)
66+
if(${LIBSOCKETCAN_FOUND})
67+
message(STATUS "Found ${LIBSOCKETCAN_LINK_LIBRARIES} ${LIBSOCKETCAN_VERSION}")
68+
set(CSP_HAVE_LIBSOCKETCAN 1)
69+
else()
70+
message(NOTICE "No libsocketcan found")
71+
endif()
72+
else()
73+
message(NOTICE "No pkg-config found")
74+
endif()
5775
endif()
5876

5977
file(REAL_PATH include csp_inc)
78+
file(REAL_PATH src csp_inc_src)
6079
list(APPEND csp_inc ${CMAKE_CURRENT_BINARY_DIR}/include)
61-
target_include_directories(csp PUBLIC ${csp_inc})
80+
target_include_directories(csp
81+
PUBLIC ${csp_inc}
82+
PRIVATE ${csp_inc_src}
83+
)
6284

6385
if(CSP_POSIX)
6486
set(CSP_C_ARGS -Wshadow -Wcast-align -Wwrite-strings -Wno-unused-parameter)

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ MAC-layer interfaces. The core of `libcsp`
1010
includes a router, a connection oriented socket API and
1111
message/connection pools.
1212

13-
The protocol is based on a 32-bit header containing both transport and
13+
The protocol is based on an very lightweight header containing both transport and
1414
network-layer information. Its implementation is designed for, but not
15-
limited to, embedded systems such as the 8-bit AVR microprocessor and
16-
the 32-bit ARM and AVR from Atmel. The implementation is written in GNU
17-
C and is currently ported to run on FreeRTOS, Linux (POSIX).
18-
The primiary platforms being used are FreeRTOS and Linux.
15+
limited to, embedded systems with very limited CPU and memory resources.
16+
The implementation is written in GNU C and is currently ported to run on FreeRTOS, Zephyr
17+
and Linux (POSIX).
1918

2019
The idea is to give sub-system developers of cubesats the same features
2120
of a TCP/IP stack, but without adding the huge overhead of the IP
@@ -27,7 +26,7 @@ several advantages compared to the traditional mater/slave topology used
2726
on many cubesats.
2827

2928
- Standardised network protocol: All subsystems can communicate with
30-
eachother
29+
eachother (multi-master)
3130
- Service loose coupling: Services maintain a relationship that
3231
minimizes dependencies between subsystems
3332
- Service abstraction: Beyond descriptions in the service contract,
@@ -44,8 +43,6 @@ The implementation of `libcsp` is written
4443
with simplicity in mind, but it's compile time configuration allows it
4544
to have some rather advanced features as well.
4645

47-
You can find documentation of the library [here](doc/libcsp.md).
48-
4946
## Features
5047

5148
- Thread safe Socket API
@@ -57,11 +54,15 @@ You can find documentation of the library [here](doc/libcsp.md).
5754
- Very Small Footprint in regards to code and memory required
5855
- Zero-copy buffer and queue system
5956
- Modular network interface system
60-
- OS abstraction, currently ported to: FreeRTOS, Linux (POSIX)
61-
and Windows
57+
- OS abstraction, currently ported to: FreeRTOS, Zephyr, Linux
6258
- Broadcast traffic
6359
- Promiscuous mode
64-
- Truncated HMAC-SHA1 Authentication (RFC 2104)
60+
61+
## Documentation
62+
63+
The latest version of the /doc folder is compiled to HTML and hosted on:
64+
65+
[libcsp.github.io/libcsp/](https://libcsp.github.io/libcsp/)
6566

6667
## Software license
6768

contrib/zephyr/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ if(CONFIG_LIBCSP)
99
# predefine it
1010
set(HAVE_SYS_SOCKET_H OFF)
1111

12+
if(CONFIG_CSP_USE_RTABLE)
13+
set(CSP_USE_RTABLE ON)
14+
endif()
15+
16+
if(CONFIG_CSP_HAVE_CAN)
17+
set(HAVE_ZEPHYR_CAN ON)
18+
endif()
19+
1220
add_subdirectory(../.. build)
1321

1422
zephyr_interface_library_named(libcsp)

contrib/zephyr/Kconfig

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,43 @@ config APP_LINK_WITH_LIBCSP
3030
help
3131
Add libcsp header files to the 'app' include path.
3232

33+
config CSP_USE_RTABLE
34+
bool "Use CSP static routing table"
35+
help
36+
This option enables to use the CSP static routing table
37+
38+
if CAN
39+
40+
config CSP_HAVE_CAN
41+
bool "Enable CAN driver for CSP"
42+
default y
43+
help
44+
This option enables the CAN driver for CSP.
45+
46+
config CSP_CAN_RX_MSGQ_DEPTH
47+
int "Depth of the message queue in the CSP CAN Driver."
48+
default 64
49+
help
50+
Depth of the message queue in the CSP CAN Driver.
51+
52+
config CSP_CAN_RX_THREAD_PRIORITY
53+
int "RX Thread priority in the CSP CAN Driver"
54+
default -1
55+
help
56+
CSP RX Thread priority in the CSP CAN Driver
57+
58+
config CSP_CAN_RX_THREAD_STACK_SIZE
59+
int "RX Thread stack size in the CSP CAN Driver"
60+
default 512
61+
help
62+
RX Thread stack size in the CSP CAN Driver
63+
64+
config CSP_CAN_RX_THREAD_NUM
65+
int "Number of thread stacks for CSP RX"
66+
default 1
67+
help
68+
Number of thread stacks for CSP RX
69+
70+
endif # CAN
71+
3372
endif # LIBCSP

contrib/zephyr/samples/arch/prj.conf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ CONFIG_LIBCSP=y
22
CONFIG_LIBCSP_HAVE_STDIO=y
33
CONFIG_LIBCSP_LOG_LEVEL_DBG=y
44

5-
CONFIG_MINIMAL_LIBC_RAND=y
5+
CONFIG_PICOLIBC=y
6+
67
CONFIG_LOG=y
7-
CONFIG_LOG2_MODE_DEFERRED=y
8+
CONFIG_LOG_MODE_DEFERRED=y
89
CONFIG_LOG_SPEED=y

contrib/zephyr/samples/server-client/csp_server_client_zephyr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
void server(void);
55
void client(void);
66

7-
#define ROUTER_STACK_SIZE 200
8-
#define SERVER_STACK_SIZE 400
9-
#define CLIENT_STACK_SIZE 400
7+
#define ROUTER_STACK_SIZE 256
8+
#define SERVER_STACK_SIZE 1024
9+
#define CLIENT_STACK_SIZE 1024
1010
#define ROUTER_PRIO 0
1111
#define SERVER_PRIO 0
1212
#define CLIENT_PRIO 0

0 commit comments

Comments
 (0)