pico-mac/fruitjam-build.sh
Jeff Epler 7fc9037604 There's audio, but it's glitched.
it only works at all with 128k or 256k non-psram builds

you can hear the beep when you adjust the slider in control panel, but
there's other audio overlaid on it that is kind of a weird descending tone,
very regular in nature.

The sample rate is set to 20k not 22.255k because of my i2s dac not
liking random sample rates.

Instead of using the i2s dac on the fruit jam, this uses A0 (data),
A1 (lrck), A2 (bclk). It's not super convenient, and it's hard coded.
2025-03-20 13:10:48 -05:00

77 lines
2.3 KiB
Bash
Executable file

#!/bin/sh
set -e
# Some configurations that actually work at the time I committed this:
# ./fruitjam-build.sh -v # vga resolution, no psram, 128KiB
# ./fruitjam-build.sh -v -m448 # vga resolution, no psram, 448KiB
# ./fruitjam-build.sh -m4096 # 512x342 resolution, psram, 4096KiB
# ./fruitjam-build.sh -d disk.img # specify disk image
DISP_WIDTH=512
DISP_HEIGHT=342
MEMSIZE=400
DISK_IMAGE=""
CMAKE_ARGS=
while getopts "hvd:m:" o; do
case "$o" in
(v)
DISP_WIDTH=640
DISP_HEIGHT=480
CMAKE_ARGS="$CMAKE_ARGS -DUSE_VGA_RES=1 -DHSTX_CKP=12 -DHSTX_D0P=14 -DHSTX_D1P=16 -DHSTX_D2P=18"
;;
(m)
MEMSIZE=$OPTARG
;;
(d)
DISK_IMAGE=$OPTARG
;;
(h|?)
echo "Usage: $0 [-v] [-m KiB] [-d diskimage]"
echo ""
echo " -v: Use framebuffer resolution 640x480 instead of 512x342"
echo " -m: Set memory size in KiB"
echo " -d: Specify disk image to include"
echo ""
echo "PSRAM is automatically set depending on memory & framebuffer details"
exit
;;
esac
done
shift $((OPTIND-1))
TAG=fruitjam_${DISP_WIDTH}x${DISP_HEIGHT}_${MEMSIZE}k
PSRAM=$((MEMSIZE > 448 || DISP_WIDTH < 640))
if [ $PSRAM -ne 0 ] ; then
TAG=${TAG}_psram
CMAKE_ARGS="$CMAKE_ARGS -DUSE_PSRAM=1"
fi
# Append disk name to build directory if disk image is specified
if [ -n "$DISK_IMAGE" ] && [ -f "$DISK_IMAGE" ]; then
# Extract filename without extension
DISK_NAME=$(basename "$DISK_IMAGE" | sed 's/\.[^.]*$//')
TAG=${TAG}_${DISK_NAME}
fi
set -x
make -C external/umac clean
make -C external/umac DISP_WIDTH=${DISP_WIDTH} DISP_HEIGHT=${DISP_HEIGHT} MEMSIZE=${MEMSIZE}
rm -f rom.bin
./external/umac/main -r '4D1F8172 - MacPlus v3.ROM' -W rom.bin || true
[ -f rom.bin ]
xxd -i < rom.bin > incbin/umac-rom.h
if [ -n "$DISK_IMAGE" ] && [ -f "$DISK_IMAGE" ]; then
xxd -i < "$DISK_IMAGE" > incbin/umac-disc.h
fi
rm -rf build_${TAG}
cmake -S . -B build_${TAG} \
-DPICO_SDK_PATH=../pico-sdk \
-DPICOTOOL_FETCH_FROM_GIT_PATH="$(pwd)/picotool" \
-DBOARD=adafruit_fruit_jam -DPICO_BOARD=adafruit_fruit_jam \
-DMEMSIZE=${MEMSIZE} \
-DUSE_HSTX=1 \
-DSD_TX=35 -DSD_RX=36 -DSD_SCK=34 -DSD_CS=39 -DUSE_SD=1 \
${CMAKE_ARGS} "$@"
make -C build_${TAG} -j$(nproc)