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/
while read vid pid variant; do
while read variant vid pid flags; do
log
log Building $vid $pid $product
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/
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 \
-fqbn arduino:avr:leonardo \
-build-path $(pwd)/build/ \
-build-cache $(pwd)/build/cache/ \
-hardware build/arduino/hardware \
-tools build/arduino/tools \
-fqbn arduino:avr:leonardo \
-hardware /usr/share/arduino/hardware \
-tools /usr/share/arduino/tools \
-prefs="build.extra_flags=$flags" \
-compile MockBand.ino
mv build/MockBand.ino.hex out/MockBand.$variant.hex
find out build/cache
done << EOD
0x1bad 0x0004 guitar
0x1bad 0x3110 drums
guitar 0x1bad 0x0004
guitar-wammy 0x1bad 0x0004 -DWAMMY
drums 0x1bad 0x3110
EOD
ls -l out/

View File

@ -8,7 +8,7 @@ jobs:
PACKAGE_API_TOKEN: ${PACKAGE_API_TOKEN}
steps:
- 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
run: .gitea/build.sh
- name: publish

View File

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