From 64370f19cc08cf410ee46e9a8d0510ae2357f1cc Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 10:35:28 +0200 Subject: [PATCH 1/9] Add v2.7.0 and v3.1.0 Signed-off-by: Pablo Garrido Fix Signed-off-by: Pablo Garrido Fix Signed-off-by: Pablo Garrido Use ubuntu 20.04 Signed-off-by: Pablo Garrido Update cmake Signed-off-by: Pablo Garrido Fix env Signed-off-by: Pablo Garrido Fix Signed-off-by: Pablo Garrido Deprecate v2.4.0 Signed-off-by: Pablo Garrido Update Signed-off-by: Pablo Garrido Update Readme Signed-off-by: Pablo Garrido Fix CMake Signed-off-by: Pablo Garrido Update Signed-off-by: Pablo Garrido --- .github/workflows/ci.yml | 66 ++++++++++++++-- .github/workflows/nightly.yml | 77 ++++++++++++++++--- README.md | 2 +- .../serial-usb/microros_transports.c | 18 +++-- .../serial-usb/microros_transports.h | 2 +- prj.conf | 2 - src/main.c | 6 +- 7 files changed, 140 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0243c6..94badaf 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,21 +9,21 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:20.04 + container: ubuntu:22.04 strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v2.4.0", "zephyr-v2.5.0", "zephyr-v2.6.0"] + zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0", "zephyr-v2.7.2"] include: - - zephyr_version: zephyr-v2.4.0 - zephyr_sdk: 0.11.4 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.5.0 zephyr_sdk: 0.11.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.6.0 zephyr_sdk: 0.12.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run + - zephyr_version: zephyr-v2.7.2 + zephyr_sdk: 0.13.1 + sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-linux-x86_64-setup.run steps: - uses: actions/checkout@v2 with: @@ -34,7 +34,7 @@ jobs: run: | apt update export DEBIAN_FRONTEND=noninteractive - apt install -y --no-install-recommends git cmake ninja-build gperf \ + apt install -y --no-install-recommends wget git cmake ninja-build gperf \ ccache dfu-util device-tree-compiler wget curl gnupg2 \ python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ make gcc gcc-multilib g++-multilib libsdl2-dev @@ -60,7 +60,57 @@ jobs: source zephyrproject/zephyr/zephyr-env.sh # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions - # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true - pip3 install --upgrade Sphinx + # Building the app + west build -b disco_l475_iot1 micro_ros_zephyr_module + + micro_ros_zephyr_module_v3: + runs-on: ubuntu-latest + container: ubuntu:22.04 + strategy: + fail-fast: false + matrix: + zephyr_version: ["zephyr-v3.1.0"] + include: + - zephyr_version: zephyr-v3.1.0 + zephyr_sdk: 0.14.2 + sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION\_linux-x86_64_minimal.tar.gz + steps: + - uses: actions/checkout@v2 + with: + path: micro_ros_zephyr_module + + - name: Dependencies + shell: bash + run: | + 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 + pip3 install --user -U west + export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" + west init zephyrproject + cd zephyrproject + 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 + # Installing micro-ROS prerequisites + pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Building the app west build -b disco_l475_iot1 micro_ros_zephyr_module diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5fbade0..a7b8fd0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,26 +12,28 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:20.04 + container: ubuntu:22.04 strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v2.4.0", "zephyr-v2.5.0", "zephyr-v2.6.0"] - distro: ["foxy", "rolling"] + zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0", "zephyr-v2.7.2"] + distro: ["foxy", "humble", "rolling"] include: - distro: foxy branch: foxy - distro: rolling branch: main - - zephyr_version: zephyr-v2.4.0 - zephyr_sdk: 0.11.4 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run + - distro: humble + branch: humble - zephyr_version: zephyr-v2.5.0 zephyr_sdk: 0.11.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.6.0 zephyr_sdk: 0.12.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run + - zephyr_version: zephyr-v2.7.2 + zephyr_sdk: 0.13.1 + sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-linux-x86_64-setup.run steps: - uses: actions/checkout@v2 with: @@ -42,7 +44,7 @@ jobs: run: | apt update export DEBIAN_FRONTEND=noninteractive - apt install -y --no-install-recommends git cmake ninja-build gperf \ + apt install -y --no-install-recommends wget git cmake ninja-build gperf \ ccache dfu-util device-tree-compiler wget curl gnupg2 \ python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ make gcc gcc-multilib g++-multilib libsdl2-dev @@ -68,7 +70,64 @@ jobs: source zephyrproject/zephyr/zephyr-env.sh # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions - # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true - pip3 install --upgrade Sphinx + # Building the app + west build -b disco_l475_iot1 micro_ros_zephyr_module + + micro_ros_zephyr_module_v3: + runs-on: ubuntu-latest + container: ubuntu:22.04 + strategy: + fail-fast: false + matrix: + zephyr_version: ["zephyr-v3.1.0"] + distro: ["foxy", "humble", "rolling"] + include: + - distro: foxy + branch: foxy + - distro: rolling + branch: main + - distro: humble + branch: humble + - zephyr_version: zephyr-v3.1.0 + zephyr_sdk: 0.14.2 + sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION_linux-x86_64_minimal.tar.gz + steps: + - uses: actions/checkout@v2 + with: + path: micro_ros_zephyr_module + + - name: Dependencies + shell: bash + run: | + 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 + pip3 install --user -U west + export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" + west init zephyrproject + cd zephyrproject + 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 + # Installing micro-ROS prerequisites + pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Building the app west build -b disco_l475_iot1 micro_ros_zephyr_module diff --git a/README.md b/README.md index 19f4e28..7e80b92 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.4.0 (SDK 0.11.4), v2.5.0 (SDK 0.11.4) and v2.6.0 (SDK 0.12.4). +This module has been tested in Zephyr RTOS v2.5.0 (SDK 0.11.4), v2.6.0 (SDK 0.12.4), v2.7.0 (SDK 0.13.1) and v3.1.0 (SDK 0.14.2). ## Dependencies diff --git a/modules/libmicroros/microros_transports/serial-usb/microros_transports.c b/modules/libmicroros/microros_transports/serial-usb/microros_transports.c index 637064b..3e9221a 100644 --- a/modules/libmicroros/microros_transports/serial-usb/microros_transports.c +++ b/modules/libmicroros/microros_transports/serial-usb/microros_transports.c @@ -22,7 +22,7 @@ char uart_out_buffer[RING_BUF_SIZE]; struct ring_buf out_ringbuf, in_ringbuf; -static void uart_fifo_callback(struct device *dev){ +static void uart_fifo_callback(const struct device *dev, void * user_data){ while (uart_irq_update(dev) && uart_irq_is_pending(dev)) { if (uart_irq_rx_ready(dev)) { int recv_len; @@ -36,7 +36,7 @@ static void uart_fifo_callback(struct device *dev){ } - if (uart_irq_tx_ready(dev)) { + if (uart_irq_tx_ready(dev)) { char buffer[64]; int rb_len; @@ -58,12 +58,15 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){ int ret; uint32_t baudrate, dtr = 0U; - params->uart_dev = device_get_binding("CDC_ACM_0"); + + // params->uart_dev = device_get_binding("CDC_ACM_0"); + params->uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart); + printk("uart_dev: %p\n", params->uart_dev); if (!params->uart_dev) { printk("CDC ACM device not found\n"); return false; } - + printk("CDC ACM device found: ready: %d\n", device_is_ready(params->uart_dev)); ret = usb_enable(NULL); if (ret != 0) { printk("Failed to enable USB\n"); @@ -116,6 +119,7 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){ bool zephyr_transport_close(struct uxrCustomTransport * transport){ zephyr_transport_params_t * params = (zephyr_transport_params_t*) transport->args; + (void) params; return true; } @@ -124,15 +128,15 @@ size_t zephyr_transport_write(struct uxrCustomTransport* transport, const uint8_ zephyr_transport_params_t * params = (zephyr_transport_params_t*) transport->args; size_t wrote; - + wrote = ring_buf_put(&out_ringbuf, buf, len); - + uart_irq_tx_enable(params->uart_dev); while (!ring_buf_is_empty(&out_ringbuf)){ k_sleep(K_MSEC(5)); } - + return wrote; } diff --git a/modules/libmicroros/microros_transports/serial-usb/microros_transports.h b/modules/libmicroros/microros_transports/serial-usb/microros_transports.h index 144b4b4..281ad5b 100644 --- a/modules/libmicroros/microros_transports/serial-usb/microros_transports.h +++ b/modules/libmicroros/microros_transports/serial-usb/microros_transports.h @@ -26,7 +26,7 @@ extern "C" typedef struct { size_t fd; - struct device *uart_dev; + const struct device *uart_dev; } zephyr_transport_params_t; #define MICRO_ROS_FRAMING_REQUIRED true diff --git a/prj.conf b/prj.conf index 7da89e5..ccb67ed 100644 --- a/prj.conf +++ b/prj.conf @@ -9,12 +9,10 @@ CONFIG_NEWLIB_LIBC_NANO=n CONFIG_PTHREAD_IPC=n CONFIG_POSIX_API=y -CONFIG_NATIVE_POSIX_TIMER=y CONFIG_APP_LINK_WITH_POSIX_SUBSYS=y CONFIG_POSIX_CLOCK=y CONFIG_STDOUT_CONSOLE=y -CONFIG_USB=y CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="Zephyr micro-ROS" CONFIG_LOG=y diff --git a/src/main.c b/src/main.c index 1a335df..0b684c7 100644 --- a/src/main.c +++ b/src/main.c @@ -43,12 +43,8 @@ void main(void) rcl_allocator_t allocator = rcl_get_default_allocator(); rclc_support_t support; - rcl_init_options_t init_options = rcl_get_zero_initialized_init_options(); - RCCHECK(rcl_init_options_init(&init_options, allocator)); - rmw_init_options_t* rmw_options = rcl_init_options_get_rmw_init_options(&init_options); - // create init_options - RCCHECK(rclc_support_init_with_options(&support, 0, NULL, &init_options, &allocator)); + RCCHECK(rclc_support_init(&support, 0, NULL, &allocator)); // create node rcl_node_t node; From aa6bfbae50b4cf0035e7dd60ea14e1b476c9bc40 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 10:35:28 +0200 Subject: [PATCH 2/9] Revert "Add v2.7.0 and v3.1.0" This reverts commit 64370f19cc08cf410ee46e9a8d0510ae2357f1cc. --- .github/workflows/ci.yml | 66 ++-------------- .github/workflows/nightly.yml | 77 +++---------------- README.md | 2 +- .../serial-usb/microros_transports.c | 18 ++--- .../serial-usb/microros_transports.h | 2 +- prj.conf | 2 + src/main.c | 6 +- 7 files changed, 33 insertions(+), 140 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94badaf..f0243c6 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,21 +9,21 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:22.04 + container: ubuntu:20.04 strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0", "zephyr-v2.7.2"] + zephyr_version: ["zephyr-v2.4.0", "zephyr-v2.5.0", "zephyr-v2.6.0"] include: + - zephyr_version: zephyr-v2.4.0 + zephyr_sdk: 0.11.4 + sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.5.0 zephyr_sdk: 0.11.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.6.0 zephyr_sdk: 0.12.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run - - zephyr_version: zephyr-v2.7.2 - zephyr_sdk: 0.13.1 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-linux-x86_64-setup.run steps: - uses: actions/checkout@v2 with: @@ -34,7 +34,7 @@ jobs: run: | apt update export DEBIAN_FRONTEND=noninteractive - apt install -y --no-install-recommends wget git cmake ninja-build gperf \ + apt install -y --no-install-recommends git cmake ninja-build gperf \ ccache dfu-util device-tree-compiler wget curl gnupg2 \ python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ make gcc gcc-multilib g++-multilib libsdl2-dev @@ -60,57 +60,7 @@ jobs: source zephyrproject/zephyr/zephyr-env.sh # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions - # Building the app - west build -b disco_l475_iot1 micro_ros_zephyr_module - - micro_ros_zephyr_module_v3: - runs-on: ubuntu-latest - container: ubuntu:22.04 - strategy: - fail-fast: false - matrix: - zephyr_version: ["zephyr-v3.1.0"] - include: - - zephyr_version: zephyr-v3.1.0 - zephyr_sdk: 0.14.2 - sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION\_linux-x86_64_minimal.tar.gz - steps: - - uses: actions/checkout@v2 - with: - path: micro_ros_zephyr_module - - - name: Dependencies - shell: bash - run: | - 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 - pip3 install --user -U west - export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" - west init zephyrproject - cd zephyrproject - 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 - # Installing micro-ROS prerequisites - pip3 install catkin_pkg lark-parser empy colcon-common-extensions + # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true + pip3 install --upgrade Sphinx # Building the app west build -b disco_l475_iot1 micro_ros_zephyr_module diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a7b8fd0..5fbade0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,28 +12,26 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:22.04 + container: ubuntu:20.04 strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0", "zephyr-v2.7.2"] - distro: ["foxy", "humble", "rolling"] + zephyr_version: ["zephyr-v2.4.0", "zephyr-v2.5.0", "zephyr-v2.6.0"] + distro: ["foxy", "rolling"] include: - distro: foxy branch: foxy - distro: rolling branch: main - - distro: humble - branch: humble + - zephyr_version: zephyr-v2.4.0 + zephyr_sdk: 0.11.4 + sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.5.0 zephyr_sdk: 0.11.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.6.0 zephyr_sdk: 0.12.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run - - zephyr_version: zephyr-v2.7.2 - zephyr_sdk: 0.13.1 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-linux-x86_64-setup.run steps: - uses: actions/checkout@v2 with: @@ -44,7 +42,7 @@ jobs: run: | apt update export DEBIAN_FRONTEND=noninteractive - apt install -y --no-install-recommends wget git cmake ninja-build gperf \ + apt install -y --no-install-recommends git cmake ninja-build gperf \ ccache dfu-util device-tree-compiler wget curl gnupg2 \ python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ make gcc gcc-multilib g++-multilib libsdl2-dev @@ -70,64 +68,7 @@ jobs: source zephyrproject/zephyr/zephyr-env.sh # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions - # Building the app - west build -b disco_l475_iot1 micro_ros_zephyr_module - - micro_ros_zephyr_module_v3: - runs-on: ubuntu-latest - container: ubuntu:22.04 - strategy: - fail-fast: false - matrix: - zephyr_version: ["zephyr-v3.1.0"] - distro: ["foxy", "humble", "rolling"] - include: - - distro: foxy - branch: foxy - - distro: rolling - branch: main - - distro: humble - branch: humble - - zephyr_version: zephyr-v3.1.0 - zephyr_sdk: 0.14.2 - sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION_linux-x86_64_minimal.tar.gz - steps: - - uses: actions/checkout@v2 - with: - path: micro_ros_zephyr_module - - - name: Dependencies - shell: bash - run: | - 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 - pip3 install --user -U west - export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" - west init zephyrproject - cd zephyrproject - 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 - # Installing micro-ROS prerequisites - pip3 install catkin_pkg lark-parser empy colcon-common-extensions + # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true + pip3 install --upgrade Sphinx # Building the app west build -b disco_l475_iot1 micro_ros_zephyr_module diff --git a/README.md b/README.md index 7e80b92..19f4e28 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.5.0 (SDK 0.11.4), v2.6.0 (SDK 0.12.4), v2.7.0 (SDK 0.13.1) and v3.1.0 (SDK 0.14.2). +This module has been tested in Zephyr RTOS v2.4.0 (SDK 0.11.4), v2.5.0 (SDK 0.11.4) and v2.6.0 (SDK 0.12.4). ## Dependencies diff --git a/modules/libmicroros/microros_transports/serial-usb/microros_transports.c b/modules/libmicroros/microros_transports/serial-usb/microros_transports.c index 3e9221a..637064b 100644 --- a/modules/libmicroros/microros_transports/serial-usb/microros_transports.c +++ b/modules/libmicroros/microros_transports/serial-usb/microros_transports.c @@ -22,7 +22,7 @@ char uart_out_buffer[RING_BUF_SIZE]; struct ring_buf out_ringbuf, in_ringbuf; -static void uart_fifo_callback(const struct device *dev, void * user_data){ +static void uart_fifo_callback(struct device *dev){ while (uart_irq_update(dev) && uart_irq_is_pending(dev)) { if (uart_irq_rx_ready(dev)) { int recv_len; @@ -36,7 +36,7 @@ static void uart_fifo_callback(const struct device *dev, void * user_data){ } - if (uart_irq_tx_ready(dev)) { + if (uart_irq_tx_ready(dev)) { char buffer[64]; int rb_len; @@ -58,15 +58,12 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){ int ret; uint32_t baudrate, dtr = 0U; - - // params->uart_dev = device_get_binding("CDC_ACM_0"); - params->uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart); - printk("uart_dev: %p\n", params->uart_dev); + params->uart_dev = device_get_binding("CDC_ACM_0"); if (!params->uart_dev) { printk("CDC ACM device not found\n"); return false; } - printk("CDC ACM device found: ready: %d\n", device_is_ready(params->uart_dev)); + ret = usb_enable(NULL); if (ret != 0) { printk("Failed to enable USB\n"); @@ -119,7 +116,6 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){ bool zephyr_transport_close(struct uxrCustomTransport * transport){ zephyr_transport_params_t * params = (zephyr_transport_params_t*) transport->args; - (void) params; return true; } @@ -128,15 +124,15 @@ size_t zephyr_transport_write(struct uxrCustomTransport* transport, const uint8_ zephyr_transport_params_t * params = (zephyr_transport_params_t*) transport->args; size_t wrote; - + wrote = ring_buf_put(&out_ringbuf, buf, len); - + uart_irq_tx_enable(params->uart_dev); while (!ring_buf_is_empty(&out_ringbuf)){ k_sleep(K_MSEC(5)); } - + return wrote; } diff --git a/modules/libmicroros/microros_transports/serial-usb/microros_transports.h b/modules/libmicroros/microros_transports/serial-usb/microros_transports.h index 281ad5b..144b4b4 100644 --- a/modules/libmicroros/microros_transports/serial-usb/microros_transports.h +++ b/modules/libmicroros/microros_transports/serial-usb/microros_transports.h @@ -26,7 +26,7 @@ extern "C" typedef struct { size_t fd; - const struct device *uart_dev; + struct device *uart_dev; } zephyr_transport_params_t; #define MICRO_ROS_FRAMING_REQUIRED true diff --git a/prj.conf b/prj.conf index ccb67ed..7da89e5 100644 --- a/prj.conf +++ b/prj.conf @@ -9,10 +9,12 @@ CONFIG_NEWLIB_LIBC_NANO=n CONFIG_PTHREAD_IPC=n CONFIG_POSIX_API=y +CONFIG_NATIVE_POSIX_TIMER=y CONFIG_APP_LINK_WITH_POSIX_SUBSYS=y CONFIG_POSIX_CLOCK=y CONFIG_STDOUT_CONSOLE=y +CONFIG_USB=y CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="Zephyr micro-ROS" CONFIG_LOG=y diff --git a/src/main.c b/src/main.c index 0b684c7..1a335df 100644 --- a/src/main.c +++ b/src/main.c @@ -43,8 +43,12 @@ void main(void) rcl_allocator_t allocator = rcl_get_default_allocator(); rclc_support_t support; + rcl_init_options_t init_options = rcl_get_zero_initialized_init_options(); + RCCHECK(rcl_init_options_init(&init_options, allocator)); + rmw_init_options_t* rmw_options = rcl_init_options_get_rmw_init_options(&init_options); + // create init_options - RCCHECK(rclc_support_init(&support, 0, NULL, &allocator)); + RCCHECK(rclc_support_init_with_options(&support, 0, NULL, &init_options, &allocator)); // create node rcl_node_t node; From d4a8906258e884702b9c6d6a78ab9d684253a653 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 10:37:36 +0200 Subject: [PATCH 3/9] Initial Signed-off-by: Pablo Garrido --- .github/workflows/ci.yml | 58 ++++++++++++++-- .github/workflows/nightly.yml | 69 +++++++++++++++++-- README.md | 2 +- .../serial-usb/microros_transports.c | 18 +++-- .../serial-usb/microros_transports.h | 2 +- src/main.c | 6 +- 6 files changed, 132 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0243c6..966d403 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,17 +13,17 @@ jobs: strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v2.4.0", "zephyr-v2.5.0", "zephyr-v2.6.0"] + zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0", "zephyr-v2.7.2"] include: - - zephyr_version: zephyr-v2.4.0 - zephyr_sdk: 0.11.4 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.5.0 zephyr_sdk: 0.11.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.6.0 zephyr_sdk: 0.12.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run + - zephyr_version: zephyr-v2.7.2 + zephyr_sdk: 0.13.1 + sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-linux-x86_64-setup.run steps: - uses: actions/checkout@v2 with: @@ -62,5 +62,55 @@ jobs: pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true pip3 install --upgrade Sphinx + + micro_ros_zephyr_module_v3: + runs-on: ubuntu-latest + container: ubuntu:22.04 + strategy: + fail-fast: false + matrix: + zephyr_version: ["zephyr-v3.1.0"] + include: + - zephyr_version: zephyr-v3.1.0 + zephyr_sdk: 0.14.2 + sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION\_linux-x86_64_minimal.tar.gz + steps: + - uses: actions/checkout@v2 + with: + path: micro_ros_zephyr_module + + - name: Dependencies + shell: bash + run: | + 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 + pip3 install --user -U west + export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" + west init zephyrproject + cd zephyrproject + 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 + # Installing micro-ROS prerequisites + pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Building the app west build -b disco_l475_iot1 micro_ros_zephyr_module diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5fbade0..d0bdd87 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,22 +16,24 @@ jobs: strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v2.4.0", "zephyr-v2.5.0", "zephyr-v2.6.0"] - distro: ["foxy", "rolling"] + zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0", "zephyr-v2.7.2"] + distro: ["foxy", "humble", "rolling"] include: - distro: foxy branch: foxy - distro: rolling branch: main - - zephyr_version: zephyr-v2.4.0 - zephyr_sdk: 0.11.4 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run + - distro: humble + branch: humble - zephyr_version: zephyr-v2.5.0 zephyr_sdk: 0.11.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - zephyr_version: zephyr-v2.6.0 zephyr_sdk: 0.12.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run + - zephyr_version: zephyr-v2.7.2 + zephyr_sdk: 0.13.1 + sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-linux-x86_64-setup.run steps: - uses: actions/checkout@v2 with: @@ -70,5 +72,62 @@ jobs: pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true pip3 install --upgrade Sphinx + + micro_ros_zephyr_module_v3: + runs-on: ubuntu-latest + container: ubuntu:22.04 + strategy: + fail-fast: false + matrix: + zephyr_version: ["zephyr-v3.1.0"] + distro: ["foxy", "humble", "rolling"] + include: + - distro: foxy + branch: foxy + - distro: rolling + branch: main + - distro: humble + branch: humble + - zephyr_version: zephyr-v3.1.0 + zephyr_sdk: 0.14.2 + sdk_filename: zephyr-sdk-$TOOLCHAIN_VERSION_linux-x86_64_minimal.tar.gz + steps: + - uses: actions/checkout@v2 + with: + path: micro_ros_zephyr_module + + - name: Dependencies + shell: bash + run: | + 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 + pip3 install --user -U west + export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" + west init zephyrproject + cd zephyrproject + 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 + # Installing micro-ROS prerequisites + pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Building the app west build -b disco_l475_iot1 micro_ros_zephyr_module diff --git a/README.md b/README.md index 19f4e28..7e80b92 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.4.0 (SDK 0.11.4), v2.5.0 (SDK 0.11.4) and v2.6.0 (SDK 0.12.4). +This module has been tested in Zephyr RTOS v2.5.0 (SDK 0.11.4), v2.6.0 (SDK 0.12.4), v2.7.0 (SDK 0.13.1) and v3.1.0 (SDK 0.14.2). ## Dependencies diff --git a/modules/libmicroros/microros_transports/serial-usb/microros_transports.c b/modules/libmicroros/microros_transports/serial-usb/microros_transports.c index 637064b..3e9221a 100644 --- a/modules/libmicroros/microros_transports/serial-usb/microros_transports.c +++ b/modules/libmicroros/microros_transports/serial-usb/microros_transports.c @@ -22,7 +22,7 @@ char uart_out_buffer[RING_BUF_SIZE]; struct ring_buf out_ringbuf, in_ringbuf; -static void uart_fifo_callback(struct device *dev){ +static void uart_fifo_callback(const struct device *dev, void * user_data){ while (uart_irq_update(dev) && uart_irq_is_pending(dev)) { if (uart_irq_rx_ready(dev)) { int recv_len; @@ -36,7 +36,7 @@ static void uart_fifo_callback(struct device *dev){ } - if (uart_irq_tx_ready(dev)) { + if (uart_irq_tx_ready(dev)) { char buffer[64]; int rb_len; @@ -58,12 +58,15 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){ int ret; uint32_t baudrate, dtr = 0U; - params->uart_dev = device_get_binding("CDC_ACM_0"); + + // params->uart_dev = device_get_binding("CDC_ACM_0"); + params->uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart); + printk("uart_dev: %p\n", params->uart_dev); if (!params->uart_dev) { printk("CDC ACM device not found\n"); return false; } - + printk("CDC ACM device found: ready: %d\n", device_is_ready(params->uart_dev)); ret = usb_enable(NULL); if (ret != 0) { printk("Failed to enable USB\n"); @@ -116,6 +119,7 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){ bool zephyr_transport_close(struct uxrCustomTransport * transport){ zephyr_transport_params_t * params = (zephyr_transport_params_t*) transport->args; + (void) params; return true; } @@ -124,15 +128,15 @@ size_t zephyr_transport_write(struct uxrCustomTransport* transport, const uint8_ zephyr_transport_params_t * params = (zephyr_transport_params_t*) transport->args; size_t wrote; - + wrote = ring_buf_put(&out_ringbuf, buf, len); - + uart_irq_tx_enable(params->uart_dev); while (!ring_buf_is_empty(&out_ringbuf)){ k_sleep(K_MSEC(5)); } - + return wrote; } diff --git a/modules/libmicroros/microros_transports/serial-usb/microros_transports.h b/modules/libmicroros/microros_transports/serial-usb/microros_transports.h index 144b4b4..281ad5b 100644 --- a/modules/libmicroros/microros_transports/serial-usb/microros_transports.h +++ b/modules/libmicroros/microros_transports/serial-usb/microros_transports.h @@ -26,7 +26,7 @@ extern "C" typedef struct { size_t fd; - struct device *uart_dev; + const struct device *uart_dev; } zephyr_transport_params_t; #define MICRO_ROS_FRAMING_REQUIRED true diff --git a/src/main.c b/src/main.c index 1a335df..0b684c7 100644 --- a/src/main.c +++ b/src/main.c @@ -43,12 +43,8 @@ void main(void) rcl_allocator_t allocator = rcl_get_default_allocator(); rclc_support_t support; - rcl_init_options_t init_options = rcl_get_zero_initialized_init_options(); - RCCHECK(rcl_init_options_init(&init_options, allocator)); - rmw_init_options_t* rmw_options = rcl_init_options_get_rmw_init_options(&init_options); - // create init_options - RCCHECK(rclc_support_init_with_options(&support, 0, NULL, &init_options, &allocator)); + RCCHECK(rclc_support_init(&support, 0, NULL, &allocator)); // create node rcl_node_t node; From e26f2b8183abf227614ea5bc7715a0c07697729e Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 10:45:36 +0200 Subject: [PATCH 4/9] Update Signed-off-by: Pablo Garrido --- .github/workflows/ci.yml | 3 ++- .github/workflows/nightly.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 966d403..363e315 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: run: | apt update export DEBIAN_FRONTEND=noninteractive - apt install -y --no-install-recommends git cmake ninja-build gperf \ + apt install -y --no-install-recommends wget git cmake ninja-build gperf \ ccache dfu-util device-tree-compiler wget curl gnupg2 \ python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ make gcc gcc-multilib g++-multilib libsdl2-dev @@ -62,6 +62,7 @@ jobs: pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true pip3 install --upgrade Sphinx + west build -b disco_l475_iot1 micro_ros_zephyr_module micro_ros_zephyr_module_v3: runs-on: ubuntu-latest diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d0bdd87..4546629 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -44,7 +44,7 @@ jobs: run: | apt update export DEBIAN_FRONTEND=noninteractive - apt install -y --no-install-recommends git cmake ninja-build gperf \ + apt install -y --no-install-recommends wget git cmake ninja-build gperf \ ccache dfu-util device-tree-compiler wget curl gnupg2 \ python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ make gcc gcc-multilib g++-multilib libsdl2-dev @@ -72,6 +72,7 @@ jobs: pip3 install catkin_pkg lark-parser empy colcon-common-extensions # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true pip3 install --upgrade Sphinx + west build -b disco_l475_iot1 micro_ros_zephyr_module micro_ros_zephyr_module_v3: runs-on: ubuntu-latest From c4ad35e3ce3eec47d695a5c8fcac04d08388e64d Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 10:55:20 +0200 Subject: [PATCH 5/9] Update Signed-off-by: Pablo Garrido --- .github/workflows/ci.yml | 2 +- .github/workflows/nightly.yml | 2 +- prj.conf | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 363e315..7ba995e 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:20.04 + container: ubuntu:22.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4546629..28e0d73 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,7 +12,7 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:20.04 + container: ubuntu:22.04 strategy: fail-fast: false matrix: diff --git a/prj.conf b/prj.conf index 7da89e5..ccb67ed 100644 --- a/prj.conf +++ b/prj.conf @@ -9,12 +9,10 @@ CONFIG_NEWLIB_LIBC_NANO=n CONFIG_PTHREAD_IPC=n CONFIG_POSIX_API=y -CONFIG_NATIVE_POSIX_TIMER=y CONFIG_APP_LINK_WITH_POSIX_SUBSYS=y CONFIG_POSIX_CLOCK=y CONFIG_STDOUT_CONSOLE=y -CONFIG_USB=y CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="Zephyr micro-ROS" CONFIG_LOG=y From 6ac3764f8bf3285afda21f99d68ad8f64e51bec9 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 11:04:42 +0200 Subject: [PATCH 6/9] Fix Signed-off-by: Pablo Garrido --- .github/workflows/ci.yml | 2 +- .github/workflows/nightly.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ba995e..363e315 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:22.04 + container: ubuntu:20.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 28e0d73..4546629 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,7 +12,7 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: ubuntu:22.04 + container: ubuntu:20.04 strategy: fail-fast: false matrix: From a0469619573b0c572978f2268238dd8ca7bdcbbb Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 11:13:39 +0200 Subject: [PATCH 7/9] Move 2.7.2 to new ci Signed-off-by: Pablo Garrido --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/nightly.yml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 363e315..d2351a3 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0", "zephyr-v2.7.2"] + zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0"] include: - zephyr_version: zephyr-v2.5.0 zephyr_sdk: 0.11.4 @@ -21,9 +21,6 @@ jobs: - zephyr_version: zephyr-v2.6.0 zephyr_sdk: 0.12.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run - - zephyr_version: zephyr-v2.7.2 - zephyr_sdk: 0.13.1 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-linux-x86_64-setup.run steps: - uses: actions/checkout@v2 with: @@ -70,8 +67,11 @@ jobs: strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v3.1.0"] + 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 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4546629..13fc150 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0", "zephyr-v2.7.2"] + zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0"] distro: ["foxy", "humble", "rolling"] include: - distro: foxy @@ -31,9 +31,6 @@ jobs: - zephyr_version: zephyr-v2.6.0 zephyr_sdk: 0.12.4 sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run - - zephyr_version: zephyr-v2.7.2 - zephyr_sdk: 0.13.1 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-linux-x86_64-setup.run steps: - uses: actions/checkout@v2 with: @@ -80,7 +77,7 @@ jobs: strategy: fail-fast: false matrix: - zephyr_version: ["zephyr-v3.1.0"] + zephyr_version: ["zephyr-v3.1.0", "zephyr-v2.7.2"] distro: ["foxy", "humble", "rolling"] include: - distro: foxy @@ -89,6 +86,9 @@ jobs: branch: main - distro: humble branch: humble + - 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 From 57000a2212ac4421f84003300fa8b396448965a4 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 11:25:47 +0200 Subject: [PATCH 8/9] Deprecate --- .github/workflows/ci.yml | 54 ---------------- .github/workflows/nightly.yml | 61 ------------------- .../serial-usb/microros_transports.c | 6 +- 3 files changed, 2 insertions(+), 119 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2351a3..6778994 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,60 +8,6 @@ on: jobs: micro_ros_zephyr_module: - runs-on: ubuntu-latest - container: ubuntu:20.04 - strategy: - fail-fast: false - matrix: - zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0"] - include: - - zephyr_version: zephyr-v2.5.0 - zephyr_sdk: 0.11.4 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - - zephyr_version: zephyr-v2.6.0 - zephyr_sdk: 0.12.4 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run - steps: - - uses: actions/checkout@v2 - with: - path: micro_ros_zephyr_module - - - name: Dependencies - shell: bash - run: | - 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 curl gnupg2 \ - python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ - make gcc gcc-multilib g++-multilib libsdl2-dev - pip3 install --user -U west - export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" - west init zephyrproject - cd zephyrproject - 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 - chmod +x $TOOLCHAIN_FILE_NAME - yes | ./$TOOLCHAIN_FILE_NAME -- -rc -y -d $(pwd)/zephyr-sdk || : - rm -rf $TOOLCHAIN_FILE_NAME - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - export ZEPHYR_SDK_INSTALL_DIR=$(pwd)/zephyr-sdk - source zephyrproject/zephyr/zephyr-env.sh - # Installing micro-ROS prerequisites - pip3 install catkin_pkg lark-parser empy colcon-common-extensions - # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true - pip3 install --upgrade Sphinx - west build -b disco_l475_iot1 micro_ros_zephyr_module - - micro_ros_zephyr_module_v3: runs-on: ubuntu-latest container: ubuntu:22.04 strategy: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 13fc150..e4bde46 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -11,67 +11,6 @@ on: jobs: micro_ros_zephyr_module: - runs-on: ubuntu-latest - container: ubuntu:20.04 - strategy: - fail-fast: false - matrix: - zephyr_version: ["zephyr-v2.5.0", "zephyr-v2.6.0"] - distro: ["foxy", "humble", "rolling"] - include: - - distro: foxy - branch: foxy - - distro: rolling - branch: main - - distro: humble - branch: humble - - zephyr_version: zephyr-v2.5.0 - zephyr_sdk: 0.11.4 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-setup.run - - zephyr_version: zephyr-v2.6.0 - zephyr_sdk: 0.12.4 - sdk_filename: zephyr-toolchain-arm-$TOOLCHAIN_VERSION-x86_64-linux-setup.run - steps: - - uses: actions/checkout@v2 - with: - path: micro_ros_zephyr_module - ref: ${{ matrix.branch }} - - name: Dependencies - shell: bash - run: | - 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 curl gnupg2 \ - python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ - make gcc gcc-multilib g++-multilib libsdl2-dev - pip3 install --user -U west - export PATH=~/.local/bin:/github/home/.local/bin:"$PATH" - west init zephyrproject - cd zephyrproject - 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 - chmod +x $TOOLCHAIN_FILE_NAME - yes | ./$TOOLCHAIN_FILE_NAME -- -rc -y -d $(pwd)/zephyr-sdk || : - rm -rf $TOOLCHAIN_FILE_NAME - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - export ZEPHYR_SDK_INSTALL_DIR=$(pwd)/zephyr-sdk - source zephyrproject/zephyr/zephyr-env.sh - # Installing micro-ROS prerequisites - pip3 install catkin_pkg lark-parser empy colcon-common-extensions - # Workaround. Remove when https://github.com/sphinx-doc/sphinx/issues/10291 and https://github.com/micro-ROS/micro_ros_zephyr_module/runs/5714546662?check_suite_focus=true - pip3 install --upgrade Sphinx - west build -b disco_l475_iot1 micro_ros_zephyr_module - - micro_ros_zephyr_module_v3: runs-on: ubuntu-latest container: ubuntu:22.04 strategy: diff --git a/modules/libmicroros/microros_transports/serial-usb/microros_transports.c b/modules/libmicroros/microros_transports/serial-usb/microros_transports.c index 3e9221a..2b03461 100644 --- a/modules/libmicroros/microros_transports/serial-usb/microros_transports.c +++ b/modules/libmicroros/microros_transports/serial-usb/microros_transports.c @@ -59,14 +59,12 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){ uint32_t baudrate, dtr = 0U; - // params->uart_dev = device_get_binding("CDC_ACM_0"); - params->uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart); - printk("uart_dev: %p\n", params->uart_dev); + params->uart_dev = device_get_binding("CDC_ACM_0"); if (!params->uart_dev) { printk("CDC ACM device not found\n"); return false; } - printk("CDC ACM device found: ready: %d\n", device_is_ready(params->uart_dev)); + ret = usb_enable(NULL); if (ret != 0) { printk("Failed to enable USB\n"); From b8fb233fa3acc2250cd3459897feaa4df3e943ff Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Tue, 9 Aug 2022 11:26:41 +0200 Subject: [PATCH 9/9] Readme Signed-off-by: Pablo Garrido --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e80b92..a3a59e8 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.5.0 (SDK 0.11.4), v2.6.0 (SDK 0.12.4), v2.7.0 (SDK 0.13.1) and v3.1.0 (SDK 0.14.2). +This module has been tested in Zephyr RTOS v2.7.0 (SDK 0.14.2) and v3.1.0 (SDK 0.14.2). ## Dependencies