Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move support to v2.7.x and v3.1.0 #64

Merged
merged 9 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@ 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-v3.1.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.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
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -34,8 +31,8 @@ jobs:
run: |
apt update
export DEBIAN_FRONTEND=noninteractive
apt install -y --no-install-recommends git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget curl gnupg2 \
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
Expand All @@ -52,15 +49,15 @@ jobs:
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
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
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
41 changes: 20 additions & 21 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,37 @@ 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-v3.1.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
- 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
- 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
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 git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget curl gnupg2 \
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
Expand All @@ -60,15 +59,15 @@ jobs:
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
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
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.7.0 (SDK 0.14.2) and v3.1.0 (SDK 0.14.2).

## Dependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -58,6 +58,7 @@ bool zephyr_transport_open(struct uxrCustomTransport * transport){
int ret;
uint32_t baudrate, dtr = 0U;


params->uart_dev = device_get_binding("CDC_ACM_0");
if (!params->uart_dev) {
printk("CDC ACM device not found\n");
Expand Down Expand Up @@ -116,6 +117,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;
}
Expand All @@ -124,15 +126,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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down