Skip to content
Open
Show file tree
Hide file tree
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
24 changes: 22 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Building from Sources under linux
# Building from Sources under Linux

### Step1: get prerequisites

- sudo apt install arduino
- pip install pymavlink

# Building from Sources under macOS

### Step1: get prerequisites

- Install Homebrew if not already installed: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
- Install arduino-cli: `brew install arduino-cli`
- pip install pymavlink

### Step2: get code

- cd ~
Expand All @@ -16,7 +24,11 @@
- ./scripts/regen_headers.sh
- ./scripts/add_libraries.sh

## Building with make and arduino-cli
## Building with make and arduino-cli (Linux and macOS)

The Makefile automatically detects your operating system:
- On macOS: Uses Homebrew-installed arduino-cli and ~/Library/Arduino15 for Arduino home
- On Linux: Uses ../bin/arduino-cli and ~/.arduino15 for Arduino home

### Step1: Use make to install ESP32 support

Expand All @@ -25,14 +37,22 @@

### Step2: Use make to build

Build all targets:
- cd RemoteIDModule
- make

Or build specific targets (available targets: esp32s3dev, esp32c3dev, bluemark-db200, bluemark-db110, jw-tbd, mro-rid, jwrid-esp32s3, bluemark-db202, bluemark-db210, bluemark-db203, holybro-RemoteID, CUAV-RID):
- make esp32s3dev

### Step3: Use make to upload

Upload default (ESP32S3_DEV):
- cd RemoteIDModule
- make upload

Or upload specific build:
- make upload-ESP32S3_DEV

If the board does not flash, hold-down the BOOT pushbutton on the PCB while pressing the RESET pushbutton briefly [to force it into bootloader mode] and retry.
The ESP32-S3 is now running and emitting test/demo remote-id bluetooth

Expand Down
15 changes: 13 additions & 2 deletions RemoteIDModule/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ ESPTOOL=$(ESP32_TOOLS)/esptool.py

ESP32_FQBN=esp32:esp32:$(CHIP)
SERDEV := $(wildcard /dev/serial/by-id/usb-Espressif_*)
ARDUINO_CLI=../bin/arduino-cli

# Detect operating system and set arduino-cli path accordingly
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
# macOS - use Homebrew arduino-cli
ARDUINO_CLI=arduino-cli
ARDUINO_HOME=$(HOME)/Library/Arduino15
else
# Linux - use downloaded arduino-cli
ARDUINO_CLI=../bin/arduino-cli
endif

APP_PARTITION_SIZE=2031616

# ensure python tools are in $PATH
Expand Down Expand Up @@ -72,7 +83,7 @@ ArduRemoteID-%.bin: gitversion *.cpp *.ino *.h romfs_files.h
@echo "Building $* on $(CHIP)"
@BUILD_FLAGS="-DBOARD_$*"
@rm -rf build build-$*
@$(ARDUINO_CLI) compile -b esp32:esp32:$(CHIP) --export-binaries --build-property build.extra_flags="-DBOARD_$* -DESP32" --build-property upload.maximum_size=$(APP_PARTITION_SIZE)
@$(ARDUINO_CLI) compile -b esp32:esp32:$(CHIP) --export-binaries --libraries "$(HOME)/Arduino/libraries" --build-property build.extra_flags="-DBOARD_$* -DESP32" --build-property upload.maximum_size=$(APP_PARTITION_SIZE)
@cp build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.bin ArduRemoteID_$*_OTA.bin
@echo "Merging $*"
@python3 $(ESPTOOL) --chip $(CHIP) merge_bin -o ArduRemoteID-$*.bin --flash_size 4MB 0x0 build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.bootloader.bin 0x8000 build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.partitions.bin 0xe000 $(ESP32_TOOLS)/partitions/boot_app0.bin 0x10000 build/esp32.esp32.$(CHIP)/RemoteIDModule.ino.bin
Expand Down
3 changes: 3 additions & 0 deletions RemoteIDModule/arduino-cli.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
board_manager:
additional_urls:
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

directories:
user: ~/Arduino
7 changes: 6 additions & 1 deletion scripts/add_libraries.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash
# setup libraries links in $HOME/Arduino

DEST=~/Arduino/libraries/
UNAME_S=$(uname -s)
if [ "$UNAME_S" = "Darwin" ]; then
DEST=~/Library/Arduino15/libraries/
else
DEST=~/Arduino/libraries/
fi

mkdir -p "$DEST"
ln -sf $PWD/modules/uav_electronic_ids/utm "$DEST"
Expand Down
51 changes: 48 additions & 3 deletions scripts/install_build_env.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,57 @@
#!/bin/bash

# Detect operating system
OS=$(uname -s)

# Install Python dependencies
python3 -m pip install setuptools
python3 -m pip install empy==3.3.4
python3 -m pip install pymavlink
python3 -m pip install dronecan
python3 -m pip install pyserial
python3 -m pip install pexpect

# Install pymonocypher with version compatible for Python 3.8
python3 -m pip install pymonocypher==3.1.3.2

wget https://downloads.arduino.cc/arduino-cli/arduino-cli_0.27.1_Linux_64bit.tar.gz
mkdir -p bin
(cd bin && tar xvzf ../arduino-cli_0.27.1_Linux_64bit.tar.gz)
# Handle Arduino CLI installation based on OS
if [ "$OS" = "Darwin" ]; then
echo "macOS detected - checking for Homebrew and arduino-cli installation..."

# Check if Homebrew is installed
if ! command -v brew &>/dev/null; then
echo "Error: Homebrew is not installed. Please install Homebrew first:"
echo "/bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
exit 1
fi

# Check if arduino-cli is installed
if ! command -v arduino-cli &>/dev/null; then
echo "Installing arduino-cli via Homebrew..."
brew install arduino-cli
else
echo "arduino-cli is already installed"
fi

elif [ "$OS" = "Linux" ]; then
echo "Linux detected - downloading arduino-cli..."

# Check if wget is available, if not try curl
if command -v wget &>/dev/null; then
wget https://downloads.arduino.cc/arduino-cli/arduino-cli_0.27.1_Linux_64bit.tar.gz
elif command -v curl &>/dev/null; then
curl -L -o arduino-cli_0.27.1_Linux_64bit.tar.gz https://downloads.arduino.cc/arduino-cli/arduino-cli_0.27.1_Linux_64bit.tar.gz
else
echo "Error: Neither wget nor curl is available. Please install one of them."
exit 1
fi

mkdir -p bin
(cd bin && tar xvzf ../arduino-cli_0.27.1_Linux_64bit.tar.gz)

else
echo "Unsupported operating system: $OS"
exit 1
fi

echo "Build environment installation completed for $OS"