tools: cull to a minimal user-facing set

Reduce tools/ to the four scripts an outside contributor needs: build,
verify, flash, and size-profile. Drop maintainer-only workflow scripts
(sibling-repo pulls, firmware-archive auto-commit, version tagging),
broken stubs (doxygen.sh, variables.sh), and the entire tools/2024/
directory.

tools/2024/ included a 647 KB Arduino.tar.gz bundling 20 third-party
Arduino libraries (RadioHead = GPLv2, TinyGPSPlus = LGPL, etc.) without
per-library attribution in NOTICE; a 503 KB GPL avrdude.conf; the GPL
Optiboot bootloader hex; and pre-built firmware/test binaries. Users
install the libraries via Arduino Library Manager (per README), use the
system avrdude, and reproduce the firmware from source.

README.md: add EEPROMEx to the library list (used by WII5Config /
WII5Sh3dConfig); note that RadioHead is GPLv2 dual-licensed and only
LoRa builds (-DWII5_RADIO_LORA) link it.

CONTRIBUTING.md: replace the dead tools/upload.sh reference with the
generic *.local.sh pattern.

Kept: build_local.sh, verify.sh, icsp.sh, memory.pl.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 10:33:09 +10:00
parent be88884c0d
commit c89c636cb7
23 changed files with 12 additions and 16400 deletions
+3 -3
View File
@@ -18,9 +18,9 @@ short up-front conversation usually saves a long review.
This is an Arduino IDE / `arduino-cli` project targeting the
ATmega2560 on a custom WII5 v2 board (see `WII5_board_v2.h`).
The build scripts in `tools/` are parameterized via env vars; copy
`tools/upload.sh` to `tools/upload.local.sh` (gitignored) and edit, or
export `WII5_BUILD_DIR`, `WII5_AVRDUDE_CONF`, `WII5_REMOTE`, etc. as needed.
The build scripts in `tools/` are parameterized via env vars; copy any
of them to `tools/<name>.local.sh` (gitignored) and edit, or export
`WII5_BUILD_DIR`, `WII5_AVRDUDE_CONF`, `WII5_SERIAL`, etc. as needed.
See each script's preamble for the env vars it expects.
## Submitting changes
+9 -3
View File
@@ -61,7 +61,12 @@ script's preamble for the variables it expects. Copy any of them to
Library dependencies (install via Arduino Library Manager or
`arduino-cli lib install`): TimeLib, RTClib, elapsedMillis, TinyGPSPlus,
AvgStd, IridiumSBD, OneWire, DallasTemperature, SDBlock, CRC32,
PushButton, MemoryFree, LowPower, RadioHead.
PushButton, MemoryFree, LowPower, EEPROMEx, RadioHead.
RadioHead is dual-licensed GPLv2 / commercial. The default ATmega2560
build does not link RadioHead; only LoRa-enabled builds
(`-DWII5_RADIO_LORA`) do, and binaries distributed from such builds
inherit GPLv2 terms.
## Architecture
@@ -106,8 +111,9 @@ WII5*.{h,cpp} Firmware source (board root, see Architecture)
WII5_board_v2.h Pin/peripheral map for the WII5 v2 board
doc/ Design notes, command reference, hardware schematics
test/ Smaller per-subsystem test sketches
tools/ Build, flash, and version helper scripts (env-var
driven; copy to *.local.sh to set local defaults)
tools/ Build, flash, and size-profile helper scripts
(env-var driven; copy to *.local.sh to set local
defaults)
```
## Contributing
-13
View File
@@ -1,13 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Reference snippet (not directly executable): how the 2022 build burned the
# optiboot bootloader on an ATmega2560 via ICSP. Use tools/icsp.sh for the
# parameterized version.
#
# avrdude -C <avrdude.conf> -v -patmega2560 -cstk500v2 -Pusb \
# -Uflash:w:<path to optiboot_flash_atmega2560_UART0_230400_11059200L_BIGBOOT.hex>:i \
# -Ulock:w:0x0F:m
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Burn LED-flash test sketch + bootloader for the 11.0592 MHz board variant.
# See http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega2560
# lfuse 0xff - external oscillator
# hfuse 0xd8
# efuse 0xfd - BOD Level 1 = 2.7V
: "${WII5_AVRDUDE:=avrdude}"
CONFIGFILE=./avrdude.conf
BOOT_HEX=./optiboot_flash_atmega2560_UART0_230400_11059200L_BIGBOOT.hex
"$WII5_AVRDUDE" \
-C"$CONFIGFILE" -v \
-v \
-patmega2560 \
-cstk500v2 \
-Pusb \
-Uflash:w:ledflash_11mhz.ino.hex:i \
-Uboot:w:"$BOOT_HEX":i \
-Ulock:w:0
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Burn LED-flash test sketch + bootloader for the 16 MHz board variant.
# See http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega2560
# lfuse 0xff - external oscillator
# hfuse 0xd8
# efuse 0xfd - BOD Level 1 = 2.7V
: "${WII5_AVRDUDE:=avrdude}"
CONFIGFILE=./avrdude.conf
BOOT_HEX=./optiboot_flash_atmega2560_UART0_230400_11059200L_BIGBOOT.hex
"$WII5_AVRDUDE" \
-C"$CONFIGFILE" -v \
-v \
-patmega2560 \
-cstk500v2 \
-Pusb \
-Uflash:w:ledflash_16mhz.ino.hex:i \
-Uboot:w:"$BOOT_HEX":i \
-Ulock:w:0
Binary file not shown.
File diff suppressed because it is too large Load Diff
-18
View File
@@ -1,18 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Burn only the bootloader via ICSP (no application).
: "${WII5_AVRDUDE:=avrdude}"
"$WII5_AVRDUDE" \
-C./avrdude.conf \
-v \
-patmega2560 \
-cstk500v2 \
-Pusb \
-Ulock:w:0x0F:m \
-Uflash:w:optiboot_flash_atmega2560_UART0_230400_11059200L_BIGBOOT.hex
-7
View File
@@ -1,7 +0,0 @@
# Reference snippet (not directly executable): the avrdude command for
# burning the stk500v2 mega2560 bootloader. Use parameterized scripts in this
# directory instead.
#
# avrdude -C <avrdude.conf> -v -patmega2560 -cstk500v2 -Pusb \
# -Uflash:w:<path to stk500boot_v2_mega2560.hex>:i \
# -Ulock:w:0x0F:m
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Verify the WII5 sketch with the local Arduino IDE, then rsync the resulting
# .hex to a remote build host.
# Usage: upload.sh <remote-host>
# - the remote-side ssh user is taken from $WII5_REMOTE_USER (default: wii)
# - the local Arduino build dir is ~/Arduino/build by default; override with
# $WII5_BUILD_DIR.
: "${WII5_REMOTE_USER:=wii}"
: "${WII5_BUILD_DIR:=$HOME/Arduino/build}"
: "${WII5_ARDUINO_BIN:=arduino}"
set -e
REMOTE=$1
[ -z "$REMOTE" ] && { echo "Usage: $0 <remote-host>"; exit 1; }
rm -f "$WII5_BUILD_DIR/wii5_buoy.ino.hex"
"$WII5_ARDUINO_BIN" --verify app/wii5_buoy/wii5_buoy.ino \
--board WII:5.1.0:wii5_v2_2560_3V:cpu=atmega25603V3_11MHz230400 -v
rsync -av "$WII5_BUILD_DIR/wii5_buoy.ino.hex" "$WII5_REMOTE_USER@$REMOTE:~/"
-27
View File
@@ -1,27 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Burn WII5 application + bootloader via ICSP.
# See http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega2560
# lfuse 0xff - external oscillator
# hfuse 0xd8
# efuse 0xfd - BOD Level 1 = 2.7V
: "${WII5_AVRDUDE:=avrdude}"
FULL_HEX=wii5_buoy_latest.hex
CONFIGFILE=./avrdude.conf
BOOT_HEX=optiboot_flash_atmega2560_UART0_230400_11059200L_BIGBOOT.hex
"$WII5_AVRDUDE" \
-C"$CONFIGFILE" -v \
-v \
-patmega2560 \
-cstk500v2 \
-Pusb \
-Uflash:w:"$FULL_HEX":i \
-Uboot:w:"$BOOT_HEX":i \
-Ulock:w:0
-30
View File
@@ -1,30 +0,0 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
//
// This file is part of WII5 Buoy firmware.
// See LICENSE for full terms.
#define BitVal(data,y) ( (data>>y) & 1) /** Return Data.Y value **/
#define SetBit(data,y) data |= (1 << y) /** Set Data.Y to 1 **/
#define ClearBit(data,y) data &= ~(1 << y) /** Clear Data.Y to 0 **/
#include <stdio.h>
#include <stdint.h>
int main() {
uint32_t out = 0;
// Main header - where am I, what is my voltss
SetBit(out, 1);
// Standard WII output
SetBit(out, 11);
SetBit(out, 12);
SetBit(out, 13);
SetBit(out, 14);
printf("New Number = %d\n", out);
return(0);
}
-32
View File
@@ -1,32 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Verify a single test sketch under test/<TEST>/<TEST>.ino.
# Configure with env vars:
: "${WII5_ARDUINO_BIN:=arduino}"
: "${WII5_BUILD_DIR:?set to your Arduino build dir}"
: "${WII5_FIRMWARE_REPO:?path to firmware-archive git repo}"
set -e
TEST=$1
[ -z "$TEST" ] && { echo "Usage: $0 <test-name>"; exit 1; }
echo "Building test/$TEST"
# TODO: Inject WII5_SOFTWARE_VERSION via --pref compiler.cpp.extra_flags
"$WII5_ARDUINO_BIN" \
--verify "test/$TEST/$TEST.ino" \
--board WII:avr:wii5_v2_2560_3V:cpu=atmega25603V3_11MHz230400
sleep 1
cp "$WII5_BUILD_DIR/$TEST.ino.hex" "$WII5_FIRMWARE_REPO/"
pushd "$WII5_FIRMWARE_REPO/"
git add "$TEST.ino.hex"
git commit -am "Auto build for TEST = $TEST"
git push
popd
-22
View File
@@ -1,22 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Verify the sketch with the Arduino IDE, then rsync the resulting hex to a
# remote build host. Configure with env vars (or copy to a *.local.sh and edit):
: "${WII5_ARDUINO_BIN:=arduino}" # path to Arduino IDE binary
: "${WII5_BUILD_DIR:?set to your Arduino build dir}"
: "${WII5_AVRDUDE_CONF:?path to avrdude.conf}"
: "${WII5_REMOTE:?e.g. user@host}"
: "${WII5_REMOTE_PORT:=22}"
"$WII5_ARDUINO_BIN" \
--verify app/wii5_buoy/wii5_buoy.ino \
--board WII:avr:wii5_v2_2560_3V:cpu=atmega25603V3_11MHz230400
rsync -av -e "ssh -p $WII5_REMOTE_PORT" \
"$WII5_AVRDUDE_CONF" "$WII5_BUILD_DIR"/*.hex \
"$WII5_REMOTE:~/firmware/"
-67
View File
@@ -1,67 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Build a versioned firmware hex and (optionally) commit it into a separate
# firmware-archive repo.
#
# Usage: build_version.sh [VERSION_TAG]
# - With VERSION_TAG: checks out that tag, builds, names the hex
# wii5_buoy_<VERSION_TAG>.hex, also creates wii5_buoy_latest.hex symlink.
# - Without: builds the current HEAD as a 'dev' build.
#
# Configure via env vars:
: "${WII5_BUILD_DIR:?set to your Arduino build dir}"
: "${WII5_FIRMWARE_REPO:?path to firmware-archive git repo}"
: "${WII5_ARDUINO_BIN:=arduino}"
set -e
VERSION=$1
SHORT=$(git log -1 --pretty=format:%h)
VERSION_STRING="WII5Buoy_$VERSION"
LINK=""
INTVER=""
if [[ $VERSION == '' ]]
then
# TODO: keep versions with SHORT and link "latest" -> latest dev
VERSION_STRING="WII5Buoy_dev_$SHORT"
VERSION="dev"
INTVER="3"
else
git checkout $VERSION
LINK="latest"
INTVER=$(perl tools/integer_version.pl $VERSION)
fi
echo "Getting and Building $VERSION with $VERSION_STRING"
"$WII5_ARDUINO_BIN" \
--pref compiler.cpp.extra_flags="-DWII5_SOFTWARE_VERSION=\"$VERSION_STRING\" -DWII5_SOFTWARE_COMMIT=\"$SHORT\" -DWII5_SOFTWARE_INTVER=$INTVER" \
--verify app/wii5_buoy/wii5_buoy.ino \
--board WII:avr:wii5_v2_2560_3V:cpu=atmega25603V3_11MHz230400
sleep 1
pushd "$WII5_FIRMWARE_REPO"
git pull
cp "$WII5_BUILD_DIR/wii5_buoy.ino.hex" "$WII5_FIRMWARE_REPO/wii5_buoy_$VERSION.hex"
if [[ $LINK == '' ]]
then
echo "No link to DEV"
else
echo "Creating link to latest"
touch wii5_buoy_$LINK.hex
rm wii5_buoy_$LINK.hex
ln -s wii5_buoy_$VERSION.hex wii5_buoy_$LINK.hex
git add wii5_buoy_$LINK.hex
fi
git add wii5_buoy_$VERSION.hex
git commit -am "Auto build $VERSION $VERSION_STRING"
git push
popd
git checkout master
-74
View File
@@ -1,74 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Copy the Arduino libraries this project depends on into a target directory
# (typically your project's src/ tree, or an arduino-cli libraries dir).
#
# Configure with env vars:
: "${WII5_LIB_SRC:?source dir holding all the Arduino library trees, e.g. ~/Arduino/libraries}"
: "${WII5_LIB_DEST:?destination dir, e.g. ./src or ~/Arduino/libraries}"
cd "$WII5_LIB_SRC"
rsync -av \
ADS1247 \
AltSoftSerial \
Arduino-EEPROMex \
ArduinoUniqueID \
Arduino_JSON \
ButtonEvent \
CRC32 \
CalLib \
DCF77 \
DS1307RTC \
DS3231 \
DS3231RTC \
DS3232RTC \
DallasTemperature \
DueFlash \
Enerlib \
FTRGBLED \
Filters \
I2C \
I2Cdev \
IridiumSBD \
LowPower \
Manchester \
MemoryFree \
OneWire \
PCM \
PushButton \
RFM69 \
RTArduLink \
RTC \
RTCTimedEvent \
RTClib \
RTIMULib \
RunningMedian \
SDBlock \
SDCore \
SFE_BMP180 \
SPIFlash \
SdFat \
Sensirion \
SoftReset \
Statistic \
TemperatureController \
Time \
TimeAlarms \
TimedEvent \
TimerOne \
TinyGPS \
TinyGPSPlus \
TrueRandom-master \
Ultrasonic \
XModem \
elapsedMillis \
keypad \
RadioHead \
SdFs \
"$WII5_LIB_DEST/"
-2
View File
@@ -1,2 +0,0 @@
dozygen
moxygen -f -o 'doc/api.md' doc/api/xml/
-37
View File
@@ -1,37 +0,0 @@
#!/usr/bin/perl
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
my $ver = $ARGV[0];
@BITS = split(/\./, $ver);
$BITS[0] = substr($BITS[0],1);
#print join("\n", @BITS) . "\n";
my $newval = (65536 * $BITS[0]);
$newval = $newval + (256 * $BITS[1]);
$newval = $newval + $BITS[2];
print $newval . "\n";
__END__
if ($ver =~ /(\d+)\.(\d+)\.(\d+)/) {
my $p1 = $1+0; my $p2 = $2+0; my $p3 = $3+0;
print "$p1 $p2 $p3\n";
my $F1 = $p1*(2^16);
print $F1 . "\n";
my $F2 = $p2*(2^8);
print "$F1 $F2 $F3\n";
my $F3 = $p3;
print "$F1 $F2 $F3\n";
print "$F1 $F2 $F3\n";
my $ver = $F1 + $F2 + $F3;
$ver = ($p1*(2^16))+($p2*(2^8))+$p3;
print $ver . "\n";
}
else {
$ver = 0;
}
-19
View File
@@ -1,19 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Pull the latest from each related repo. Configure with env vars; missing
# vars are skipped silently so this works regardless of which repos you have
# checked out locally.
set -e
for d in "$WII5_LIB_REPO" "$WII5_SDBLOCK_REPO" "$WII5_BINARY_REPO" "$WII5_BUOY_REPO"; do
[ -n "$d" ] && [ -d "$d" ] || continue
pushd "$d" >/dev/null
git pull
popd >/dev/null
done
-42
View File
@@ -1,42 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
#get highest tag number
VERSION=`git describe --abbrev=0 --tags`
SHORT=$(git log -1 --pretty=format:%h)
#replace . with space so can split into an array
VERSION_BITS=(${VERSION//./ })
#get number parts and increase last one by 1
VNUM1=${VERSION_BITS[0]}
VNUM2=${VERSION_BITS[1]}
VNUM3=${VERSION_BITS[2]}
VNUM3=$((VNUM3+1))
#create new tag
NEW_TAG="$VNUM1.$VNUM2.$VNUM3"
echo "Updating $VERSION to $NEW_TAG"
#get current hash and see if it already has a tag
GIT_COMMIT=`git rev-parse HEAD`
NEEDS_TAG=`git describe --contains $GIT_COMMIT 2>/dev/null`
#only tag if no tag already
if [ -z "$NEEDS_TAG" ]; then
echo "version=$NEW_TAG" > VERSION
echo "short=$SHORT" >> VERSION
git add VERSION
git commit -m 'Auto update version file'
git tag $NEW_TAG
echo "Tagged with $NEW_TAG"
git push --tags
else
echo "Already a tag on this commit"
fi
-21
View File
@@ -1,21 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Flash the most-recently-built local hex via the standard arduino bootloader.
# Configure with env vars:
: "${WII5_SERIAL:=/dev/ttyUSB0}"
: "${WII5_FULL_HEX:?path to wii5_buoy.ino.hex}"
: "${WII5_AVRDUDE:=avrdude}"
: "${WII5_AVRDUDE_CONF:?path to avrdude.conf}"
"$WII5_AVRDUDE" \
-C"$WII5_AVRDUDE_CONF" -v \
-patmega2560 \
-carduino \
-P"$WII5_SERIAL" -b230400 \
-D \
-Uflash:w:"$WII5_FULL_HEX":i
-17
View File
@@ -1,17 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
# Upload built firmware to a remote build host.
# Set these env vars (or copy this file to upload.local.sh and edit):
: "${WII5_BUILD_DIR:?set to your Arduino build dir, e.g. ~/Documents/Arduino/Build}"
: "${WII5_AVRDUDE_CONF:?path to avrdude.conf}"
: "${WII5_REMOTE:?e.g. user@host}"
: "${WII5_REMOTE_PORT:=22}"
rsync -av -e "ssh -p $WII5_REMOTE_PORT" \
"$WII5_AVRDUDE_CONF" "$WII5_BUILD_DIR"/*.hex \
"$WII5_REMOTE:~/firmware/"
-14
View File
@@ -1,14 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
#
# This file is part of WII5 Buoy firmware.
# See LICENSE for full terms.
VERSION=$1
SHORT=$(git log -1 --pretty=format:%h)
VERSION_STRING="WII5Buoy_$VERSION"
echo "VERSION=$VERSION"
echo "SHORT=$SHORT"
echo "VERSION_STRING=$VERSION_STRONG"