- Complete MPU-MCU communication setup - LED Matrix text display with configurable parameters - Configuration management with personal data protection - Git template with .gitignore for sensitive data - Automated build and deployment scripts - SSH key management and service scripts
74 lines
1.7 KiB
Bash
Executable File
74 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Build script for Arduino UNO Q
|
|
# Uses configuration from config.json
|
|
|
|
set -e
|
|
|
|
# Add lib directory to Python path
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
PYTHONPATH="$PROJECT_ROOT/lib:$PYTHONPATH"
|
|
|
|
# Load configuration
|
|
python3 -c "
|
|
import sys
|
|
sys.path.insert(0, '$PROJECT_ROOT/lib')
|
|
from config_loader import config
|
|
|
|
build_config = config.get_build_config()
|
|
print(f'SKETCH_PATH={build_config[\"sketch_path\"]}')
|
|
print(f'FQBN={build_config[\"fqbn\"]}')
|
|
print(f'BUILD_DIR={build_config[\"build_dir\"]}')
|
|
print(f'OUTPUT_DIR={build_config[\"output_dir\"]}')
|
|
" > /tmp/build_config.sh
|
|
|
|
source /tmp/build_config.sh
|
|
|
|
echo "Building Arduino UNO Q project..."
|
|
|
|
# Create build directory
|
|
mkdir -p "$BUILD_DIR"
|
|
mkdir -p "$OUTPUT_DIR"
|
|
|
|
# Check if Arduino CLI is installed
|
|
if ! command -v arduino-cli &> /dev/null; then
|
|
echo "Arduino CLI not found. Please install it first:"
|
|
echo "curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if sketch exists
|
|
if [ ! -f "$SKETCH_PATH" ]; then
|
|
echo "Sketch file not found: $SKETCH_PATH"
|
|
exit 1
|
|
fi
|
|
|
|
# Initialize Arduino CLI if needed
|
|
if [ ! -d "$HOME/.arduino15" ]; then
|
|
echo "Initializing Arduino CLI..."
|
|
arduino-cli core update-index
|
|
arduino-cli core install arduino:zephyr
|
|
fi
|
|
|
|
# Compile the sketch
|
|
echo "Compiling sketch: $SKETCH_PATH"
|
|
arduino-cli compile \
|
|
--fqbn "$FQBN" \
|
|
--build-path "$BUILD_DIR" \
|
|
--output-dir "$OUTPUT_DIR" \
|
|
"$SKETCH_PATH"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "Build successful!"
|
|
echo "Output files in: $OUTPUT_DIR"
|
|
|
|
# List generated files
|
|
ls -la "$OUTPUT_DIR/"
|
|
else
|
|
echo "Build failed!"
|
|
exit 1
|
|
fi
|
|
|
|
# Cleanup
|
|
rm -f /tmp/build_config.sh |