diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 295d5108..d201cc59 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,5 @@ * @pablogs9 @jamoralp @FranFin config/freertos/nucleo_f446ze/ @alsaibie config/freertos/esp32/ @donRaphaco -config/freertos/nucleo_f746zg/ @edesta-be \ No newline at end of file +config/freertos/nucleo_f746zg/ @edesta-be +config/freertos/nucleo_f767zi/ @jnugen \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0b572c1..84d26aef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,6 +119,12 @@ jobs: configuration: int32_publisher transport_arguments: -t serial -d 1 binary: 'firmware/freertos_apps/microros_nucleo_f746zg_extensions/build/micro-ROS.elf' + + - rtos: freertos + platform: nucleo_f767zi + configuration: int32_publisher + transport_arguments: -t serial -d 1 + binary: 'firmware/freertos_apps/microros_nucleo_f767zi_extensions/build/micro-ROS.elf' - rtos: freertos platform: esp32 diff --git a/README.md b/README.md index 2c1fb026..999a770b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ This package is the **official build system for micro-ROS**. It provides tools a | [FreeRTOS](https://www.freertos.org/) | [Olimex STM32-E407](https://www.olimex.com/Products/ARM/ST/STM32-E407/open-source-hardware) | STM32CubeMX latest | `freertos olimex-stm32-e407` | | [FreeRTOS](https://www.freertos.org/) | [ST Nucleo F446ZE](https://www.st.com/en/evaluation-tools/nucleo-f446ze.html) 1 | STM32CubeMX latest | `freertos nucleo_f446ze` | | [FreeRTOS](https://www.freertos.org/) | [ST Nucleo F746ZG](https://www.st.com/en/evaluation-tools/nucleo-f746zg.html) 1 | STM32CubeMX latest | `freertos nucleo_f746zg` | +| [FreeRTOS](https://www.freertos.org/) | [ST Nucleo F767ZI](https://www.st.com/en/evaluation-tools/nucleo-f746zg.html) 1 | STM32CubeMX latest | `freertos nucleo_f767zi` | | [FreeRTOS](https://www.freertos.org/) | [Espressif ESP32](https://www.espressif.com/en/products/socs/esp32/overview) | v8.2.0 | `freertos esp32` | | [Zephyr](https://www.zephyrproject.org/) | [Olimex STM32-E407](https://www.olimex.com/Products/ARM/ST/STM32-E407/open-source-hardware) | v2.4.99 | `zephyr olimex-stm32-e407` | | [Zephyr](https://www.zephyrproject.org/) | [ST B-L475E-IOT01A](https://docs.zephyrproject.org/latest/boards/arm/disco_l475_iot1/doc/index.html) | v2.4.99 | `zephyr discovery_l475_iot1` | @@ -134,6 +135,7 @@ In summary, the supported configurations for transports are: | ST Nucleo F446ZE 1 | - | UART | - | | ST Nucleo H743ZI 1 | - | - | UART | | ST Nucleo F746ZG 1 | - | UART | UART | +| ST Nucleo F767ZI 1 | - | UART | - | *1 Community supported, may have lack of official support* diff --git a/config/freertos/nucleo_f767zi/board.repos b/config/freertos/nucleo_f767zi/board.repos new file mode 100644 index 00000000..236c369d --- /dev/null +++ b/config/freertos/nucleo_f767zi/board.repos @@ -0,0 +1,5 @@ +repositories: + freertos_apps: + type: git + url: https://github.com/micro-ros/freertos_apps + version: foxy diff --git a/config/freertos/nucleo_f767zi/build.sh b/config/freertos/nucleo_f767zi/build.sh new file mode 100644 index 00000000..95ba4b95 --- /dev/null +++ b/config/freertos/nucleo_f767zi/build.sh @@ -0,0 +1,36 @@ +EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_nucleo_f767zi_extensions + +. $PREFIX/config/utils.sh + +pushd $EXTENSIONS_DIR >/dev/null + + export UROS_APP=$(head -n1 $FW_TARGETDIR/APP | tail -n1) + + if [ -v UROS_CUSTOM_APP_FOLDER ]; then + export UROS_APP_FOLDER="$UROS_CUSTOM_APP_FOLDER/$UROS_APP" + else + export UROS_APP_FOLDER="$FW_TARGETDIR/freertos_apps/apps/$UROS_APP" + fi + + if [ -d "$UROS_APP_FOLDER" ]; then + echo "Selected app: $UROS_APP" + else + echo "App not found: $UROS_APP" + print_available_apps + exit 1 + fi + + if [ "$UROS_FAST_BUILD" = "off" ] || [ ! -d "build" ]; then + # Clean micro-ROS build + rm -rf $FW_TARGETDIR/mcu_ws/build $FW_TARGETDIR/mcu_ws/install $FW_TARGETDIR/mcu_ws/log + + # Clean build + make clean + + # Build micro-ROS stack + make libmicroros + fi + + # Build firmware + make -j$(nproc) UROS_APP_FOLDER=$UROS_APP_FOLDER +popd >/dev/null diff --git a/config/freertos/nucleo_f767zi/client-colcon.meta b/config/freertos/nucleo_f767zi/client-colcon.meta new file mode 100644 index 00000000..f38fb07c --- /dev/null +++ b/config/freertos/nucleo_f767zi/client-colcon.meta @@ -0,0 +1,36 @@ +{ + "names": { + "tracetools": { + "cmake-args": [ + "-DTRACETOOLS_DISABLED=ON", + "-DTRACETOOLS_STATUS_CHECKING_TOOL=OFF" + ] + }, + "rcutils": { + "cmake-args": [ + "-DENABLE_TESTING=OFF", + "-DRCUTILS_NO_FILESYSTEM=ON", + "-DRCUTILS_AVOID_DYNAMIC_ALLOCATION=ON" + ] + }, + "microxrcedds_client": { + "cmake-args": [ + "-DUCLIENT_PIC=OFF", + "-DUCLIENT_PROFILE_DISCOVERY=OFF" + ] + }, + "rmw_microxrcedds": { + "cmake-args": [ + "-DRMW_UXRCE_XML_BUFFER_LENGTH=400", + "-DRMW_UXRCE_TRANSPORT=custom_serial", + "-DRMW_UXRCE_DEFAULT_SERIAL_DEVICE=3" + ] + }, + "tracetools": { + "cmake-args": [ + "-DTRACETOOLS_DISABLED=ON", + "-DTRACETOOLS_STATUS_CHECKING_TOOL=OFF" + ] + } + } +} diff --git a/config/freertos/nucleo_f767zi/client_uros_packages.repos b/config/freertos/nucleo_f767zi/client_uros_packages.repos new file mode 100644 index 00000000..2f4e749c --- /dev/null +++ b/config/freertos/nucleo_f767zi/client_uros_packages.repos @@ -0,0 +1,50 @@ +repositories: + eProsima/Micro-CDR: + type: git + url: https://github.com/eProsima/micro-CDR.git + version: foxy + eProsima/Micro-XRCE-DDS-Client: + type: git + url: https://github.com/eProsima/Micro-XRCE-DDS-Client.git + version: foxy + +# MicroROS + + uros/rcl: + type: git + url: https://github.com/micro-ROS/rcl + version: foxy + uros/rclc: + type: git + url: https://github.com/micro-ROS/rclc + version: master + uros/rcutils: + type: git + url: https://github.com/micro-ROS/rcutils + version: foxy + uros/micro_ros_msgs: + type: git + url: https://github.com/micro-ROS/micro_ros_msgs.git + version: foxy + uros/rmw_microxrcedds: + type: git + url: https://github.com/micro-ROS/rmw-microxrcedds.git + version: foxy + uros/rosidl_typesupport: + type: git + url: https://github.com/micro-ROS/rosidl_typesupport.git + version: foxy + uros/rosidl_typesupport_microxrcedds: + type: git + url: https://github.com/micro-ROS/rosidl_typesupport_microxrcedds.git + version: foxy + uros/tracetools: + type: git + url: https://gitlab.com/micro-ROS/ros_tracing/ros2_tracing + version: foxy_microros + +# Remove this when it returns to ros2.repos + ros2/tinydir_vendor: + type: git + url: https://github.com/ros2/tinydir_vendor.git + version: master diff --git a/config/freertos/nucleo_f767zi/configure.sh b/config/freertos/nucleo_f767zi/configure.sh new file mode 100755 index 00000000..1424aea7 --- /dev/null +++ b/config/freertos/nucleo_f767zi/configure.sh @@ -0,0 +1,64 @@ + +EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_nucleo_f767zi_extensions + +. $PREFIX/config/utils.sh + +function help { + echo "Configure script need an argument." + echo " --transport -t udp, serial or serial-usb" + echo " --dev -d agent string descriptor in a serial-like transport" + echo " --ip -i agent IP in a network-like transport" + echo " --port -p agent port in a network-like transport" +} + +echo $CONFIG_NAME > $FW_TARGETDIR/APP + +if [ "$UROS_TRANSPORT" == "udp" ]; then + + update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT="$UROS_TRANSPORT + update_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_IP="$UROS_AGENT_IP + update_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_PORT="$UROS_AGENT_PORT + update_meta "microxrcedds_client" "UCLIENT_PROFILE_SERIAL=OFF" + update_meta "microxrcedds_client" "UCLIENT_PROFILE_UDP=ON" + update_meta "microxrcedds_client" "UCLIENT_PROFILE_TCP=OFF" + + remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_SERIAL_DEVICE" + remove_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL" + remove_meta "microxrcedds_client" "EXTERNAL_TRANSPORT_HEADER_SERIAL" + remove_meta "microxrcedds_client" "EXTERNAL_TRANSPORT_SRC_SERIAL" + + echo "Configured $UROS_TRANSPORT mode with agent at $UROS_AGENT_IP:$UROS_AGENT_PORT" + +elif [ "$UROS_TRANSPORT" == "serial" ]; then + echo "Using serial device USART$UROS_AGENT_DEVICE." + + cp -f $EXTENSIONS_DIR/Src/nucleo_f767zi_serial_transport.c $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/src/c/profile/transport/serial/serial_transport_external.c + cp -f $EXTENSIONS_DIR/Inc/nucleo_f767zi_serial_transport.h $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/serial/serial_transport_external.h + update_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL=ON" + update_meta "microxrcedds_client" "UCLIENT_PROFILE_SERIAL=ON" + update_meta "microxrcedds_client" "UCLIENT_PROFILE_UDP=OFF" + update_meta "microxrcedds_client" "UCLIENT_PROFILE_TCP=OFF" + + update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom_serial" + update_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_SERIAL_DEVICE="$UROS_AGENT_DEVICE + + remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_IP" + remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_PORT" + + echo "Configured $UROS_TRANSPORT mode with agent at USART$UROS_AGENT_DEVICE" + +elif [ "$UROS_TRANSPORT" == "serial-usb" ]; then + echo "Using serial USB device. EXPERIMENTAL." + + cp -f $EXTENSIONS_DIR/Src/nucleo_f767zi_usb_transport.c $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/src/c/profile/transport/serial/serial_transport_external.c + cp -f $EXTENSIONS_DIR/Inc/nucleo_f767zi_usb_transport.h $FW_TARGETDIR/mcu_ws/eProsima/Micro-XRCE-DDS-Client/include/uxr/client/profile/transport/serial/serial_transport_external.h + update_meta "microxrcedds_client" "UCLIENT_EXTERNAL_SERIAL=ON" + update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom_serial" + + remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_IP" + remove_meta "rmw_microxrcedds" "RMW_UXRCE_DEFAULT_UDP_PORT" + + echo "Configured $UROS_TRANSPORT mode with agent" +else + help +fi diff --git a/config/freertos/nucleo_f767zi/create.sh b/config/freertos/nucleo_f767zi/create.sh new file mode 100755 index 00000000..0855aed6 --- /dev/null +++ b/config/freertos/nucleo_f767zi/create.sh @@ -0,0 +1,26 @@ +pushd $FW_TARGETDIR >/dev/null + # Install toolchain + mkdir toolchain + + + # Install toolchain + echo "Downloading ARM compiler, this may take a while" + curl -fsSLO https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 + tar --strip-components=1 -xvjf gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 -C toolchain > /dev/null + rm gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2 + + # Import repos + vcs import --input $PREFIX/config/$RTOS/$PLATFORM/board.repos + + # ignore broken packages + touch mcu_ws/ros2/rcl_logging/rcl_logging_log4cxx/COLCON_IGNORE + touch mcu_ws/ros2/rcl_logging/rcl_logging_spdlog/COLCON_IGNORE + touch mcu_ws/ros2/rcl/COLCON_IGNORE + touch mcu_ws/ros2/rosidl/rosidl_typesupport_introspection_c/COLCON_IGNORE + touch mcu_ws/ros2/rosidl/rosidl_typesupport_introspection_cpp/COLCON_IGNORE + touch mcu_ws/ros2/rcpputils/COLCON_IGNORE + touch mcu_ws/uros/rcl/rcl_yaml_param_parser/COLCON_IGNORE + touch mcu_ws/uros/rclc/rclc_examples/COLCON_IGNORE + + rosdep install -y --from-paths mcu_ws -i mcu_ws --rosdistro foxy --skip-keys="$SKIP" +popd >/dev/null \ No newline at end of file diff --git a/config/freertos/nucleo_f767zi/flash.sh b/config/freertos/nucleo_f767zi/flash.sh new file mode 100755 index 00000000..18731af8 --- /dev/null +++ b/config/freertos/nucleo_f767zi/flash.sh @@ -0,0 +1,24 @@ +OLIMEX_EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_nucleo_f767zi_extensions + +pushd $OLIMEX_EXTENSIONS_DIR > /dev/null + + if [ -f build/micro-ROS.bin ]; then + echo "Flashing firmware for $RTOS platform $PLATFORM" + + if lsusb -d 15BA:002a; then + PROGRAMMER=interface/ftdi/nucleo-arm-usb-tiny-h.cfg + elif lsusb -d 15BA:0003;then + PROGRAMMER=interface/ftdi/nucleo-arm-usb-ocd.cfg + elif lsusb -d 15BA:002b;then + PROGRAMMER=interface/ftdi/nucleo-arm-usb-ocd-h.cfg + else + echo "Error. Unsuported OpenOCD USB programmer" + exit 1 + fi + + openocd -f $PROGRAMMER -f target/stm32f7x.cfg -c init -c "reset halt" -c "flash write_image erase build/micro-ROS.bin 0x08000000" -c "reset" -c "exit" + else + echo "build/micro-ROS.bin not found: please compile before flashing." + fi + +popd > /dev/null diff --git a/config/freertos/nucleo_f767zi/package.xml b/config/freertos/nucleo_f767zi/package.xml new file mode 100644 index 00000000..aa7517ba --- /dev/null +++ b/config/freertos/nucleo_f767zi/package.xml @@ -0,0 +1,12 @@ + + + + firmware + 0.0.0 + Micro-ROS dependecies for FreeRTOS and STM32F767ZI Nucleo Board + James Nugen + APL2 + + openocd + +