Skip to content

Commit f9a06b1

Browse files
authored
Allow example_interfaces build (#721)
* Allow example_interfaces build * Add headers and CI library * Update with all libs * Add OpenCR patch, added to Readme and CI * test will missing packages * Revert build changes
1 parent b4dc022 commit f9a06b1

File tree

5 files changed

+148
-8
lines changed

5 files changed

+148
-8
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ jobs:
4949
rsync -a arduino-1.8.13/hardware/tools/ /github/home/.arduino15/packages/tools/
5050
rm -rf arduino-1.8.13 arduino-1.8.13-linux64.tar.xz
5151
#
52-
# PATCHING TEENSY AND SAM
52+
# PATCHING TEENSY, SAM AND OPENCR
5353
cat checkout/extras/patching_boards/platform_teensy.txt > /github/home/.arduino15/packages/teensy/avr/platform.txt
5454
# remove when https://github.com/arduino/ArduinoCore-sam/pull/115 merged
5555
cat checkout/extras/patching_boards/platform_arduinocore_sam.txt > /github/home/.arduino15/packages/arduino/hardware/sam/1.6.12/platform.txt
56+
# remove when https://github.com/ROBOTIS-GIT/OpenCR/pull/294 merged and released
57+
cat checkout/extras/patching_boards/platform_arduinocore_opencr.txt > /github/home/.arduino15/packages/OpenCR/hardware/OpenCR/1.4.18/platform.txt
5658
#
5759
# BUILDING EXAPLE FOR EACH PLATFORM
5860
arduino-cli core update-index
@@ -61,8 +63,7 @@ jobs:
6163
arduino-cli lib install "STM32duino X-NUCLEO-IKS01A3"
6264
# Build all demos
6365
arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
64-
# Workaround. Remove when https://github.com/ros2/rosidl/pull/596 is merged
65-
# arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_addtwoints_service -v
66+
arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_addtwoints_service -v
6667
arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_reconnection_example -v
6768
arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_subscriber -v
6869
arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_subscriber_twist -v

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ As the build process for ROS 2 and micro-ROS is based on custom meta-build syste
1313
- [Patch Arduino board for support precompiled libraries](#patch-arduino-board-for-support-precompiled-libraries)
1414
- [Patch Teensyduino](#patch-teensyduino)
1515
- [Patch SAMD](#patch-samd)
16+
- [Patch OpenCR](#patch-opencr)
1617
- [Purpose of the Project](#purpose-of-the-project)
1718
- [License](#license)
1819
- [Known Issues/Limitations](#known-issueslimitations)
@@ -115,6 +116,17 @@ cd $ARDUINO_PATH/hardware/sam/1.6.12/
115116
curl https://raw.githubusercontent.com/micro-ROS/micro_ros_arduino/galactic/extras/patching_boards/platform_arduinocore_sam.txt > platform.txt
116117
```
117118

119+
### Patch OpenCR
120+
121+
Go inside your Arduino OpenCR installation and replace `platform.txt`:
122+
123+
```bash
124+
export ARDUINO_PATH=[Your Arduino OpenCR path]
125+
/home/username/.arduino15/packages/OpenCR/hardware/OpenCR/1.4.18/platform.txt
126+
cd $ARDUINO_PATH/hardware/OpenCR/1.4.18/
127+
curl https://raw.githubusercontent.com/micro-ROS/micro_ros_arduino/galactic/extras/patching_boards/platform_arduinocore_opencr.txt > platform.txt
128+
```
129+
118130
## Purpose of the Project
119131

120132
This software is not ready for production use. It has neither been developed nor

built_packages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
https://github.com/eProsima/Micro-XRCE-DDS-Client.git 243b16b659f1b46e6678db21c30f246910a3b697
2+
https://github.com/eProsima/Micro-XRCE-DDS-Client.git e61bfa0e0bfdb74f4a592b2efbf7acbfcfeb6c1f
33
https://github.com/eProsima/Micro-CDR.git cb4403a8780095df94a7b1936b1e00153c90070d
44
https://github.com/ros2/libyaml_vendor.git ce1ad8793760ae9585d19a1e484e7342acb95fa2
55
https://github.com/ros2/unique_identifier_msgs.git 27767cefcf8a80da44641dc208c57722c28aa11c

extras/library_generation/library_generation.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ fi
6868

6969
cd /uros_ws
7070

71-
# Workaround for https://github.com/ros2/rosidl/pull/599
72-
touch firmware/mcu_ws/ros2/common_interfaces/actionlib_msgs/COLCON_IGNORE;
73-
touch firmware/mcu_ws/ros2/common_interfaces/std_srvs/COLCON_IGNORE;
74-
touch firmware/mcu_ws/ros2/example_interfaces/COLCON_IGNORE;
7571

7672
######## Clean and source ########
7773
find /project/src/ ! -name micro_ros_arduino.h ! -name *.c ! -name *.cpp ! -name *.c.in -delete
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#
2+
# Map of STM32 cube MX CMSIS HAL drivers to underlay maple libs
3+
#
4+
# configured by sheepdoll (Julie S Porter) 2015
5+
# modified by Baram
6+
# For more info:
7+
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
8+
# http://stm32duino.com/
9+
# http://oroca.org
10+
11+
name=OpenCR
12+
version=1.0.0
13+
14+
compiler.warning_flags=-w -DDEBUG_LEVEL=DEBUG_NONE
15+
compiler.warning_flags.none=-w -DDEBUG_LEVEL=DEBUG_NONE
16+
compiler.warning_flags.default=-DDEBUG_LEVEL=DEBUG_NONE
17+
compiler.warning_flags.more=-Wall -DDEBUG_LEVEL=DEBUG_FAULT
18+
compiler.warning_flags.all=-Wall -Wextra -DDEBUG_LEVEL=DEBUG_ALL
19+
20+
# compiler variables
21+
# ----------------------
22+
compiler.path={runtime.tools.opencr_gcc.path}/bin/
23+
compiler.c.cmd=arm-none-eabi-gcc
24+
compiler.c.flags=-c -g -O2 -std=gnu11 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant}
25+
compiler.c.elf.cmd=arm-none-eabi-g++
26+
compiler.c.elf.flags=-Os -Wl,--gc-sections
27+
compiler.S.cmd=arm-none-eabi-gcc
28+
compiler.S.flags=-c -g -x assembler-with-cpp -MMD
29+
compiler.cpp.cmd=arm-none-eabi-g++
30+
compiler.cpp.flags=-c -g -O2 -std=gnu++11 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_{build.variant}
31+
compiler.ar.cmd=arm-none-eabi-ar
32+
compiler.ar.flags=rcs
33+
compiler.objcopy.cmd=arm-none-eabi-objcopy
34+
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
35+
compiler.elf2hex.flags=-O binary
36+
compiler.elf2hex.cmd=arm-none-eabi-objcopy
37+
compiler.ldflags=
38+
compiler.size.cmd=arm-none-eabi-size
39+
compiler.define=-DARDUINO=
40+
compiler.libraries.ldflags=
41+
42+
43+
build.cpu_flags=
44+
build.hs_flag=
45+
build.upload_flags=
46+
#build.extra_flags= {build.upload_flags} {build.cpu_flags} {build.hs_flag} {build.common_flags}
47+
48+
49+
# These can be overridden in platform.local.txt
50+
compiler.c.extra_flags=
51+
compiler.c.elf.extra_flags="-L{build.variant.path}/ld"
52+
compiler.cpp.extra_flags=
53+
compiler.S.extra_flags=
54+
compiler.ar.extra_flags=
55+
compiler.elf2hex.extra_flags=
56+
57+
58+
## Compiler include paths
59+
60+
61+
62+
# sheepdoll a better more generic library include paths
63+
compiler.libs.c.flags= "-I{build.variant.path}/{build.inc1}" "-I{build.variant.path}/{build.inc2}" "-I{build.variant.path}/{build.inc3}" "-I{build.variant.path}/{build.inc4}" "-I{build.variant.path}/{build.inc5}" "-I{build.variant.path}/{build.inc6}" "-I{build.variant.path}/{build.inc7}"
64+
65+
66+
# build patterns
67+
# ---------------------
68+
69+
## Compile c files
70+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.cpu_flags} {build.common_flags} {compiler.libs.c.flags} {includes} "{source_file}" -o "{object_file}"
71+
###
72+
73+
## Compile c++ files
74+
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.cpu_flags} {build.hs_flag} {build.common_flags} {compiler.libs.c.flags} {includes} "{source_file}" -o "{object_file}"
75+
#### {compiler.libs.c.flags} before includes
76+
77+
## Compile S files
78+
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.cpu_flags} {build.hs_flag} {build.common_flags} {compiler.libs.c.flags} {includes} "{source_file}" -o "{object_file}"
79+
recipe.s.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.cpu_flags} {build.hs_flag} {build.common_flags} {compiler.libs.c.flags} {includes} "{source_file}" -o "{object_file}"
80+
81+
82+
## Create archives
83+
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
84+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-unresolved-symbols -Wl,--start-group {object_files} -Wl,--whole-archive "{build.path}/{archive_file}" -Wl,--no-whole-archive {compiler.libraries.ldflags} -Wl,--end-group
85+
86+
## Create eeprom
87+
recipe.objcopy.eep.pattern=
88+
89+
## Create hex or binary
90+
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
91+
92+
## Save binary
93+
recipe.output.tmp_file={build.project_name}.bin
94+
recipe.output.save_file={build.project_name}.{build.variant}.bin
95+
96+
97+
## Compute size
98+
# ---------------------
99+
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
100+
recipe.size.regex=^(?:\.text|\.data|\.rodata|\.text.align|\.ARM.exidx)\s+([0-9]+).*
101+
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
102+
103+
104+
# Uploader tools
105+
# -------------------
106+
tools.opencr_ld.cmd=opencr_ld
107+
tools.opencr_ld.cmd.windows=opencr_ld.exe
108+
#tools.opencr_ld.path={runtime.hardware.path}/tools/win
109+
#tools.opencr_ld.path.macosx={runtime.hardware.path}/tools/macosx
110+
#tools.opencr_ld.path.linux={runtime.hardware.path}/tools/linux
111+
tools.opencr_ld.path={runtime.tools.opencr_tools.path}/win
112+
tools.opencr_ld.path.macosx={runtime.tools.opencr_tools.path}/macosx
113+
tools.opencr_ld.path.linux={runtime.tools.opencr_tools.path}/linux
114+
115+
tools.opencr_ld.upload.params.verbose=-d
116+
tools.opencr_ld.upload.params.quiet=n
117+
tools.opencr_ld.upload.pattern="{path}/{cmd}" "{serial.port}" "115200" "{build.path}/{build.project_name}.bin" "1"
118+
119+
tools.dfu_util.cmd=dfu-util
120+
tools.dfu_util.cmd.windows=dfu-util.exe
121+
tools.dfu_util.path={runtime.tools.opencr_tools.path}/win/dfu-util
122+
tools.dfu_util.path.macosx={runtime.tools.opencr_tools.path}/macosx/dfu-util
123+
tools.dfu_util.path.linux={runtime.tools.opencr_tools.path}/linux/dfu-util
124+
125+
tools.dfu_util.erase.params.verbose=-v
126+
tools.dfu_util.erase.params.quiet=-q -q
127+
tools.dfu_util.erase.pattern=
128+
129+
tools.dfu_util.bootloader.params.verbose=-v -v -v -v
130+
tools.dfu_util.bootloader.params.quiet=-q -q
131+
tools.dfu_util.bootloader.pattern="{path}/{cmd}" -d 0483:df11 -a 0 -s 0x08000000 -D "{runtime.platform.path}/bootloaders/{bootloader.file}"

0 commit comments

Comments
 (0)