touch with abtraction working, SD is not working

This commit is contained in:
Adolfo Reyna
2026-01-28 23:23:49 -05:00
parent adfbef7228
commit d19a2ca639
13 changed files with 756 additions and 209 deletions

View File

@@ -8,16 +8,30 @@ set -e # Exit on error
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="${PROJECT_DIR}/build"
UF2_FILE="${BUILD_DIR}/basic1.uf2"
NINJA="${HOME}/.pico-sdk/ninja/v1.12.1/ninja"
echo "=========================================="
echo " Pico RP2350 Build and Flash Script"
echo "=========================================="
echo ""
# Check if build directory exists and has build.ninja
if [ ! -f "${BUILD_DIR}/build.ninja" ]; then
echo "⚠ Build not configured. Running cmake..."
cd "${PROJECT_DIR}"
cmake -B build -G Ninja -DPICO_BOARD=adafruit_feather_rp2350
echo ""
fi
# Step 1: Build the project
echo "Step 1: Building project..."
cd "${BUILD_DIR}"
make -j4
if [ -f "${NINJA}" ]; then
"${NINJA}"
else
ninja
fi
if [ $? -ne 0 ]; then
echo "❌ Build failed!"
@@ -36,75 +50,34 @@ fi
echo "UF2 file created: ${UF2_FILE}"
echo ""
# Step 2: Flash to board
echo "Step 2: Flashing to board..."
# Step 2: Flash to board using picotool
echo "Step 2: Flashing to board using picotool..."
echo "Make sure your board is connected and in BOOTSEL mode"
echo "(Hold BOOTSEL button while plugging in USB)"
echo ""
echo "Choose flashing method:"
echo " 1) Use picotool (board must be connected and in BOOTSEL mode)"
echo " 2) Manual copy (mount board as USB drive and copy UF2)"
echo ""
read -p "Enter choice (1 or 2): " choice
case $choice in
1)
echo ""
echo "Using picotool to flash..."
echo "Make sure your board is connected and in BOOTSEL mode"
echo "(Hold BOOTSEL button while plugging in USB)"
echo ""
read -p "Press Enter when ready..."
PICOTOOL="${HOME}/.pico-sdk/picotool/2.2.0-a4/picotool/picotool"
if [ ! -f "${PICOTOOL}" ]; then
echo "❌ picotool not found at: ${PICOTOOL}"
exit 1
fi
# Try to load the UF2
"${PICOTOOL}" load "${UF2_FILE}" -fx
if [ $? -eq 0 ]; then
echo ""
echo "✓ Successfully flashed to board!"
echo "✓ Board will automatically reboot and run the program"
else
echo ""
echo "❌ Flash failed! Make sure:"
echo " - Board is in BOOTSEL mode (hold BOOTSEL while plugging in)"
echo " - USB cable is connected"
echo " - You have permission to access USB devices"
fi
;;
2)
echo ""
echo "Manual copy instructions:"
echo "1. Hold BOOTSEL button on your board"
echo "2. Plug in USB cable (or press RESET while holding BOOTSEL)"
echo "3. Board should appear as USB drive (RPI-RP2)"
echo "4. Copy this file to the drive:"
echo " ${UF2_FILE}"
echo "5. Board will automatically reboot when copy completes"
echo ""
# Try to detect if RPI-RP2 drive is mounted
if [ -d "/Volumes/RPI-RP2" ]; then
echo "✓ Detected RPI-RP2 drive at /Volumes/RPI-RP2"
read -p "Copy UF2 file now? (y/n): " copy_now
if [ "$copy_now" = "y" ] || [ "$copy_now" = "Y" ]; then
cp "${UF2_FILE}" /Volumes/RPI-RP2/
echo "✓ File copied! Board will reboot automatically..."
fi
else
echo "⚠ RPI-RP2 drive not detected"
echo "Please manually copy the UF2 file when the drive appears"
fi
;;
*)
echo "Invalid choice"
exit 1
;;
esac
PICOTOOL="${HOME}/.pico-sdk/picotool/2.2.0-a4/picotool/picotool"
if [ ! -f "${PICOTOOL}" ]; then
echo " picotool not found at: ${PICOTOOL}"
exit 1
fi
# Try to load the UF2
"${PICOTOOL}" load "${UF2_FILE}" -fx
if [ $? -eq 0 ]; then
echo ""
echo "✓ Successfully flashed to board!"
echo "✓ Board will automatically reboot and run the program"
else
echo ""
echo "❌ Flash failed! Make sure:"
echo " - Board is in BOOTSEL mode (hold BOOTSEL while plugging in)"
echo " - USB cable is connected"
echo " - You have permission to access USB devices"
exit 1
fi
echo ""
echo "=========================================="