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

Added precompiled library for STMicroelectronics Nucleo H723ZG (USB), Nucleo H503RB (USB), Arduino Giga R1 (ETH UDP), and Portenta C33(USB) #1853

Open
wants to merge 18 commits into
base: jazzy
Choose a base branch
from
Open
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
30 changes: 21 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,26 @@ jobs:
- https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json
- https://github.com/espressif/arduino-esp32/releases/download/2.0.2/package_esp32_index.json
- https://www.pjrc.com/teensy/package_teensy_index.json
- https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json''' > arduino-cli.yaml
- https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
- https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json''' > arduino-cli.yaml
curl -fsSL https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json -o /github/home/.arduino15/package_opencr_index.json
curl -fsSL https://github.com/espressif/arduino-esp32/releases/download/2.0.2/package_esp32_index.json -o /github/home/.arduino15/package_esp32_index.json
curl -fsSL https://www.pjrc.com/teensy/package_teensy_index.json -o /github/home/.arduino15/package_teensy_index.json
curl -fsSL https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json -o /github/home/.arduino15/package_seeeduino_boards_index.json
curl -fsSL https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json -o /github/home/.arduino15/package_stmicroelectronics_index.json

export PATH=$PATH:/github/workspace/bin:/__w/micro_ros_arduino/micro_ros_arduino/bin
arduino-cli core install OpenCR:OpenCR -v
arduino-cli core install arduino:samd -v
arduino-cli core install arduino:sam -v
arduino-cli core install arduino:mbed -v
arduino-cli core install arduino:mbed_portenta -v
arduino-cli core install arduino:mbed_giga -v
arduino-cli core install arduino:mbed_nano -v
arduino-cli core install arduino:renesas_portenta -v
arduino-cli core install esp32:esp32 -v
arduino-cli core install teensy:[email protected] -v
arduino-cli core install Seeeduino:samd -v
arduino-cli core install STMicroelectronics:stm32 -v
#
# PATCHING TEENSY AND SAM
cat checkout/extras/patching_boards/platform_teensy.txt > /github/home/.arduino15/packages/teensy/hardware/avr/1.59.0/platform.txt
Expand All @@ -52,6 +59,7 @@ jobs:
arduino-cli core update-index
arduino-cli lib update-index
arduino-cli lib install WiFiNINA
arduino-cli lib install Ethernet
arduino-cli lib install "STM32duino X-NUCLEO-IKS01A3"
arduino-cli lib install "Seeed Arduino rpcWiFi" # Dependent libraries(e.g. "Seeed Arduino rpcUnified") will be installed together. See https://wiki.seeedstudio.com/Wio-Terminal-Network-Overview/#needed-libraries-for-wi-fi for more details.
# Build all demos
Expand All @@ -64,20 +72,24 @@ jobs:
arduino-cli compile --fqbn teensy:avr:teensy41 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_time_sync -v
arduino-cli compile --fqbn teensy:avr:teensy41 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_types_handling -v
# Build one demo for each platform
arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_decibels -v
arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_IMU_ML -v
arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
arduino-cli compile --fqbn arduino:mbed_nano:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:mbed_nano:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_decibels -v
arduino-cli compile --fqbn arduino:mbed_nano:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_IMU_ML -v
arduino-cli compile --fqbn arduino:mbed_nano:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
ZhouyangX marked this conversation as resolved.
Show resolved Hide resolved
arduino-cli compile --fqbn teensy:avr:teensy31 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn teensy:avr:teensy35 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn teensy:avr:teensy36 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn teensy:avr:teensy41 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn teensy:avr:teensy40 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:samd:arduino_zero_native /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:sam:arduino_due_x /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
# arduino-cli compile --fqbn arduino:mbed:envie_m4 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:mbed:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:mbed:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
# arduino-cli compile --fqbn arduino:mbed_portenta:envie_m4 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:mbed_portenta:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
# arduino-cli compile --fqbn arduino:mbed_portenta:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
arduino-cli compile --fqbn arduino:mbed_giga:giga /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn esp32:esp32:esp32 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn esp32:esp32:esp32 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
arduino-cli compile --fqbn Seeeduino:samd:seeed_wio_terminal /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_144:pnum=NUCLEO_H723ZG /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_H503RB /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
arduino-cli compile --fqbn arduino:renesas_portenta:portenta_c33 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <rclc/executor.h>
#include <std_msgs/msg/int32.h>

#if !defined(TARGET_STM32F4) && !defined(ARDUINO_TEENSY41) && !defined(TARGET_PORTENTA_H7_M7)
#if !defined(TARGET_STM32F4) && !defined(ARDUINO_TEENSY41) && !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_ARCH_MBED_GIGA)

#error This example is only available for Arduino Portenta, Arduino Teensy41 and STM32F4
#endif

Expand Down Expand Up @@ -74,4 +75,4 @@ void loop() {
RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
msg.data++;
delay(100);
}
}
49 changes: 49 additions & 0 deletions extras/library_generation/library_generation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ if [ $OPTIND -eq 1 ]; then
PLATFORMS+=("portenta-m7")
PLATFORMS+=("kakutef7-m7")
PLATFORMS+=("esp32")
PLATFORMS+=("stm32-m7")
PLATFORMS+=("stm32-m33")
PLATFORMS+=("portenta-c33")


fi

shift $((OPTIND-1))
Expand Down Expand Up @@ -244,6 +249,50 @@ if [[ " ${PLATFORMS[@]} " =~ " esp32s3 " ]]; then
cp -R firmware/build/libmicroros.a /project/src/esp32s3/libmicroros.a
fi

######## Build for STM32 Cortex M7 core (H723ZG) ########
if [[ " ${PLATFORMS[@]} " =~ " stm32-m7 " ]]; then
rm -rf firmware/build

export TOOLCHAIN_PREFIX=/uros_ws/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-
ros2 run micro_ros_setup build_firmware.sh /project/extras/library_generation/stm32-m7_toolchain.cmake /project/extras/library_generation/colcon.meta

find firmware/build/include/ -name "*.c" -delete
cp -R firmware/build/include/* /project/src/

mkdir -p /project/src/cortex-m7/fpv4-sp-d16-hard
cp -R firmware/build/libmicroros.a /project/src/cortex-m7/fpv4-sp-d16-hard/libmicroros.a
fi

######## Build for STM32 Cortex M33 core (H503RB) ########

if [[ " ${PLATFORMS[@]} " =~ " stm32-m33 " ]]; then
rm -rf firmware/build

export TOOLCHAIN_PREFIX=/uros_ws/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-
ros2 run micro_ros_setup build_firmware.sh /project/extras/library_generation/stm32-m33_toolchain.cmake /project/extras/library_generation/colcon_lowmem.meta

find firmware/build/include/ -name "*.c" -delete
cp -R firmware/build/include/* /project/src/

mkdir -p /project/src/cortex-m33/fpv4-sp-d16-hard
cp -R firmware/build/libmicroros.a /project/src/cortex-m33/fpv4-sp-d16-hard/libmicroros.a
fi

######## Build for Arduino Cortex M33 core (Portenta C33) ########

if [[ " ${PLATFORMS[@]} " =~ " portenta-c33 " ]]; then
rm -rf firmware/build

export TOOLCHAIN_PREFIX=/uros_ws/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-
ros2 run micro_ros_setup build_firmware.sh /project/extras/library_generation/portenta-c33_toolchain.cmake /project/extras/library_generation/colcon_lowmem.meta

find firmware/build/include/ -name "*.c" -delete
cp -R firmware/build/include/* /project/src/

mkdir -p /project/src/cortex-m33/fpv5-sp-d16-hard
cp -R firmware/build/libmicroros.a /project/src/cortex-m33/fpv5-sp-d16-hard/libmicroros.a
fi

######## Fix include paths ########
pushd firmware/mcu_ws > /dev/null
INCLUDE_ROS2_PACKAGES=$(colcon list | awk '{print $1}' | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')
Expand Down
16 changes: 16 additions & 0 deletions extras/library_generation/portenta-c33_toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SET(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

set(CMAKE_C_COMPILER $ENV{TOOLCHAIN_PREFIX}gcc)
set(CMAKE_CXX_COMPILER $ENV{TOOLCHAIN_PREFIX}g++)

SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")

set(FLAGS "-O3 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -fsingle-precision-constant -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -mcpu=cortex-m33 --param max-inline-insns-single=500 -DARDUINO=10813 -mthumb" CACHE STRING "" FORCE)

set(CMAKE_C_FLAGS_INIT "-std=c11 ${FLAGS} -DCLOCK_MONOTONIC=0 -D'__attribute__(x)='" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_INIT "-std=c++14 ${FLAGS} -fno-rtti -DCLOCK_MONOTONIC=0 -D'__attribute__(x)='" CACHE STRING "" FORCE)

set(__BIG_ENDIAN__ 0)
16 changes: 16 additions & 0 deletions extras/library_generation/stm32-m33_toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SET(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

set(CMAKE_C_COMPILER $ENV{TOOLCHAIN_PREFIX}gcc)
set(CMAKE_CXX_COMPILER $ENV{TOOLCHAIN_PREFIX}g++)

SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")

set(FLAGS "-O3 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -mcpu=cortex-m33 --param max-inline-insns-single=500 -DF_CPU=250000000L -DARDUINO=10813 -mthumb" CACHE STRING "" FORCE)

set(CMAKE_C_FLAGS_INIT "-std=c11 ${FLAGS} -DCLOCK_MONOTONIC=0 -D'__attribute__(x)='" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_INIT "-std=c++14 ${FLAGS} -fno-rtti -DCLOCK_MONOTONIC=0 -D'__attribute__(x)='" CACHE STRING "" FORCE)

set(__BIG_ENDIAN__ 0)
16 changes: 16 additions & 0 deletions extras/library_generation/stm32-m7_toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SET(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

set(CMAKE_C_COMPILER $ENV{TOOLCHAIN_PREFIX}gcc)
set(CMAKE_CXX_COMPILER $ENV{TOOLCHAIN_PREFIX}g++)

SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")

set(FLAGS "-O3 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -fno-exceptions -mcpu=cortex-m7 --param max-inline-insns-single=500 -DF_CPU=550000000L -DARDUINO=10813 -mthumb" CACHE STRING "" FORCE)

set(CMAKE_C_FLAGS_INIT "-std=c11 ${FLAGS} -DCLOCK_MONOTONIC=0 -D'__attribute__(x)='" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_INIT "-std=c++14 ${FLAGS} -fno-rtti -DCLOCK_MONOTONIC=0 -D'__attribute__(x)='" CACHE STRING "" FORCE)

set(__BIG_ENDIAN__ 0)
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ paragraph=micro-ROS Arduino library
url=https://github.com/micro-ROS/micro_ros_arduino
precompiled=true
category=Other
architectures=stm32,OpenCR,Teensyduino,samd,sam,mbed,esp32,mbed_portenta
architectures=stm32,OpenCR,Teensyduino,samd,sam,mbed,esp32,mbed_portenta,mbed_giga
Binary file added src/cortex-m33/fpv4-sp-d16-hard/libmicroros.a
Binary file not shown.
Binary file added src/cortex-m33/fpv5-sp-d16-hard/libmicroros.a
Binary file not shown.
Binary file added src/cortex-m7/fpv4-sp-d16-hard/libmicroros.a
Binary file not shown.
2 changes: 1 addition & 1 deletion src/default_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extern "C"
{
#include <stdio.h>
#include <stdbool.h>
#include <sys/time.h>
#include <time.h>

int clock_gettime(clockid_t unused, struct timespec *tp) __attribute__ ((weak));
bool arduino_transport_open(struct uxrCustomTransport * transport) __attribute__ ((weak));
Expand Down
12 changes: 11 additions & 1 deletion src/micro_ros_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,17 @@ static inline void set_microros_transports(){
#include <PortentaEthernet.h>
#endif

#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7)
#if defined(ARDUINO_ARCH_MBED_GIGA)
#include <Arduino.h>
#include <EthernetUdp.h>
#include <Ethernet.h>

#include <uxr/client/transport.h>
#include <rmw_microros/rmw_microros.h>
#include "IPAddress.h"
#endif

#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_ARCH_MBED_GIGA)
extern "C" bool arduino_native_ethernet_udp_transport_open(struct uxrCustomTransport * transport);
extern "C" bool arduino_native_ethernet_udp_transport_close(struct uxrCustomTransport * transport);
extern "C" size_t arduino_native_ethernet_udp_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err);
Expand Down
10 changes: 9 additions & 1 deletion src/native_ethernet_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@
#include <micro_ros_arduino.h>
#endif

#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7)
#if defined(ARDUINO_ARCH_MBED_GIGA)
#include <Arduino.h>
#include <EthernetUdp.h>
#include <Ethernet.h>
#include <micro_ros_arduino.h>

#endif

#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7)|| defined(ARDUINO_ARCH_MBED_GIGA)
extern "C" {

#include <stdbool.h>
Expand Down