Last active
July 16, 2025 20:22
-
-
Save gatlinnewhouse/6d5df1025b7c513ce49879128dc91d12 to your computer and use it in GitHub Desktop.
Setup BMV080 with Platformio bash script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Prompt user for Bosch SDK directory | |
read -rp "Enter the Bosch SDK directory path: " BOSCH_SDK_DIR | |
# Prompt user for SparkFun BMV080 Arduino Library directory | |
read -rp "Enter the SparkFun BMV080 Arduino Library path: " SPARKFUN_LIB_DIR | |
# Define the mapping from SDK paths to Library paths | |
declare -A FILE_MAP=( | |
["api/inc/bmv080.h"]="src/sfTk/bmv080.h" | |
["api/inc/bmv080_defs.h"]="src/sfTk/bmv080_defs.h" | |
["api/lib/xtensa_esp32/xtensa_esp32_elf_gcc/release/lib_bmv080.a"]="src/esp32/lib_bmv080.a" | |
["api/lib/xtensa_esp32/xtensa_esp32_elf_gcc/release/lib_postProcessor.a"]="src/esp32/lib_postProcessor.a" | |
["api/lib/xtensa_esp32s2/xtensa_esp32s2_elf_gcc/release/lib_postProcessor.a"]="src/esp32s2/lib_postProcessor.a" | |
["api/lib/xtensa_esp32s2/xtensa_esp32s2_elf_gcc/release/lib_bmv080.a"]="src/esp32s2/lib_bmv080.a" | |
["api/lib/xtensa_esp32s3/xtensa_esp32s3_elf_gcc/release/lib_postProcessor.a"]="src/esp32s3/lib_postProcessor.a" | |
["api/lib/xtensa_esp32s3/xtensa_esp32s3_elf_gcc/release/lib_bmv080.a"]="src/esp32s3/lib_bmv080.a" | |
["api/lib/arm_cortex_m0plus/arm_none_eabi_gcc/release/lib_bmv080.a"]="src/cortex-m0plus/lib_bmv080.a" | |
["api/lib/arm_cortex_m0plus/arm_none_eabi_gcc/release/lib_postProcessor.a"]="src/cortex-m0plus/lib_postProcessor.a" | |
# Use these for non-VFP registers or Cortex M33 devices without FPUs | |
# ["api/lib/arm_cortex_m33/arm_none_eabi_gcc/release/lib_bmv080.a"]="src/cortex-m33/lib_bmv080.a" | |
# ["api/lib/arm_cortex_m33/arm_none_eabi_gcc/release/lib_postProcessor.a"]="src/cortex-m33/lib_postProcessor.a" | |
# Use these for VFP registers or Cortex M33 devices with FPUs | |
["api/lib/arm_cortex_m33f/arm_none_eabi_gcc/release/lib_bmv080.a"]="src/cortex-m33/lib_bmv080.a" | |
["api/lib/arm_cortex_m33f/arm_none_eabi_gcc/release/lib_postProcessor.a"]="src/cortext-m33/lib_postProcessor.a" | |
# Use these for non-VFP registers or Cortex M4 devices without FPUs | |
# ["api/lib/arm_cortex_m4/arm_none_eabi_gcc/release/lib_bmv080.a"]="src/cortex-m4/lib_bmv080.a" | |
# ["api/lib/arm_cortex_m4/arm_none_eabi_gcc/release/lib_postProcessor.a"]="src/cortex-m4/lib_postProcessor.a" | |
# Use these for VFP registers or Cortex M4 devices with FPUs | |
["api/lib/arm_cortex_m4f/arm_none_eabi_gcc/release/lib_bmv080.a"]="src/cortex-m4/lib_bmv080.a" | |
["api/lib/arm_cortex_m4f/arm_none_eabi_gcc/release/lib_postProcessor.a"]="src/cortex-m4/lib_postProcessor.a" | |
) | |
echo "Copying files..." | |
# Iterate over the file map | |
for SRC_REL in "${!FILE_MAP[@]}"; do | |
SRC="$BOSCH_SDK_DIR/$SRC_REL" | |
DST="$SPARKFUN_LIB_DIR/${FILE_MAP[$SRC_REL]}" | |
# Create destination directory if it doesn't exist | |
mkdir -p "$(dirname "$DST")" | |
# Copy file if it exists | |
if [[ -f "$SRC" ]]; then | |
cp "$SRC" "$DST" | |
echo "Copied: $SRC_REL -> ${FILE_MAP[$SRC_REL]}" | |
else | |
echo "Warning: Source file not found: $SRC" | |
fi | |
done | |
echo "Copy complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment