From f58724fd5ddde7f797661021db0bcc7fe5d97ffe Mon Sep 17 00:00:00 2001 From: seyoka Date: Sat, 13 Sep 2025 18:38:36 +0100 Subject: [PATCH 1/3] genesis --- RemoteIDModule/Makefile | 15 ++++++++-- RemoteIDModule/arduino-cli.yaml | 3 ++ scripts/add_libraries.sh | 7 ++++- scripts/install_build_env.sh | 53 ++++++++++++++++++++++++++++++--- 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/RemoteIDModule/Makefile b/RemoteIDModule/Makefile index 989c8cd..86f57cf 100644 --- a/RemoteIDModule/Makefile +++ b/RemoteIDModule/Makefile @@ -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 @@ -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 diff --git a/RemoteIDModule/arduino-cli.yaml b/RemoteIDModule/arduino-cli.yaml index 86a9c7d..f581c2c 100644 --- a/RemoteIDModule/arduino-cli.yaml +++ b/RemoteIDModule/arduino-cli.yaml @@ -1,3 +1,6 @@ board_manager: additional_urls: - https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json + +directories: + user: ~/Arduino diff --git a/scripts/add_libraries.sh b/scripts/add_libraries.sh index a2e6e32..2e34181 100755 --- a/scripts/add_libraries.sh +++ b/scripts/add_libraries.sh @@ -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" diff --git a/scripts/install_build_env.sh b/scripts/install_build_env.sh index c913663..ede150b 100755 --- a/scripts/install_build_env.sh +++ b/scripts/install_build_env.sh @@ -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 -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) +# Install pymonocypher with version compatible for Python 3.8 +python3 -m pip install pymonocypher==3.1.3.1 + +# 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" From 8b8aa423c3f802e745ab323f57f80da17a57904c Mon Sep 17 00:00:00 2001 From: seyoka Date: Sat, 13 Sep 2025 19:40:40 +0100 Subject: [PATCH 2/3] fixed version issues with pymonocypher --- scripts/install_build_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_build_env.sh b/scripts/install_build_env.sh index ede150b..dc1df23 100755 --- a/scripts/install_build_env.sh +++ b/scripts/install_build_env.sh @@ -12,7 +12,7 @@ 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.1 +python3 -m pip install pymonocypher==3.1.3.2 # Handle Arduino CLI installation based on OS if [ "$OS" = "Darwin" ]; then From 6e522c36e6b936e813b1aa2c17c4dfcc32c0c456 Mon Sep 17 00:00:00 2001 From: seyoka Date: Sat, 13 Sep 2025 20:11:01 +0100 Subject: [PATCH 3/3] Updated BUILDING.md to reflect new sources --- BUILDING.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 255cb3a..80bb29a 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -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 ~ @@ -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 @@ -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