Smarter build
Mockband / build (push) Successful in 20s Details

`arduino-builder` lets you override stuff from `boards.txt`.
That's nice, because the way I was doing it before was bananas.
This commit is contained in:
Neale Pickett 2024-01-04 23:07:43 -07:00
parent 784758ca09
commit 7f32dec9f3
3 changed files with 18 additions and 20 deletions

View File

@ -11,36 +11,36 @@ cd $(dirname $0)/..
mkdir -p out/ mkdir -p out/
while read vid pid variant; do while read variant vid pid flags; do
log log
log Building $vid $pid $product log Building $vid $pid $product
log log
## This is bananas. # We can overload build.extra_flags from boards.txt,
# so just specify the -D flags to gcc
flags="$flags -DUSB_VID=$vid -DUSB_PID=$pid"
flags="$flags -DUSB_MANUFACTURER=\"woozle.org\""
flags="$flags \"-DUSB_PRODUCT=\"Mockband $variant\"\"" # wtf quoting
flags="$flags -DCDC_DISABLED"
# Arduino gets cranky when it tries to use its own cache
rm -rf build/ rm -rf build/
mkdir -p build/cache/ mkdir -p build/cache/
cp -rL /usr/share/arduino /usr/share/arduino-builder build/ || true # there's a cyclic symlink that causes failure
sed -i "
/leonardo.build.vid/ s/=.*/=$vid/
/leonardo.build.pid/ s/=.*/=$pid/
/leonardo.build.usb_product/ s/=.*/=\"Mockband $variant\"/
" build/arduino/hardware/arduino/avr/boards.txt
grep 'leonardo.build' build/arduino/hardware/arduino/avr/boards.txt
arduino-builder \ arduino-builder \
-fqbn arduino:avr:leonardo \
-build-path $(pwd)/build/ \ -build-path $(pwd)/build/ \
-build-cache $(pwd)/build/cache/ \ -build-cache $(pwd)/build/cache/ \
-hardware build/arduino/hardware \ -fqbn arduino:avr:leonardo \
-tools build/arduino/tools \ -hardware /usr/share/arduino/hardware \
-tools /usr/share/arduino/tools \
-prefs="build.extra_flags=$flags" \
-compile MockBand.ino -compile MockBand.ino
mv build/MockBand.ino.hex out/MockBand.$variant.hex mv build/MockBand.ino.hex out/MockBand.$variant.hex
find out build/cache
done << EOD done << EOD
0x1bad 0x0004 guitar guitar 0x1bad 0x0004
0x1bad 0x3110 drums guitar-wammy 0x1bad 0x0004 -DWAMMY
drums 0x1bad 0x3110
EOD EOD
ls -l out/ ls -l out/

View File

@ -8,7 +8,7 @@ jobs:
PACKAGE_API_TOKEN: ${PACKAGE_API_TOKEN} PACKAGE_API_TOKEN: ${PACKAGE_API_TOKEN}
steps: steps:
- name: check out repository - name: check out repository
run: git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY . run: git clone -b $GITHUB_REF_NAME $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .
- name: build - name: build
run: .gitea/build.sh run: .gitea/build.sh
- name: publish - name: publish

View File

@ -96,9 +96,6 @@ void loop() {
uint16_t silence[npins] = {0}; uint16_t silence[npins] = {0};
while (1) { while (1) {
#ifdef WAMMY
unsigned long now = millis();
#endif
uint16_t edge = 0; uint16_t edge = 0;
samples++; samples++;
@ -115,6 +112,7 @@ void loop() {
// We've sampled everything. Is it time to do calculations and USB? // We've sampled everything. Is it time to do calculations and USB?
#ifdef WAMMY #ifdef WAMMY
unsigned long now = millis();
if (!edge && (next > now)) { if (!edge && (next > now)) {
continue; continue;
} }