From 8bac0cea91907ae0c0ed738d2a77f55fb47590e5 Mon Sep 17 00:00:00 2001 From: Raghava Uppuluri Date: Sat, 27 Jan 2024 16:40:49 -0500 Subject: [PATCH] HOTFIX: fixed teensy compile,upload toolchain --- .gitignore | 1 + .../firmware/setup_flash_tools.sh | 17 ----------------- .../firmware/setup_teensy_toolchain.sh | 19 +++++++++++++++++++ lunabot_embedded/readme.md | 16 +++++++++++----- 4 files changed, 31 insertions(+), 22 deletions(-) delete mode 100755 lunabot_embedded/firmware/setup_flash_tools.sh create mode 100755 lunabot_embedded/firmware/setup_teensy_toolchain.sh diff --git a/.gitignore b/.gitignore index 3fb41088..43bc8ced 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +teensy_loader_cli # datasets data/ *.lz4 diff --git a/lunabot_embedded/firmware/setup_flash_tools.sh b/lunabot_embedded/firmware/setup_flash_tools.sh deleted file mode 100755 index 4ac56d27..00000000 --- a/lunabot_embedded/firmware/setup_flash_tools.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -## Installs compilation tools -arduino-cli config init -python3 update_board_manager.py -arduino-cli core install teensy:avr -arduino-cli lib install HX711-master -arduino-cli lib install ADS1115-Lite - -## Installs teensy flasher -sudo apt-get install libusb-dev -git clone https://github.com/PaulStoffregen/teensy_loader_cli -cd teensy_loader_cli -make -sudo make install -cd .. -rm -rf teensy_loader_cli diff --git a/lunabot_embedded/firmware/setup_teensy_toolchain.sh b/lunabot_embedded/firmware/setup_teensy_toolchain.sh new file mode 100755 index 00000000..2d90f90d --- /dev/null +++ b/lunabot_embedded/firmware/setup_teensy_toolchain.sh @@ -0,0 +1,19 @@ +#!/bin/sh +## Installs compilation tools +arduino-cli config init +python3 update_board_manager.py +arduino-cli core install teensy:avr +arduino-cli lib install Stepper + +## Installs teensy flasher +sudo apt-get install libusb-dev +git clone https://github.com/PaulStoffregen/teensy_loader_cli +cd teensy_loader_cli +make +echo "Installing teensy_loader_cli..." +read -p "Enter the teensy_loader_cli install directory (press Enter for default: /usr/local/bin): " install_dir +if [ -z "$install_dir" ]; then + install_dir="/usr/local/bin" +fi +sudo ln -s $(readlink -f teensy_loader_cli) $install_dir/teensy_loader_cli +cd .. diff --git a/lunabot_embedded/readme.md b/lunabot_embedded/readme.md index 15d39b81..23430c92 100644 --- a/lunabot_embedded/readme.md +++ b/lunabot_embedded/readme.md @@ -10,28 +10,34 @@ code in `firmware/teensy_main/` +### Supported Platforms +- Linux + - use WSL2 if on Windows or dual-boot +- MacOS 12.3+ (Monterey) + ### Prerequisites - [Install arduino-cli compilation toolchain](https://arduino.github.io/arduino-cli/0.35/installation/#use-the-install-script) +- ROS is NOT required ### Quick start 1. Setup development environment ``` -roscd lunabot_embedded/firmware -./setup_flash_tools.sh +cd lunabot_embedded/firmware +./setup_teensy_toolchain.sh ``` 2. Add aliases to simplify compilation (in `.bashrc` or `.zshrc`): ``` -alias teensy_compile="arduino-cli compile --build-path build --libraries lib --fqbn teensy:avr:teensy41:usb=rawhid teensy_main" +alias teensy_compile="arduino-cli compile --build-path build --libraries lib --fqbn teensy:avr:teensy41:usb=rawhid teensy_main.ino" alias teensy_upload="teensy_loader_cli --mcu=TEENSY41 -wv build/teensy_main.ino.hex" ``` 3. Compile (no hardware needed) + Upload ``` -roscd lunabot_embedded/firmware/teensy_main +cd lunabot_embedded/firmware/teensy_main teensy_compile teensy_upload ``` @@ -40,6 +46,6 @@ teensy_upload ``` pip3 install nanopb -roscd lunabot_embedded/firmware/teensy_main/lib/lunabot_drivers +cd lunabot_embedded/firmware/teensy_main/lib/lunabot_drivers python3 -m nanopb.generator.nanopb_generator -L quote RobotMsgs.proto ```