Skip to content

Commit 12b52f0

Browse files
Acuadros95mergify[bot]
authored andcommitted
Fix teensy patch and compiler (#1482)
* Update teensy compiler and platform fix Signed-off-by: acuadros95 <acuadros1995@gmail.com> * Update Readme and CI Signed-off-by: acuadros95 <acuadros1995@gmail.com> * set specific version to teensy CI Signed-off-by: acuadros95 <acuadros1995@gmail.com> --------- Signed-off-by: acuadros95 <acuadros1995@gmail.com> (cherry picked from commit 69ca6d8) # Conflicts: # README.md
1 parent 70bce0c commit 12b52f0

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ jobs:
2828
additional_urls:
2929
- https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json
3030
- https://github.com/espressif/arduino-esp32/releases/download/2.0.2/package_esp32_index.json
31-
- https://www.pjrc.com/teensy/td_156/package_teensy_index.json
31+
- https://www.pjrc.com/teensy/package_teensy_index.json
3232
- https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json''' > arduino-cli.yaml
3333
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
3434
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
35-
curl -fsSL https://www.pjrc.com/teensy/td_156/package_teensy_index.json -o /github/home/.arduino15/package_teensy_index.json
35+
curl -fsSL https://www.pjrc.com/teensy/package_teensy_index.json -o /github/home/.arduino15/package_teensy_index.json
3636
curl -fsSL https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json -o /github/home/.arduino15/package_seeeduino_boards_index.json
3737
export PATH=$PATH:/github/workspace/bin:/__w/micro_ros_arduino/micro_ros_arduino/bin
3838
arduino-cli core install OpenCR:OpenCR -v
3939
arduino-cli core install arduino:samd -v
4040
arduino-cli core install arduino:sam -v
4141
arduino-cli core install arduino:mbed -v
4242
arduino-cli core install esp32:esp32 -v
43-
arduino-cli core install teensy:avr -v
43+
arduino-cli core install teensy:avr@1.58.0 -v
4444
arduino-cli core install Seeeduino:samd -v
4545
#
4646
# PATCHING TEENSY AND SAM
47-
cat checkout/extras/patching_boards/platform_teensy.txt > /github/home/.arduino15/packages/teensy/hardware/avr/1.57.2/platform.txt
47+
cat checkout/extras/patching_boards/platform_teensy.txt > /github/home/.arduino15/packages/teensy/hardware/avr/1.58.0/platform.txt
4848
# remove when https://github.com/arduino/ArduinoCore-sam/pull/115 merged
4949
cat checkout/extras/patching_boards/platform_arduinocore_sam.txt > /github/home/.arduino15/packages/arduino/hardware/sam/1.6.12/platform.txt
5050
#

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ As the build process for ROS 2 and micro-ROS is based on custom meta-build syste
2424

2525
Supported boards are:
2626

27+
<<<<<<< HEAD
2728
| Board | Min version | State | Details | .meta file |
2829
| ----------------------------------------------------------------------------------- | ----------- | ---------- | --------------------------------------------------------------------------------------------------- | ------------------------ |
2930
| [Arduino Portenta H7 M7 Core](https://store.arduino.cc/portenta-h7) | v1.8.5 | Supported | Official Arduino support | `colcon.meta` |
@@ -35,6 +36,19 @@ Supported boards are:
3536
| [Teensy 3.5](https://www.pjrc.com/store/teensy35.html) | v1.8.5 | Not tested | [Based on Teensyduino](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon_lowmem.meta` |
3637
| [Teensy 3.6](https://www.pjrc.com/store/teensy36.html) | v1.8.5 | Supported | [Based on Teensyduino](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon_lowmem.meta` |
3738
| [ESP32 Dev Module](https://docs.espressif.com/projects/arduino-esp32/en/latest/boards/ESP32-DevKitC-1.html) | v1.8.5 | Supported | [Arduino core for the ESP32 (v2.0.2)](https://github.com/espressif/arduino-esp32/releases/tag/2.0.2) | `colcon.meta` |
39+
=======
40+
| Board | Min version | State | Details | .meta file |
41+
| ----------------------------------------------------------------------------------------------------------- | ----------- | ---------- | ---------------------------------------------------------------------------------------------------- | ------------------------ |
42+
| [Arduino Portenta H7 M7 Core](https://store.arduino.cc/portenta-h7) | v1.8.5 | Supported | Official Arduino support | `colcon.meta` |
43+
| [Arduino Nano RP2040 Connect](https://docs.arduino.cc/hardware/nano-rp2040-connect) | v1.8.5 | Supported | Official Arduino support | `colcon_verylowmem.meta` |
44+
| [OpenCR](https://emanual.robotis.com/docs/en/parts/controller/opencr10/) | v1.4.16 | Supported | [Based on custom board](https://emanual.robotis.com/docs/en/parts/controller/opencr10/#arduino-ide) | `colcon.meta` |
45+
| [Teensy 4.0](https://www.pjrc.com/store/teensy40.html) | v1.8.5 | Not tested | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon.meta` |
46+
| [Teensy 4.1](https://www.pjrc.com/store/teensy41.html) | v1.8.5 | Supported | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon.meta` |
47+
| [Teensy 3.2/3.1](https://www.pjrc.com/store/teensy32.html) | v1.8.5 | Supported | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon_lowmem.meta` |
48+
| [Teensy 3.5](https://www.pjrc.com/store/teensy35.html) | v1.8.5 | Not tested | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon_lowmem.meta` |
49+
| [Teensy 3.6](https://www.pjrc.com/store/teensy36.html) | v1.8.5 | Supported | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon_lowmem.meta` |
50+
| [ESP32 Dev Module](https://docs.espressif.com/projects/arduino-esp32/en/latest/boards/ESP32-DevKitC-1.html) | v1.8.5 | Supported | [Arduino core for the ESP32 (v2.0.2)](https://github.com/espressif/arduino-esp32/releases/tag/2.0.2) | `colcon.meta` |
51+
>>>>>>> 69ca6d8 (Fix teensy patch and compiler (#1482))
3852
3953
Community contributed boards are:
4054

@@ -96,12 +110,14 @@ You can [configure many parameters](https://micro.ros.org/docs/tutorials/advance
96110
Go inside your Arduino + Teensyduino installation and replace `platform.txt`:
97111

98112
```bash
99-
export TEENSYDUINO_VERSION=[Your Teensyduino library version, e.g: 1.57.2]
113+
export TEENSYDUINO_VERSION=[Your Teensyduino library version, e.g: 1.58.0]
100114
export ARDUINO_PATH=[Your Arduino + Teensyduino path]
101115
cd $ARDUINO_PATH/hardware/avr/$TEENSYDUINO_VERSION/
102116
curl https://raw.githubusercontent.com/micro-ROS/micro_ros_arduino/main/extras/patching_boards/platform_teensy.txt > platform.txt
103117
```
104118

119+
The patch applies the changes detailed on the first two sections of this post: [Solution for adding support for pre-compiled Libraries](https://forum.pjrc.com/threads/63256-Solution-for-adding-support-for-pre-compiled-Libraries)
120+
105121
### Patch SAM
106122

107123
Go inside your Arduino installation and replace `platform.txt`:

extras/library_generation/library_generation.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fi
117117
if [[ " ${PLATFORMS[@]} " =~ " teensy32 " ]]; then
118118
rm -rf firmware/build
119119

120-
export TOOLCHAIN_PREFIX=/uros_ws/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-
120+
export TOOLCHAIN_PREFIX=/uros_ws/teensy-compile/tools/arm/bin/arm-none-eabi-
121121
ros2 run micro_ros_setup build_firmware.sh /project/extras/library_generation/teensy32_toolchain.cmake /project/extras/library_generation/colcon_lowmem.meta
122122

123123
find firmware/build/include/ -name "*.c" -delete
@@ -131,7 +131,7 @@ fi
131131
if [[ " ${PLATFORMS[@]} " =~ " teensy35 " ]]; then
132132
rm -rf firmware/build
133133

134-
export TOOLCHAIN_PREFIX=/uros_ws/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-
134+
export TOOLCHAIN_PREFIX=/uros_ws/teensy-compile/tools/arm/bin/arm-none-eabi-
135135
ros2 run micro_ros_setup build_firmware.sh /project/extras/library_generation/teensy35_toolchain.cmake /project/extras/library_generation/colcon_lowmem.meta
136136

137137
find firmware/build/include/ -name "*.c" -delete
@@ -150,7 +150,7 @@ if [[ " ${PLATFORMS[@]} " =~ " teensy36 " ]]; then
150150
if [[ " ${PLATFORMS[@]} " =~ " teensy35 " ]]; then
151151
ln /project/src/mk64fx512/fpv4-sp-d16-hard/libmicroros.a /project/src/mk66fx1m0/fpv4-sp-d16-hard/libmicroros.a
152152
else
153-
export TOOLCHAIN_PREFIX=/uros_ws/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-
153+
export TOOLCHAIN_PREFIX=/uros_ws/teensy-compile/tools/arm/bin/arm-none-eabi-
154154
ros2 run micro_ros_setup build_firmware.sh /project/extras/library_generation/teensy35_toolchain.cmake /project/extras/library_generation/colcon_lowmem.meta
155155

156156
find firmware/build/include/ -name "*.c" -delete
@@ -164,7 +164,7 @@ fi
164164
if [[ " ${PLATFORMS[@]} " =~ " teensy4 " ]]; then
165165
rm -rf firmware/build
166166

167-
export TOOLCHAIN_PREFIX=/uros_ws/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-
167+
export TOOLCHAIN_PREFIX=/uros_ws/teensy-compile/tools/arm/bin/arm-none-eabi-
168168
ros2 run micro_ros_setup build_firmware.sh /project/extras/library_generation/teensy4_toolchain.cmake /project/extras/library_generation/colcon.meta
169169

170170
find firmware/build/include/ -name "*.c" -delete
@@ -237,8 +237,8 @@ popd > /dev/null
237237

238238
apt -y install rsync
239239
for var in ${INCLUDE_ROS2_PACKAGES}; do
240-
rsync -r /project/src/${var}/${var}/* /project/src/${var}/
241-
rm -rf /project/src/${var}/${var}/
240+
rsync -r /project/src/${var}/${var}/* /project/src/${var}/ > /dev/null 2>&1
241+
rm -rf /project/src/${var}/${var}/ > /dev/null 2>&1
242242
done
243243

244244
######## Generate extra files ########

extras/patching_boards/platform_teensy.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# https://www.pjrc.com/teensy/td_download.html
2+
# https://arduino.github.io/arduino-cli/latest/platform-specification/
3+
# https://arduino.github.io/arduino-cli/0.30/platform-specification/
4+
15
name=Teensyduino
26
version=1.8.5
37
rewriting=disabled
@@ -11,6 +15,15 @@ compiler.path={runtime.tools.teensy-compile.path}/
1115
teensytools.path={runtime.tools.teensy-tools.path}/
1216

1317

18+
## Debugger - Experimental
19+
#debug.executable={build.path}/{build.project_name}.elf
20+
#debug.toolchain=gcc
21+
#debug.toolchain.path={compiler.path}{build.toolchain}
22+
#debug.toolchain.prefix=arm-none-eabi-
23+
#debug.server=openocd
24+
#debug.server.openocd.path={teensytools.path}tdebug
25+
#debug.server.openocd.scripts_dir=unused
26+
#debug.server.openocd.script=toolspath:{teensytools.path}:buildpath:{build.path}:name:{build.project_name}:board:{build.board}
1427

1528
## EEPROM Data
1629
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
@@ -44,7 +57,7 @@ recipe.S.o.pattern="{compiler.path}{build.toolchain}{build.command.gcc}" -c {bui
4457
recipe.ar.pattern="{compiler.path}{build.toolchain}{build.command.ar}" rcs "{archive_file_path}" "{object_file}"
4558

4659
## Link
47-
recipe.c.combine.pattern="{compiler.path}{build.toolchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {compiler.libraries.ldflags} "-L{build.path}" {build.flags.libs}
60+
recipe.c.combine.pattern="{compiler.path}{build.toolchain}{build.command.linker}" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} "{build.path}/{archive_file}" "-L{build.path}" {build.flags.libs}
4861

4962
## Patch ELF - TODO: not supported by modern Arduino... :(
5063
recipe.elfpatch.pattern="{teensytools.path}/{build.elfpatch}" -mmcu={build.mcu} "{build.path}/{build.project_name}.elf" "{sketch_path}/disk"
@@ -67,7 +80,7 @@ recipe.hooks.postbuild.3.pattern="{teensytools.path}teensy_size" "{build.path}/{
6780
# objdump to create .lst file is VERY SLOW for huge files
6881
# https://forum.pjrc.com/threads/68121?p=288306&viewfull=1#post288306
6982
#
70-
# recipe.hooks.postbuild.4.pattern="{teensytools.path}stdout_redirect" "{build.path}/{build.project_name}.lst" "{compiler.path}{build.toolchain}{build.command.objdump}" -d -S -C "{build.path}/{build.project_name}.elf"
83+
recipe.hooks.postbuild.4.pattern="{teensytools.path}stdout_redirect" "{build.path}/{build.project_name}.lst" "{compiler.path}{build.toolchain}{build.command.objdump}" -d -S -C "{build.path}/{build.project_name}.elf"
7184

7285

7386
## Compute size

0 commit comments

Comments
 (0)