Skip to content

Deprecate platformIO support (backport #957) #958

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

Merged
merged 2 commits into from
Apr 21, 2022
Merged
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
109 changes: 1 addition & 108 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ As the build process for ROS 2 and micro-ROS is based on custom meta-build syste
- [How to use the precompiled library](#how-to-use-the-precompiled-library)
- [Arduino IDE](#arduino-ide)
- [PlatformIO](#platformio)
- [Known issues](#known-issues)
- [How to build the precompiled library](#how-to-build-the-precompiled-library)
- [Patch Arduino board for support precompiled libraries](#patch-arduino-board-for-support-precompiled-libraries)
- [Patch Teensyduino](#patch-teensyduino)
Expand Down Expand Up @@ -73,113 +72,7 @@ docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agen
```
### PlatformIO

For boards supported by micro-ROS, all you have to do to add the library to your project is including the following lines in the existing `platformio.ini` file:

```ini
[env:<YOUR_BOARD>]

...
lib_deps =
https://github.com/micro-ROS/micro_ros_arduino

build_flags =
-L ./.pio/libdeps/<YOUR_BOARD>/micro_ros_arduino/src/<BOARD_ARCHITECTURE>/
-l microros
-D <TARGET_DEFINITION>
```

| Board | <YOUR_BOARD> | <BOARD_ARCHITECTURE> | <TARGET_DEFINITION> |
| ----------------------------| ------------------- | ---------------------------- | ----------------------------------- |
| Arduino Portenta H7 M7 Core | portenta_h7_m7 | cortex-m7/fpv5-d16-softfp | TARGET_PORTENTA_H7_M7 |
| Arduino Nano RP2040 Connect | nanorp2040connect | cortex-m0plus | ARDUINO_NANO_RP2040_CONNECT |
| Teensy 4.1/4.0 | teensy41 / teensy40 | imxrt1062/fpv5-d16-hard | ARDUINO_TEENSY41 |
| Teensy 3.6 | teensy36 | mk66fx1m0/fpv4-sp-d16-hard | ARDUINO_TEENSY36 |
| Teensy 3.5 | teensy35 | mk64fx512/fpv4-sp-d16-hard | ARDUINO_TEENSY35 |
| Teensy 3.2 / 3.1 | teensy31 | mk20dx256 | ARDUINO_TEENSY32 / ARDUINO_TEENSY31 |
| ESP32 Dev Module | esp32dev | esp32 | ESP32 |
| STM32-E407 | olimex_e407 | cortex-m4 | TARGET_STM32F4 |
| Arduino Due | due | cortex-m3 | - |
| Arduino Zero | zero | cortex-m0plus | - |

Now to proceed with the PlatformIO workflow:

```bash
pio lib install # Install dependencies
pio run # Build the firmware
pio run --target upload # Flash the firmware
```

An example of a micro-ROS application using PlatformIO is available [here](https://github.com/husarion/micro_ros_stm32_template).

#### Known issues

- `multiple definition of` Link errors on galactic:

Create a python script fix_linker.py on your directory and modify the linker flags manually:
```
Import("env")
env["_LIBFLAGS"] = ('-Wl,--start-group -Wl,--whole-archive '
'${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, LIBPREFIXES, '
'LIBSUFFIXES, __env__)} -Wl,--no-whole-archive -lstdc++ '
'-lsupc++ -lm -lc -lgcc -lnosys -lmicroros -Wl,--end-group')
```

Now add it to your `platformio.ini` like this: `extra_scripts = fix_linker.py` and delete the `-l libmicroros` line on `build_flags`.

Related: https://github.com/micro-ROS/micro_ros_arduino/pull/848#issuecomment-1072196933, https://github.com/micro-ROS/micro_ros_arduino/issues/774

- Arduino Portenta H7
- Follow **`multiple definition of` Link errors on galactic** modifications

Related: https://github.com/micro-ROS/micro_ros_arduino/issues/847

- Arduino Nano RP2040 Connect

- The following versioning shall be used:
```
lib_deps =
arduino-libraries/WiFiNINA@^1.8.13
...

platform_packages =
toolchain-gccarmnoneeabi @ ~1.70201.0
framework-arduino-mbed @ ~2.4.1
```

- Library dependency finder shall be set to `chain+`: `lib_ldf_mode = chain+`
- Follow **`multiple definition of` Link errors on galactic** modifications

Related: https://github.com/micro-ROS/micro_ros_arduino/issues/780

- Arduino Due
- The following versioning shall be used:
```
platform_packages =
toolchain-gccarmnoneeabi@<1.50000.0
```

Related: https://github.com/micro-ROS/micro_ros_arduino/issues/698

- ESP32 Dev Module
- Known issues with espressif32 arduino package, use `2.0.2` version:
```
[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
board = esp32dev
framework = arduino
lib_deps =
https://github.com/micro-ROS/micro_ros_arduino.git
build_flags =
-L ./.pio/libdeps/esp32dev/micro_ros_arduino/src/esp32/
-l microros
-D ESP32

platform_packages =
toolchain-xtensa32 @ ~2.80400.0
framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.2
```

Related: https://github.com/micro-ROS/micro_ros_arduino/issues/736, https://github.com/platformio/platform-espressif32/issues/616
PlatformIO support for this repository has been deprecated in favor of its own build system: [micro_ros_platformio](https://github.com/micro-ROS/micro_ros_platformio)

## How to build the precompiled library

Expand Down