Forráskód Böngészése

Added in better build instructions. Added script for generating documentation and scripts to add to release zip. (#12)

* Added in build instructions for recovery + squeezelite. Added script for
generating documentation and scripts to add to release zip.

* Updated README

* More cleanup to README
Thomas Preece 5 éve
szülő
commit
b1f234d460
2 módosított fájl, 138 hozzáadás és 9 törlés
  1. 18 9
      README.md
  2. 120 0
      makeBuildDocs.sh

+ 18 - 9
README.md

@@ -3,9 +3,6 @@ An automated build was configured to produce binaries on a regular basis, from c
 
 https://github.com/sle118/squeezelite-esp32/releases
  
-
-
-
 # Configuration
 1/ setup WiFi
 - Boot the esp, look for a new wifi access point showing up and connect to it.  Default build ssid and passwords are "squeezelite"/"squeezelite". 
@@ -51,14 +48,26 @@ To add options that require quotes ("), escape them with \". For example, so use
 
 nvs_set autoexec1 str -v "squeezelite -o \"BT -n 'MySpeaker'\" -b 500:2000 -R -u m -Z 192000 -r \"44100-44100\""
 
-# Additional misc notes to do your owm build
+# Building Squeezelite-esp32
 MOST IMPORTANT: create the right default config file
-- make defconfig
+```
+make defconfig
+```
 Then adapt the config file to your wifi/BT/I2C device (can alos be done on the command line)
-- make menuconfig
-Then 
-- make -j4
-- make flash monitor
+```
+make menuconfig
+```
+Then you will need to build the recovery binary and squeezelite binary:
+```
+# Build recovery.bin, bootloader.bin, ota_data_initial.bin, partitions.bin  
+PROJECT_NAME="recovery" make -j4 all EXTRA_CPPFLAGS='-DRECOVERY_APPLICATION=1'
+# Now force a rebuild by touching all the files which may have a RECOVERY_APPLICATION specific source compile logic
+find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -type f -print0 | xargs -0 grep -l "RECOVERY_APPLICATION" | xargs touch
+# Build squeezelite.bin
+PROJECT_NAME="squeezelite" make -j4 app EXTRA_CPPFLAGS='-DRECOVERY_APPLICATION=0'
+
+make flash monitor
+```
 
 Once the application is running, under monitor, you can monitor the system activity. 
 

+ 120 - 0
makeBuildDocs.sh

@@ -0,0 +1,120 @@
+#!/bin/bash
+
+# ================================================================================
+# Script for use on build server for generating scripts and documentation that can be distributed with
+# the release bundle
+# ================================================================================
+
+# Location of partitions.csv relative to this script
+partitionsCsv="./partitions.csv"
+
+mkdir -p ./build
+
+# File to output readme instructions to
+outputReadme="./build/README.txt"
+
+# File to output bash script to
+outputBashScript="./build/writeSequeezeEsp.sh"
+
+# File to output bat script to
+outputBatScript="./build/writeSequeezeEsp.bat"
+
+# The name of partitions to ignore from partitions.csv
+paritionsToIgnore=(
+  "nvs"
+  "phy_init"
+)
+
+# Function that maps partition name to actual bin file
+# defaults to "[PARTION_NAME_FROM_CSV].bin"
+function partitionNameToBinFile {
+  if [[ "$1" == "otadata" ]]; then
+    echo "ota_data_initial.bin"
+  elif [[ "$1" == "ota_0" ]]; then
+    echo "squeezelite.bin"
+  else
+    echo $1.bin
+  fi
+}
+
+# write parameters for esptool.py
+writeParameters="$writeParameters write_flash"
+writeParameters="$writeParameters --flash_mode dio --flash_freq 80m --flash_size detect"
+
+# bootloader.bin and partitions.bin not in partitions.csv so manually add here
+partitionsParameters=" 0x1000 bootloader/bootloader.bin"
+partitionsParameters="$partitionsParameters 0x8000 partitions.bin"
+
+# ==============================================================================
+
+# Loop over partitions.csv and add partition bins and offsets to partitionsParameters
+{
+  read;
+  read;
+  while read -r line
+  do
+      partitionName=$(echo $line | awk -F', ' '{printf "%s", $1}' | tr -d '"')
+      partitionOffset=$(echo $line | awk -F', ' '{printf "%s", $4}' | tr -d '"')
+      partitionFile=$(partitionNameToBinFile $partitionName)
+
+      if [[ " ${paritionsToIgnore[@]} " =~ " ${partitionName} " ]]; then
+          continue
+      fi
+
+      partitionsParameters="$partitionsParameters $partitionOffset $partitionFile"
+  done
+} < $partitionsCsv
+
+# Write README Instructions
+if [ ! -f "$outputReadme" ]; then
+  touch $outputReadme
+fi
+
+echo "" >> $outputReadme
+echo "Below you'll find details on how to flash squeezelite-esp on different platforms" >> $outputReadme
+echo "In all cases your squeezelite-esp will start in recovery mode. Setup Wifi and" >> $outputReadme
+echo "then click on reboot within the system tab. And the squeezelite-esp should boot" >> $outputReadme
+echo "into full mode" >> $outputReadme
+echo "" >> $outputReadme
+echo "====LINUX====" >> $outputReadme
+echo "To flash sequeezelite run the following script:" >> $outputReadme
+echo "$outputBashScript [PORT_HERE] [BAUD_RATE]" >> $outputReadme
+echo "e.g. $outputBashScript /dev/ttyUSB0 115200" >> $outputReadme
+echo "" >> $outputReadme
+echo "====WINDOWS====" >> $outputReadme
+echo "To flash sequeezelite run the following script:" >> $outputReadme
+echo "$outputBatScript [PORT_HERE] [BAUD_RATE]" >> $outputReadme
+echo "e.g. $outputBatScript COM11 115200" >> $outputReadme
+echo "" >> $outputReadme
+echo "If you don't know how to run the BAT file with arguments then you can" >> $outputReadme
+echo "edit the bat file in Notepad. Open the file up and edit the following:" >> $outputReadme
+echo "Change 'set port=%1' to 'set port=[PORT_HERE]'. E.g. 'set port=COM11'" >> $outputReadme
+echo "Change 'set baud=%2' to 'set baud=[BAUD_RATE]'. E.g. 'set baud=115200'" >> $outputReadme
+echo "" >> $outputReadme
+echo "====MANUAL====" >> $outputReadme
+echo "Python esptool.py --port [PORT_HERE] --baud [BAUD_RATE] $writeParameters $partitionsParameters" >> $outputReadme
+
+
+# Write Linux BASH File
+if [ ! -f "$outputBashScript" ]; then
+  touch $outputBashScript
+fi
+
+echo "#!/bin/bash" >> $outputBashScript
+echo >> $outputBashScript
+echo "port=\$1" >> $outputBashScript
+echo "baud=\$2" >> $outputBashScript
+linuxFlashCommand="Python esptool.py --port \$port --baud \$baud"
+echo "$linuxFlashCommand $writeParameters $partitionsParameters" >> $outputBashScript
+
+# Write Windows BAT File
+if [ ! -f "$outputBatScript" ]; then
+  touch $outputBatScript
+fi
+
+echo "echo off" >> $outputBatScript
+echo "" >> $outputBatScript
+echo "set port=%1" >> $outputBatScript
+echo "set baud=%2" >> $outputBatScript
+windowsFlashCommand="Python esptool.py --port %port% --baud %baud%"
+echo "$windowsFlashCommand $writeParameters $partitionsParameters" >> $outputBatScript