From d6aa96c5f9aabc7b171ba962406b552f2d423481 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Mon, 3 Jun 2024 10:28:24 +0200 Subject: [PATCH 1/9] Bump jazzy (#139) --- .github/workflows/nightly.yml | 4 ++- README.md | 4 +-- modules/libmicroros/libmicroros.mk | 52 +++++++++++++++--------------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 859b77d..6bab7f5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: zephyr_version: ["zephyr-v3.1.0", "zephyr-v2.7.2"] - distro: ["iron", "humble", "rolling"] + distro: ["iron", "humble", "rolling", "jazzy"] include: - distro: iron branch: iron @@ -25,6 +25,8 @@ jobs: branch: rolling - distro: humble branch: humble + - distro: jazzy + branch: jazzy - zephyr_version: zephyr-v2.7.2 zephyr_sdk: 0.14.2 sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION\_linux-x86_64_minimal.tar.gz diff --git a/README.md b/README.md index 1e9bd43..af8a08e 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ Is possible to use a micro-ROS Agent just with this docker command: ```bash # Serial micro-ROS Agent -docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:rolling serial --dev [YOUR BOARD PORT] -v6 +docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:jazzy serial --dev [YOUR BOARD PORT] -v6 # UDPv4 micro-ROS Agent -docker run -it --rm --net=host microros/micro-ros-agent:rolling udp4 --port 8888 -v6 +docker run -it --rm --net=host microros/micro-ros-agent:jazzy udp4 --port 8888 -v6 ``` diff --git a/modules/libmicroros/libmicroros.mk b/modules/libmicroros/libmicroros.mk index f90f551..09467d3 100644 --- a/modules/libmicroros/libmicroros.mk +++ b/modules/libmicroros/libmicroros.mk @@ -61,12 +61,12 @@ configure_toolchain: $(COMPONENT_PATH)/zephyr_toolchain.cmake.in $(COMPONENT_PATH)/micro_ros_dev/install: rm -rf micro_ros_dev; \ mkdir micro_ros_dev; cd micro_ros_dev; \ - git clone -b rolling https://github.com/ament/ament_cmake src/ament_cmake; \ - git clone -b rolling https://github.com/ament/ament_lint src/ament_lint; \ - git clone -b rolling https://github.com/ament/ament_package src/ament_package; \ - git clone -b rolling https://github.com/ament/googletest src/googletest; \ - git clone -b rolling https://github.com/ros2/ament_cmake_ros src/ament_cmake_ros; \ - git clone -b rolling https://github.com/ament/ament_index src/ament_index; \ + git clone -b jazzy https://github.com/ament/ament_cmake src/ament_cmake; \ + git clone -b jazzy https://github.com/ament/ament_lint src/ament_lint; \ + git clone -b jazzy https://github.com/ament/ament_package src/ament_package; \ + git clone -b jazzy https://github.com/ament/googletest src/googletest; \ + git clone -b jazzy https://github.com/ros2/ament_cmake_ros src/ament_cmake_ros; \ + git clone -b jazzy https://github.com/ament/ament_index src/ament_index; \ colcon build --cmake-args -DBUILD_TESTING=OFF; $(COMPONENT_PATH)/micro_ros_src/src: @@ -74,26 +74,26 @@ $(COMPONENT_PATH)/micro_ros_src/src: mkdir micro_ros_src; cd micro_ros_src; \ git clone -b ros2 https://github.com/eProsima/micro-CDR src/micro-CDR; \ git clone -b ros2 https://github.com/eProsima/Micro-XRCE-DDS-Client src/Micro-XRCE-DDS-Client; \ - git clone -b rolling https://github.com/micro-ROS/rcl src/rcl; \ - git clone -b rolling https://github.com/ros2/rclc src/rclc; \ - git clone -b rolling https://github.com/micro-ROS/rcutils src/rcutils; \ - git clone -b rolling https://github.com/micro-ROS/micro_ros_msgs src/micro_ros_msgs; \ - git clone -b rolling https://github.com/micro-ROS/rmw-microxrcedds src/rmw-microxrcedds; \ - git clone -b rolling https://github.com/micro-ROS/rosidl_typesupport src/rosidl_typesupport; \ - git clone -b rolling https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds; \ - git clone -b rolling https://github.com/ros2/rosidl src/rosidl; \ - git clone -b rolling https://github.com/ros2/rosidl_dynamic_typesupport src/rosidl_dynamic_typesupport; \ - git clone -b rolling https://github.com/ros2/rmw src/rmw; \ - git clone -b rolling https://github.com/ros2/rcl_interfaces src/rcl_interfaces; \ - git clone -b rolling https://github.com/ros2/rosidl_defaults src/rosidl_defaults; \ - git clone -b rolling https://github.com/ros2/unique_identifier_msgs src/unique_identifier_msgs; \ - git clone -b rolling https://github.com/ros2/common_interfaces src/common_interfaces; \ - git clone -b rolling https://github.com/ros2/test_interface_files src/test_interface_files; \ - git clone -b rolling https://github.com/ros2/rmw_implementation src/rmw_implementation; \ - git clone -b rolling https://github.com/ros2/rcl_logging src/rcl_logging; \ - git clone -b rolling https://github.com/ros2/ros2_tracing src/ros2_tracing; \ - git clone -b rolling https://github.com/micro-ROS/micro_ros_utilities src/micro_ros_utilities; \ - git clone -b rolling https://github.com/ros2/rosidl_core src/rosidl_core; \ + git clone -b jazzy https://github.com/micro-ROS/rcl src/rcl; \ + git clone -b jazzy https://github.com/ros2/rclc src/rclc; \ + git clone -b jazzy https://github.com/micro-ROS/rcutils src/rcutils; \ + git clone -b jazzy https://github.com/micro-ROS/micro_ros_msgs src/micro_ros_msgs; \ + git clone -b jazzy https://github.com/micro-ROS/rmw-microxrcedds src/rmw-microxrcedds; \ + git clone -b jazzy https://github.com/micro-ROS/rosidl_typesupport src/rosidl_typesupport; \ + git clone -b jazzy https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds; \ + git clone -b jazzy https://github.com/ros2/rosidl src/rosidl; \ + git clone -b jazzy https://github.com/ros2/rosidl_dynamic_typesupport src/rosidl_dynamic_typesupport; \ + git clone -b jazzy https://github.com/ros2/rmw src/rmw; \ + git clone -b jazzy https://github.com/ros2/rcl_interfaces src/rcl_interfaces; \ + git clone -b jazzy https://github.com/ros2/rosidl_defaults src/rosidl_defaults; \ + git clone -b jazzy https://github.com/ros2/unique_identifier_msgs src/unique_identifier_msgs; \ + git clone -b jazzy https://github.com/ros2/common_interfaces src/common_interfaces; \ + git clone -b jazzy https://github.com/ros2/test_interface_files src/test_interface_files; \ + git clone -b jazzy https://github.com/ros2/rmw_implementation src/rmw_implementation; \ + git clone -b jazzy https://github.com/ros2/rcl_logging src/rcl_logging; \ + git clone -b jazzy https://github.com/ros2/ros2_tracing src/ros2_tracing; \ + git clone -b jazzy https://github.com/micro-ROS/micro_ros_utilities src/micro_ros_utilities; \ + git clone -b jazzy https://github.com/ros2/rosidl_core src/rosidl_core; \ touch src/ros2_tracing/test_tracetools/COLCON_IGNORE; \ touch src/ros2_tracing/lttngpy/COLCON_IGNORE; \ touch src/rosidl/rosidl_typesupport_introspection_cpp/COLCON_IGNORE; \ From 36c804ba69f373ac5e1a37de8acd2b1807879c1a Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Mon, 3 Jun 2024 10:31:20 +0200 Subject: [PATCH 2/9] Changelog --- CHANGELOG.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3358465..2b79b32 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,37 @@ Changelog for package micro_ros_zephyr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Forthcoming +----------- +* Bump jazzy (`#139 `_) +* Ignore lttngpy (`#135 `_) +* Fix of unknown Ringbuffer and not found USB-Serial Device (`#125 `_) (`#130 `_) + * Added Ringbuffer-config in prj.conf for eliminating error + * Added Label CDC_ACM_0 label with an overlay so "modules/libmicroros/microros_transports/serial-usb/microros_transports.c" can find the device + * Update app.overlay + * Update app.overlay + A fix for backwards compability + * Update app.overlay + * Update app.overlay + * Update prj.conf + * Better comments + * Changed settings to conditional from transport choice + * Update prj.conf + Co-authored-by: Pablo Garrido + * Update modules/libmicroros/Kconfig + Co-authored-by: Pablo Garrido + --------- + Co-authored-by: scrapforge + Co-authored-by: Pablo Garrido + (cherry picked from commit 7c5edcdf9e0a6c6e131d9e45ad357fa0757a5584) + Co-authored-by: scrapforge <99104728+scrapforge@users.noreply.github.com> +* Update CI with Serial USB build (`#126 `_) (`#128 `_) + (cherry picked from commit e1e23407664625c5cb145c791561007fe6d51df9) + Co-authored-by: Pablo Garrido +* Fix Nightly +* Remove micro-ROS fork (`#123 `_) +* Contributors: Antonio Cuadros, Pablo Garrido, mergify[bot] + 5.0.0 (2023-06-12) ------------------ * Update branches to rolling (`#121 `_) From 4c9603693504a9057adbcf4e052d7b3dcf898810 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Mon, 3 Jun 2024 10:31:23 +0200 Subject: [PATCH 3/9] 5.0.1 --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2b79b32..cac2076 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,8 +2,8 @@ Changelog for package micro_ros_zephyr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Forthcoming ------------ +5.0.1 (2024-06-03) +------------------ * Bump jazzy (`#139 `_) * Ignore lttngpy (`#135 `_) * Fix of unknown Ringbuffer and not found USB-Serial Device (`#125 `_) (`#130 `_) diff --git a/package.xml b/package.xml index f9828fc..369e176 100644 --- a/package.xml +++ b/package.xml @@ -2,7 +2,7 @@ micro_ros_zephyr - 5.0.0 + 5.0.1 micro-ROS tools for Zephyr RTOS Pablo Garrido Apache License 2.0 From 7cbe6da04405a4359c332f337356da49217ce4b6 Mon Sep 17 00:00:00 2001 From: Zordon <101883124+Z0rdon@users.noreply.github.com> Date: Mon, 17 Mar 2025 03:06:23 -0400 Subject: [PATCH 4/9] updates project to work with zephyr v4.0.x (#146) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * updates project to work with zephyr v4.0.x * updating workflows for zephyr v4.0.x * adds cmake prefix path, changes to ci image * adds manual trigger to ci workflows * updates CI workflows for all active ROS2 distros * Get uart device with Zephyr 4's Devicetree-centric approach Signed-off-by: Antón Casas * Tested in v4.1.0 using manual installation on Ubuntu:24.04 base Docker image Signed-off-by: Antón Casas * Add v4.1.0 to CI and nightly Signed-off-by: Antón Casas * State SDK used in CI. Restore Z0rdon's info about docker image used. Signed-off-by: Antón Casas --------- Signed-off-by: Antón Casas Co-authored-by: Antón Casas --- .github/workflows/ci.yml | 61 ++++++------------ .github/workflows/nightly.yml | 64 ++++++------------- README.md | 4 +- modules/libmicroros/CMakeLists.txt | 4 +- .../serial/microros_transports.c | 5 +- prj.conf | 2 +- src/main.c | 5 +- 7 files changed, 46 insertions(+), 99 deletions(-) mode change 100755 => 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml old mode 100755 new mode 100644 index 34ab831..4f7c599 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,71 +1,48 @@ name: CI on: + workflow_dispatch: + inputs: + name: + description: "Manual trigger" pull_request: - branches: - - '**' + branches: ["rolling", "jazzy", "humble"] jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:22.04 + container: + image: zephyrprojectrtos/ci:v0.26.17 + options: --user root + env: + CMAKE_PREFIX_PATH: /opt/toolchains strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v3.1.0", "zephyr-v2.7.2"] - include: - - zephyr_version: zephyr-v2.7.2 - zephyr_sdk: 0.14.2 - sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION\_linux-x86_64_minimal.tar.gz - - zephyr_version: zephyr-v3.1.0 - zephyr_sdk: 0.14.2 - sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION\_linux-x86_64_minimal.tar.gz + zephyr_version: ["v4.0.0", "v4.1.0"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: path: micro_ros_zephyr_module - name: Build shell: bash run: | - # Install dependencies - apt update - export DEBIAN_FRONTEND=noninteractive - apt install -y --no-install-recommends wget git cmake ninja-build gperf \ - ccache dfu-util device-tree-compiler wget \ - python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ - make gcc gcc-multilib g++-multilib libsdl2-dev - - # Install Zephyr environment - pip3 install --user -U west - export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" - west init zephyrproject - cd zephyrproject + # Zephyr setup + apt -y update + west init cd zephyr git checkout ${{ matrix.zephyr_version }} cd .. - west update - west zephyr-export - pip3 install --user -r zephyr/scripts/requirements.txt - cd .. - export TOOLCHAIN_VERSION=${{ matrix.zephyr_sdk }} - export TOOLCHAIN_FILE_NAME=${{ matrix.sdk_filename }} - wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v$TOOLCHAIN_VERSION/$TOOLCHAIN_FILE_NAME - tar xvf $TOOLCHAIN_FILE_NAME - cd zephyr-sdk-$TOOLCHAIN_VERSION - ./setup.sh -h -t arm-zephyr-eabi -c - cd .. - source zephyr-sdk-$TOOLCHAIN_VERSION/environment-setup-x86_64-pokysdk-linux - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - export ZEPHYR_SDK_INSTALL_DIR=$(pwd)/zephyr-sdk-$TOOLCHAIN_VERSION - source zephyrproject/zephyr/zephyr-env.sh + west update --narrow # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Build with Serial USB transport - west build -b disco_l475_iot1 micro_ros_zephyr_module -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y + west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y # Build with Serial transport - west build -b disco_l475_iot1 micro_ros_zephyr_module -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 6bab7f5..00b88c4 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -10,75 +10,47 @@ on: jobs: - micro_ros_zephyr_module: + nightly_micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:22.04 + container: + image: zephyrprojectrtos/ci:v0.26.17 + options: --user root + env: + CMAKE_PREFIX_PATH: /opt/toolchains strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v3.1.0", "zephyr-v2.7.2"] - distro: ["iron", "humble", "rolling", "jazzy"] + zephyr_version: ["v4.0.0", "v4.1.0"] + distro: ["rolling", "jazzy", "humble"] include: - - distro: iron - branch: iron - distro: rolling branch: rolling - - distro: humble - branch: humble - distro: jazzy branch: jazzy - - zephyr_version: zephyr-v2.7.2 - zephyr_sdk: 0.14.2 - sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION\_linux-x86_64_minimal.tar.gz - - zephyr_version: zephyr-v3.1.0 - zephyr_sdk: 0.14.2 - sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION\_linux-x86_64_minimal.tar.gz + - distro: humble + branch: humble steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: path: micro_ros_zephyr_module - branch: ${{ matrix.branch }} + ref: ${{ matrix.branch }} - name: Build shell: bash run: | - # Install dependencies - apt update - export DEBIAN_FRONTEND=noninteractive - apt install -y --no-install-recommends wget git cmake ninja-build gperf \ - ccache dfu-util device-tree-compiler wget \ - python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ - make gcc gcc-multilib g++-multilib libsdl2-dev - - # Install Zephyr environment - pip3 install --user -U west - export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" - west init zephyrproject - cd zephyrproject + # Zephyr setup + apt -y update + west init cd zephyr git checkout ${{ matrix.zephyr_version }} cd .. - west update - west zephyr-export - pip3 install --user -r zephyr/scripts/requirements.txt - cd .. - export TOOLCHAIN_VERSION=${{ matrix.zephyr_sdk }} - export TOOLCHAIN_FILE_NAME=${{ matrix.sdk_filename }} - wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v$TOOLCHAIN_VERSION/$TOOLCHAIN_FILE_NAME - tar xvf $TOOLCHAIN_FILE_NAME - cd zephyr-sdk-$TOOLCHAIN_VERSION - ./setup.sh -h -t arm-zephyr-eabi -c - cd .. - source zephyr-sdk-$TOOLCHAIN_VERSION/environment-setup-x86_64-pokysdk-linux - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - export ZEPHYR_SDK_INSTALL_DIR=$(pwd)/zephyr-sdk-$TOOLCHAIN_VERSION - source zephyrproject/zephyr/zephyr-env.sh + west update --narrow # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Build with Serial USB transport - west build -b disco_l475_iot1 micro_ros_zephyr_module -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y + west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y # Build with Serial transport - west build -b disco_l475_iot1 micro_ros_zephyr_module -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y diff --git a/README.md b/README.md index af8a08e..fca59c2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # micro-ROS module for Zephyr -This module has been tested in Zephyr RTOS v2.7.0 (SDK 0.14.2) and v3.1.0 (SDK 0.14.2). +This module has been tested in Zephyr RTOS v4.0.0 (SDK 0.16.9-rc3), and v4.1.0 (SDK 0.16.9-rc3), using a docker image based on 'zephyrprojectrtos/zephyr-build:v0.26.17'. ## Dependencies @@ -18,7 +18,7 @@ pip3 install catkin_pkg lark-parser empy colcon-common-extensions For example for `disco_l475_iot1` board: ```bash -west build -b disco_l475_iot1 micro_ros_zephyr_module +west build -b disco_l475_iot1 -p ``` Some configuration parameters can be found using: diff --git a/modules/libmicroros/CMakeLists.txt b/modules/libmicroros/CMakeLists.txt index 193524d..4e8c213 100644 --- a/modules/libmicroros/CMakeLists.txt +++ b/modules/libmicroros/CMakeLists.txt @@ -52,10 +52,9 @@ externalproject_add(libmicroros_project BUILD_BYPRODUCTS ${MICROROS_DIR}/libmicroros.a ) -zephyr_library_import(libmicroros ${MICROROS_DIR}/libmicroros.a) +zephyr_link_libraries(${MICROROS_DIR}/libmicroros.a) zephyr_interface_library_named(microros) -add_dependencies(microros libmicroros) add_dependencies(microros libmicroros_project) target_include_directories(microros INTERFACE ${MICROROS_DIR}/include) @@ -96,7 +95,6 @@ zephyr_library_sources( add_dependencies(microros microros_transports) add_dependencies(microros_transports libmicroros_project) -add_dependencies(microros_transports libmicroros) # Cleaning diff --git a/modules/libmicroros/microros_transports/serial/microros_transports.c b/modules/libmicroros/microros_transports/serial/microros_transports.c index 32a2e95..e2eea50 100644 --- a/modules/libmicroros/microros_transports/serial/microros_transports.c +++ b/modules/libmicroros/microros_transports/serial/microros_transports.c @@ -24,6 +24,7 @@ #include #define RING_BUF_SIZE 2048 +#define UART_NODE DT_NODELABEL(usart1) char uart_in_buffer[RING_BUF_SIZE]; char uart_out_buffer[RING_BUF_SIZE]; @@ -52,9 +53,7 @@ static void uart_fifo_callback(const struct device * dev, void * args){ bool zephyr_transport_open(struct uxrCustomTransport * transport){ zephyr_transport_params_t * params = (zephyr_transport_params_t*) transport->args; - char uart_descriptor[8]; - sprintf(uart_descriptor,"UART_%d", params->fd); - params->uart_dev = device_get_binding(uart_descriptor); + params->uart_dev = DEVICE_DT_GET(UART_NODE); if (!params->uart_dev) { printk("Serial device not found\n"); return false; diff --git a/prj.conf b/prj.conf index aa11d31..8c8706b 100644 --- a/prj.conf +++ b/prj.conf @@ -1,5 +1,6 @@ CONFIG_GPIO=y CONFIG_MICROROS=y +CONFIG_CPP=y CONFIG_MAIN_STACK_SIZE=25000 CONFIG_MAIN_THREAD_PRIORITY=3 @@ -9,7 +10,6 @@ CONFIG_NEWLIB_LIBC_NANO=n CONFIG_PTHREAD_IPC=n CONFIG_POSIX_API=y -CONFIG_APP_LINK_WITH_POSIX_SUBSYS=y CONFIG_POSIX_CLOCK=y CONFIG_STDOUT_CONSOLE=y diff --git a/src/main.c b/src/main.c index d24f06b..6efe05c 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,7 @@ #include #if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(3,1,0) -#include +#include #include #include #include @@ -39,7 +39,7 @@ void timer_callback(rcl_timer_t * timer, int64_t last_call_time) } } -void main(void) +int main(void) { rmw_uros_set_custom_transport( MICRO_ROS_FRAMING_REQUIRED, @@ -91,4 +91,5 @@ void main(void) // free resources RCCHECK(rcl_publisher_fini(&publisher, &node)) RCCHECK(rcl_node_fini(&node)) + return 0; } From 54dddbbd46058190cb6c4fc1715febc296eb389f Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Mon, 17 Mar 2025 08:07:16 +0100 Subject: [PATCH 5/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fca59c2..095ac2a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # micro-ROS module for Zephyr -This module has been tested in Zephyr RTOS v4.0.0 (SDK 0.16.9-rc3), and v4.1.0 (SDK 0.16.9-rc3), using a docker image based on 'zephyrprojectrtos/zephyr-build:v0.26.17'. +This module has been tested in Zephyr RTOS v4.0.0 (SDK 0.16.9-rc3), and v4.1.0 (SDK 0.16.9-rc3), using a docker image based on `zephyrprojectrtos/zephyr-build:v0.26.17`. ## Dependencies From d1e19be708360a58250f287a2e1f5c61526cfb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3n=20Casas?= Date: Mon, 17 Mar 2025 14:20:52 +0100 Subject: [PATCH 6/9] Update ci.yml and nightly.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antón Casas --- .github/workflows/ci.yml | 5 +++++ .github/workflows/nightly.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f7c599..b6fb812 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,11 @@ jobs: # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions + if [[ ${{ github.ref_name }} == "humble" ]] || [[ ${{ github.head_ref }} == *"humble"* ]]; then + # Use empy version 3.3.4 for Humble + pip3 install empy==3.3.4 + fi + # Build with Serial USB transport west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 00b88c4..be5b333 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -49,6 +49,11 @@ jobs: # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions + if [[ ${{ matrix.branch }} == "humble" ]]; then + # Use empy version 3.3.4 for Humble + pip3 install empy==3.3.4 + fi + # Build with Serial USB transport west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y From 7ca1d140ce0ced73d0e61651fbbe685b42f2be4d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 08:03:27 +0200 Subject: [PATCH 7/9] Update maintainers (#152) (#154) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit b81263f04077e2454d0de497449aa18279171896) Co-authored-by: Antón Casas --- package.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.xml b/package.xml index 369e176..570f29b 100644 --- a/package.xml +++ b/package.xml @@ -4,6 +4,7 @@ micro_ros_zephyr 5.0.1 micro-ROS tools for Zephyr RTOS - Pablo Garrido + Eugenio Collado + Carlos Espinoza Apache License 2.0 From 87dbe3a9b9d0fa347772e971d58d123e2296281a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 12:39:54 +0100 Subject: [PATCH 8/9] Fix CI no space left on device (#157) (#160) * Free space in docker * Build script as step * Nightly --------- Signed-off-by: Eugenio Collado Co-authored-by: EugenioCollado <121509066+EugenioCollado@users.noreply.github.com> --- .github/workflows/ci.yml | 43 +++++++++++++++++++++--------- .github/workflows/nightly.yml | 43 +++++++++++++++++++++--------- modules/libmicroros/libmicroros.mk | 1 + 3 files changed, 63 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6fb812..028e15c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,6 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: - image: zephyrprojectrtos/ci:v0.26.17 - options: --user root - env: - CMAKE_PREFIX_PATH: /opt/toolchains strategy: fail-fast: false matrix: @@ -26,28 +21,52 @@ jobs: with: path: micro_ros_zephyr_module - - name: Build - shell: bash + - name: Free disk space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo docker image prune --all --force + + - name: Create build script run: | + cat << 'EOF' > build.sh + #!/bin/bash + set -e + # Zephyr setup apt -y update - west init + west init cd zephyr - git checkout ${{ matrix.zephyr_version }} + git checkout $ZEPHYR_VERSION cd .. west update --narrow # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions - if [[ ${{ github.ref_name }} == "humble" ]] || [[ ${{ github.head_ref }} == *"humble"* ]]; then + if [[ "$REF_NAME" == "humble" ]] || [[ "$HEAD_REF" == *"humble"* ]]; then # Use empy version 3.3.4 for Humble pip3 install empy==3.3.4 fi # Build with Serial USB transport - west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y + west build -b disco_l475_iot1 /github/workspace/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y # Build with Serial transport - west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + west build -b disco_l475_iot1 /github/workspace/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + EOF + chmod +x build.sh + - name: Build + run: | + sudo docker run --rm \ + --user root \ + -v ${{ github.workspace }}:/github/workspace \ + -w /github/workspace \ + -e CMAKE_PREFIX_PATH=/opt/toolchains \ + -e ZEPHYR_VERSION=${{ matrix.zephyr_version }} \ + -e REF_NAME=${{ github.ref_name }} \ + -e HEAD_REF=${{ github.head_ref }} \ + zephyrprojectrtos/ci:v0.26.17 \ + /github/workspace/build.sh diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index be5b333..3239fae 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,11 +12,6 @@ jobs: nightly_micro_ros_zephyr_module: runs-on: ubuntu-latest - container: - image: zephyrprojectrtos/ci:v0.26.17 - options: --user root - env: - CMAKE_PREFIX_PATH: /opt/toolchains strategy: fail-fast: false matrix: @@ -35,27 +30,51 @@ jobs: path: micro_ros_zephyr_module ref: ${{ matrix.branch }} - - name: Build - shell: bash + - name: Free disk space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo docker image prune --all --force + + - name: Create build script run: | + cat << 'EOF' > build.sh + #!/bin/bash + set -e + # Zephyr setup apt -y update - west init + west init cd zephyr - git checkout ${{ matrix.zephyr_version }} + git checkout $ZEPHYR_VERSION cd .. west update --narrow # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions - if [[ ${{ matrix.branch }} == "humble" ]]; then + if [[ "$BRANCH_NAME" == "humble" ]]; then # Use empy version 3.3.4 for Humble pip3 install empy==3.3.4 fi # Build with Serial USB transport - west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y + west build -b disco_l475_iot1 /github/workspace/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y # Build with Serial transport - west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + west build -b disco_l475_iot1 /github/workspace/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + EOF + chmod +x build.sh + + - name: Build + run: | + sudo docker run --rm \ + --user root \ + -v ${{ github.workspace }}:/github/workspace \ + -w /github/workspace \ + -e CMAKE_PREFIX_PATH=/opt/toolchains \ + -e ZEPHYR_VERSION=${{ matrix.zephyr_version }} \ + -e BRANCH_NAME=${{ matrix.branch }} \ + zephyrprojectrtos/ci:v0.26.17 \ + /github/workspace/build.sh diff --git a/modules/libmicroros/libmicroros.mk b/modules/libmicroros/libmicroros.mk index 09467d3..9d6e812 100644 --- a/modules/libmicroros/libmicroros.mk +++ b/modules/libmicroros/libmicroros.mk @@ -67,6 +67,7 @@ $(COMPONENT_PATH)/micro_ros_dev/install: git clone -b jazzy https://github.com/ament/googletest src/googletest; \ git clone -b jazzy https://github.com/ros2/ament_cmake_ros src/ament_cmake_ros; \ git clone -b jazzy https://github.com/ament/ament_index src/ament_index; \ + touch src/ament_cmake_ros/rmw_test_fixture/COLCON_IGNORE; \ colcon build --cmake-args -DBUILD_TESTING=OFF; $(COMPONENT_PATH)/micro_ros_src/src: From 30226b89e6a45bfac2f1a7cf2a83934b7b2a6a21 Mon Sep 17 00:00:00 2001 From: kristkis Date: Thu, 16 Apr 2026 13:02:59 +0400 Subject: [PATCH 9/9] fix(serial-transport): Zephyr 4.1 compat, configurable UART, bug fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace with // in the header and remove from the source. On Zephyr 4.1+ with SDK 0.17.0 the toolchain's unistd.h collides with Zephyr's posix/sys/sysconf.h, causing a build error ("expected identifier before numeric constant" on _SC_ADVISORY_INFO). - Replace usleep() with k_usleep() — the POSIX sleep was the only reason for including unistd.h. k_usleep is Zephyr-native and does not require CONFIG_POSIX_API. - Make the UART device configurable via a DT alias (microros-serial). Applications that need a different UART define the alias in their board overlay. Falls back to DT_NODELABEL(usart1) when the alias is absent, preserving backward compatibility. - Fix ring_buf_init() passing uart_out_buffer as storage for the input ring buffer instead of uart_in_buffer. Worked by accident (out_ringbuf was never used) but was incorrect. - Remove unused uart_out_buffer and out_ringbuf (dead code). - Use device_is_ready() instead of a null pointer check in transport_open(). DEVICE_DT_GET never returns NULL in modern Zephyr; device_is_ready() is the correct readiness check. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Kristina Kisiuk kisyuk.kristina@gmail.com Signed-off-by: kristkis --- NOTICE | 3 +++ .../serial/microros_transports.c | 26 +++++++++++++------ .../serial/microros_transports.h | 4 ++- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/NOTICE b/NOTICE index 8797b1f..6a65334 100644 --- a/NOTICE +++ b/NOTICE @@ -20,5 +20,8 @@ # # Please keep the list sorted. +Aliensense + Kristina Kisiuk + eProsima Pablo Garrido \ No newline at end of file diff --git a/modules/libmicroros/microros_transports/serial/microros_transports.c b/modules/libmicroros/microros_transports/serial/microros_transports.c index e2eea50..e184fab 100644 --- a/modules/libmicroros/microros_transports/serial/microros_transports.c +++ b/modules/libmicroros/microros_transports/serial/microros_transports.c @@ -9,14 +9,12 @@ #include #include #include -#include #else #include #include #include #include #include -#include #endif #include @@ -24,12 +22,24 @@ #include #define RING_BUF_SIZE 2048 + +/* Select the UART device for the micro-ROS serial transport. + * Applications that need a different UART (e.g. lpuart1) define a + * DT alias in their board overlay: + * + * / { aliases { microros-serial = &lpuart1; }; }; + * + * When the alias is absent the transport falls back to usart1 for + * backward compatibility with existing applications. */ +#if DT_NODE_EXISTS(DT_ALIAS(microros_serial)) +#define UART_NODE DT_ALIAS(microros_serial) +#else #define UART_NODE DT_NODELABEL(usart1) +#endif char uart_in_buffer[RING_BUF_SIZE]; -char uart_out_buffer[RING_BUF_SIZE]; -struct ring_buf out_ringbuf, in_ringbuf; +struct ring_buf in_ringbuf; // --- micro-ROS Serial Transport for Zephyr --- @@ -54,12 +64,12 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){ zephyr_transport_params_t * params = (zephyr_transport_params_t*) transport->args; params->uart_dev = DEVICE_DT_GET(UART_NODE); - if (!params->uart_dev) { - printk("Serial device not found\n"); + if (!device_is_ready(params->uart_dev)) { + printk("Serial device not ready\n"); return false; } - ring_buf_init(&in_ringbuf, sizeof(uart_in_buffer), uart_out_buffer); + ring_buf_init(&in_ringbuf, sizeof(uart_in_buffer), uart_in_buffer); uart_irq_callback_set(params->uart_dev, uart_fifo_callback); @@ -93,7 +103,7 @@ size_t zephyr_transport_read(struct uxrCustomTransport* transport, uint8_t* buf, int spent_time = 0; while(ring_buf_is_empty(&in_ringbuf) && spent_time < timeout){ - usleep(1000); + k_usleep(1000); spent_time++; } diff --git a/modules/libmicroros/microros_transports/serial/microros_transports.h b/modules/libmicroros/microros_transports/serial/microros_transports.h index 8889d47..7c2fb3c 100644 --- a/modules/libmicroros/microros_transports/serial/microros_transports.h +++ b/modules/libmicroros/microros_transports/serial/microros_transports.h @@ -15,7 +15,9 @@ #ifndef _MICROROS_CLIENT_ZEPHYR_TRANSPORT_H_ #define _MICROROS_CLIENT_ZEPHYR_TRANSPORT_H_ -#include +#include +#include +#include #include #if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(3,1,0)