Initial public release of WII5 Buoy firmware
Firmware for an autonomous wave-measurement buoy (ATmega2560-based WII5 v2 board). Reads wave motion from a Sparton AHRS-M1/M2 IMU, samples GPS and battery state, and reports back over Iridium SBD satellite telemetry. Originally developed 2012-2024. This is the first public release. Code, documentation, and field-tested operating modes (Capture, Sleep, Position, ManualTest, SelfTest, LowBattery) are licensed under Apache 2.0 — see LICENSE and NOTICE. See README.md for an overview and build instructions, CONTRIBUTING.md for how to contribute, and DEPLOYMENTS.md for the field-deployment log.
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
# 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
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/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.
+15874
File diff suppressed because it is too large
Load Diff
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/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
|
||||
@@ -0,0 +1,7 @@
|
||||
# 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
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/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:~/"
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/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
|
||||
@@ -0,0 +1,30 @@
|
||||
// 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);
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/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 and flash the WII5 Buoy firmware locally. Configure via env vars:
|
||||
: "${WII5_SERIAL:?set to your serial port, e.g. /dev/ttyUSB0}"
|
||||
: "${WII5_FULL_HEX:?path to the built .hex file, e.g. \$BUILD_DIR/wii5_buoy.ino.hex}"
|
||||
: "${WII5_AVRDUDE_CONF:?path to avrdude.conf}"
|
||||
: "${WII5_ARDUINO_BIN:=arduino}"
|
||||
: "${WII5_AVRDUDE_BIN:=avrdude}"
|
||||
|
||||
set -e
|
||||
|
||||
VERSION="dev"
|
||||
SHORT=$(git log -1 --pretty=format:%h)
|
||||
VERSION_STRING="WII5Buoy_$SHORT"
|
||||
|
||||
# TODO: Inject VERSION via build_local.sh argument or VERSION header file
|
||||
"$WII5_ARDUINO_BIN" \
|
||||
--pref compiler.cpp.extra_flags="-DWII5_SOFTWARE_VERSION=\"$VERSION_STRING\" -DWII5_SOFTWARE_COMMIT=\"$SHORT\" " \
|
||||
--verify app/wii5_buoy/wii5_buoy.ino \
|
||||
--board WII:avr:wii5_v2_2560_3V:cpu=atmega25603V3_11MHz230400
|
||||
|
||||
sleep 1
|
||||
|
||||
"$WII5_AVRDUDE_BIN" \
|
||||
-C"$WII5_AVRDUDE_CONF" -v \
|
||||
-patmega2560 \
|
||||
-carduino \
|
||||
-P"$WII5_SERIAL" -b230400 \
|
||||
-D \
|
||||
-Uflash:w:"$WII5_FULL_HEX":i
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/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
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/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/"
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/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
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
#!/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/"
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/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 application + bootloader to an ATmega2560 over an ICSP programmer
|
||||
# (e.g. AVRISP mkII / Atmel STK500v2).
|
||||
#
|
||||
# Configure these env vars:
|
||||
: "${WII5_AVRDUDE:?path to avrdude binary}"
|
||||
: "${WII5_AVRDUDE_CONF:?path to avrdude.conf}"
|
||||
: "${WII5_FULL_HEX:?path to wii5_buoy.ino.hex}"
|
||||
: "${WII5_BOOT_HEX:?path to optiboot bootloader hex}"
|
||||
|
||||
"$WII5_AVRDUDE" \
|
||||
-C"$WII5_AVRDUDE_CONF" -v \
|
||||
-patmega2560 \
|
||||
-cstk500v2 \
|
||||
-Pusb \
|
||||
-D \
|
||||
-Uflash:w:"$WII5_FULL_HEX" \
|
||||
-Uboot:w:"$WII5_BOOT_HEX" \
|
||||
-Ulock:w:0x0F:m
|
||||
|
||||
# Notes:
|
||||
# To set fuses on a fresh chip:
|
||||
# avrdude ... -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xd6:m -Ulfuse:w:0xf7:m
|
||||
# Then to flash bootloader + app, run this script.
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/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;
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
#!/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.
|
||||
|
||||
# Group ELF symbols by subsystem (Network, Storage, Sparton, GPS, Iridium,
|
||||
# Serial, Console, Sh3d, WII5, Other) and report sizes. Useful for understanding
|
||||
# where the firmware is spending its program/data memory.
|
||||
#
|
||||
# Configure with env vars:
|
||||
# WII5_AVR_READELF = path to avr-readelf binary
|
||||
# WII5_ELF = path to wii5_buoy.ino.elf
|
||||
#
|
||||
# Usage: WII5_AVR_READELF=... WII5_ELF=... perl tools/memory.pl [items_max]
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::Dumper;
|
||||
|
||||
my $items_max = $ARGV[0] || 0;
|
||||
my $exe_read = $ENV{WII5_AVR_READELF} or die "WII5_AVR_READELF not set\n";
|
||||
my $elf = $ENV{WII5_ELF} or die "WII5_ELF not set\n";
|
||||
|
||||
my $fh;
|
||||
open ($fh, "$exe_read -a $elf |grep OBJECT |") or die "Cannot run readelf: $!\n";
|
||||
|
||||
my $grouped = {
|
||||
Serial => {total => 0, items => {}},
|
||||
Network => {total => 0, items => {}},
|
||||
Console => {total => 0, items => {}},
|
||||
Sh3d => {total => 0, items => {}},
|
||||
Storage => {total => 0, items => {}},
|
||||
Sparton => {total => 0, items => {}},
|
||||
GPS => {total => 0, items => {}},
|
||||
Iridium => {total => 0, items => {}},
|
||||
WII5 => {total => 0, items => {}},
|
||||
Other => {total => 0, items => {}},
|
||||
};
|
||||
|
||||
while (<$fh>) {
|
||||
chomp;
|
||||
# Sample line layout (column-aligned):
|
||||
# 1815: 00801796 1 OBJECT GLOBAL HIDDEN 3 _ZN7TwoWire12transmitting
|
||||
|
||||
my $size = substr($_, 16, 6);
|
||||
my $name = substr($_, 51, 100);
|
||||
|
||||
if (
|
||||
($name =~ /network/i)
|
||||
|| ($name =~ /radio/i)
|
||||
) {
|
||||
$grouped->{Network}{total} += $size;
|
||||
$grouped->{Network}{items}{$name} = $size;
|
||||
}
|
||||
elsif (
|
||||
($name =~ /storage/i)
|
||||
|| ($name =~ /Sd/)
|
||||
) {
|
||||
$grouped->{Storage}{total} += $size;
|
||||
$grouped->{Storage}{items}{$name} = $size;
|
||||
}
|
||||
elsif ($name =~ /sparton/i) {
|
||||
$grouped->{Sparton}{total} += $size;
|
||||
$grouped->{Sparton}{items}{$name} = $size;
|
||||
}
|
||||
elsif ($name =~ /gps/i) {
|
||||
$grouped->{GPS}{total} += $size;
|
||||
$grouped->{GPS}{items}{$name} = $size;
|
||||
}
|
||||
elsif ($name =~ /iridium/i) {
|
||||
$grouped->{Iridium}{total} += $size;
|
||||
$grouped->{Iridium}{items}{$name} = $size;
|
||||
}
|
||||
elsif ($name =~ /serial/i) {
|
||||
$grouped->{Serial}{total} += $size;
|
||||
$grouped->{Serial}{items}{$name} = $size;
|
||||
}
|
||||
elsif ($name =~ /console/i) {
|
||||
$grouped->{Console}{total} += $size;
|
||||
$grouped->{Console}{items}{$name} = $size;
|
||||
}
|
||||
elsif ($name =~ /sh3d/i) {
|
||||
$grouped->{Sh3d}{total} += $size;
|
||||
$grouped->{Sh3d}{items}{$name} = $size;
|
||||
}
|
||||
elsif ($name =~ /wii5/i) {
|
||||
$grouped->{WII5}{total} += $size;
|
||||
$grouped->{WII5}{items}{$name} = $size;
|
||||
}
|
||||
else {
|
||||
$grouped->{Other}{total} += $size;
|
||||
$grouped->{Other}{items}{$name} = $size;
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $group_key (sort {$grouped->{$b}{total} <=> $grouped->{$a}{total} } keys %$grouped) {
|
||||
print "$group_key => " . $grouped->{$group_key}{total} . "\n";
|
||||
my $item_count = 0;
|
||||
foreach my $item_key (
|
||||
sort {
|
||||
$grouped->{$group_key}{items}{$b} <=> $grouped->{$group_key}{items}{$a}
|
||||
} keys %{$grouped->{$group_key}{items}}
|
||||
) {
|
||||
if ($item_count < $items_max) {
|
||||
print " $item_key => " . $grouped->{$group_key}{items}{$item_key} . "\n";
|
||||
}
|
||||
$item_count++;
|
||||
}
|
||||
}
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/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
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/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
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/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
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/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/"
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/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"
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/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.
|
||||
|
||||
# Smoke-verify that the main sketch compiles cleanly.
|
||||
: "${WII5_ARDUINO_BIN:=arduino}"
|
||||
|
||||
# TODO: pass WII5_SOFTWARE_VERSION via --pref compiler.cpp.extra_flags
|
||||
"$WII5_ARDUINO_BIN" \
|
||||
--verify app/wii5_buoy/wii5_buoy.ino \
|
||||
--board WII:avr:wii5_v2_2560_3V:cpu=atmega25603V3_11MHz230400 \
|
||||
-v
|
||||
Reference in New Issue
Block a user