-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbuild_all_firmwares.sh
More file actions
124 lines (97 loc) · 4.06 KB
/
build_all_firmwares.sh
File metadata and controls
124 lines (97 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
# Automated build script for all Pico-286 firmware variations.
# This script iterates through all platforms, display options, audio options,
# and memory configurations to build every possible firmware combination.
# Exit immediately if a command exits with a non-zero status.
set -e
# Set PICOTOOL_FETCH_FROM_GIT_PATH to /tmp to avoid issues with git dependencies
export PICOTOOL_FETCH_FROM_GIT_PATH=/tmp
# --- Build Configuration ---
# Platforms to build for
PLATFORMS=("rp2040" "rp2350")
# Display options (mutually exclusive)
DISPLAYS=("TFT" "VGA" "HDMI")
# Audio options (mutually exclusive)
AUDIOS=("I2S_SOUND" "PWM_SOUND" "HARDWARE_SOUND")
# Virtual Memory size in kilobytes to use for VM builds
VM_KBS="8192"
# Get the number of processor cores to use for parallel builds
NPROC=$(nproc)
# Build type for Pico builds is hardcoded to MinSizeRel in CMakeLists.txt
BUILD_TYPE="MinSizeRel"
# --- Release Directory Setup ---
RELEASE_DIR="release"
echo "Creating release directory: ${RELEASE_DIR}"
mkdir -p "${RELEASE_DIR}"
# --- Build Process ---
echo "Starting build process for all firmware variations..."
# Loop through each platform
for platform in "${PLATFORMS[@]}"; do
build_dir="build-${platform}"
echo "----------------------------------------------------------------"
echo "Processing platform: ${platform} in build directory: ${build_dir}"
echo "----------------------------------------------------------------"
mkdir -p "${build_dir}"
cd "${build_dir}"
for display in "${DISPLAYS[@]}"; do
for audio in "${AUDIOS[@]}"; do
# --- Build with default external PSRAM ---
echo "Building for ${platform} with ${display}, ${audio}, and default PSRAM..."
rm -f CMakeCache.txt
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DPICO_PLATFORM=${platform} \
-DENABLE_${display}=ON \
-DENABLE_${audio}=ON \
-DTOTAL_VIRTUAL_MEMORY_KBS=0 \
-DONBOARD_PSRAM=OFF \
..
make -j${NPROC}
# --- Build with Virtual Memory (Swap File) ---
echo "Building for ${platform} with ${display}, ${audio}, and Virtual Memory..."
rm -f CMakeCache.txt
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DPICO_PLATFORM=${platform} \
-DENABLE_${display}=ON \
-DENABLE_${audio}=ON \
-DTOTAL_VIRTUAL_MEMORY_KBS=${VM_KBS} \
-DONBOARD_PSRAM=OFF \
..
make -j${NPROC}
# --- RP2350-specific builds ---
if [ "${platform}" == "rp2350" ]; then
# --- Build with Onboard PSRAM ---
echo "Building for ${platform} with ${display}, ${audio}, and Onboard PSRAM..."
rm -f CMakeCache.txt
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DPICO_PLATFORM=${platform} \
-DENABLE_${display}=ON \
-DENABLE_${audio}=ON \
-DTOTAL_VIRTUAL_MEMORY_KBS=0 \
-DONBOARD_PSRAM=ON \
..
make -j${NPROC}
fi
done
done
cd ..
done
# --- Copy Artifacts to Release Directory ---
echo "----------------------------------------------------------------"
echo "Copying all firmware files to ${RELEASE_DIR}..."
for platform in "${PLATFORMS[@]}"; do
if [ "${platform}" == "rp2350" ]; then
src_dir="bin/rp2350-arm-s/${BUILD_TYPE}"
else
src_dir="bin/${platform}/${BUILD_TYPE}"
fi
if [ -d "${src_dir}" ]; then
echo "Copying firmware from ${src_dir}"
cp "${src_dir}"/*.uf2 "${RELEASE_DIR}/"
else
echo "Warning: Source directory ${src_dir} not found. Skipping copy."
fi
done
echo "----------------------------------------------------------------"
echo "All builds completed successfully."
echo "Firmware files are in the '${RELEASE_DIR}' directory."
echo "----------------------------------------------------------------"