Skip to content

Commit

Permalink
HOTFIX: fixed teensy compile,upload toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
raghavauppuluri13 committed Jan 27, 2024
1 parent 52c389d commit 8bac0ce
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
teensy_loader_cli
# datasets
data/
*.lz4
Expand Down
17 changes: 0 additions & 17 deletions lunabot_embedded/firmware/setup_flash_tools.sh

This file was deleted.

19 changes: 19 additions & 0 deletions lunabot_embedded/firmware/setup_teensy_toolchain.sh
Original file line number Diff line number Diff line change
@@ -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 ..
16 changes: 11 additions & 5 deletions lunabot_embedded/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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
```

0 comments on commit 8bac0ce

Please sign in to comment.