bug fixes and symantic improvements

This commit is contained in:
2025-05-09 13:09:03 -06:00
parent 5af1bc0ef2
commit 62a35ee2a8
10 changed files with 128 additions and 104 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ echo -e "\nSetting alias"
alias changeport="source $binDir/changeport.sh" alias changeport="source $binDir/changeport.sh"
alias changebaud="source $binDir/changebaud.sh" alias changebaud="source $binDir/changebaud.sh"
alias changeesp="source $binDir/changeesp.sh" alias changeesp="source $binDir/changeesp.sh"
alias exit_esp_tools="source $binDir/exit_idf.sh" alias exit-esp-tools="source $binDir/exit-idf.sh"
alias monitor="idf.py monitor" alias monitor="idf.py monitor"
alias flashmonitor="idf.py flash monitor" alias flashmonitor="idf.py flash monitor"
alias menuconfig="idf.py menuconfig" alias menuconfig="idf.py menuconfig"
+6 -2
View File
@@ -6,8 +6,12 @@ subprocess() {
return 0 return 0
} }
ret='' if [ ! -z "$1" ]; then
subprocess ret ret="$1"
else
ret=''
subprocess ret
fi
export ESPTARGET="${ret}" export ESPTARGET="${ret}"
+19 -5
View File
@@ -1,8 +1,22 @@
#!/bin/bash #!/bin/bash
echo -e "\nflash_id\n" echo -e "Getting ESP Chip Info...\n"
esptool.py flash_id # echo -e "Base MAC Address:"
# esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto read_mac
echo -e "\nChip ID:"
esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto chip_id
echo -e "\nchip_id\n" echo -e "\nFlash ID:"
esptool.py chip_id esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto flash_id
echo -e "\nAll done :3\n" echo -e "\nFlash Status:"
esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto read_flash_status
echo -e "\nSecurity Info:"
esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto get_security_info
if [ -f "./CMakeLists.txt" ]; then
echo -e "\nEfuse Table:"
idf.py --port $ESPPORT --baud $ESPBAUD efuse-dump
fi
echo -e "\nAll donsies~ :3\n"
+12 -22
View File
@@ -1,22 +1,12 @@
#!/bin/bash echo "esp-idf install dir: $ESPIDF_INSTALLDIR"
echo -e "Getting ESP Chip Info...\n" echo "esp-idf path: $IDF_PATH"
# echo -e "Base MAC Address:" echo "esp-idf version: $ESP_IDF_VERSION"
# esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto read_mac echo "esp-idf python path: $IDF_PYTHON_ENV_PATH
echo -e "\nChip ID:" echo "openocd scripts: $OPENOCD_SCRIPTS"
esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto chip_id echo "esp-idf rom elf dir: $ESP_ROM_ELF_DIR"
echo "esp-idf-deactivate file path $IDF_DEACTIVATE_FILE_PATH"
echo -e "\nFlash ID:" echo "esp-idf tools install cmd: $IDF_TOOLS_INSTALL_CMD"
esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto flash_id echo "esp-idf-tools export cmd: $IDF_TOOLS_EXPORT_CMD"
echo "port: $ESPPORT"
echo -e "\nFlash Status:" echo "baud: $ESPBAUD"
esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto read_flash_status echo "target device $SPTARGET"
echo -e "\nSecurity Info:"
esptool.py --port $ESPPORT --baud $ESPBAUD --chip auto get_security_info
if [ -f "./CMakeLists.txt" ]; then
echo -e "\nEfuse Table:"
idf.py --port $ESPPORT --baud $ESPBAUD efuse-dump
fi
echo -e "\nAll donsies~ :3\n"
@@ -7,7 +7,6 @@ unset ESP_ROM_ELF_DIR
unset IDF_DEACTIVATE_FILE_PATH unset IDF_DEACTIVATE_FILE_PATH
unset IDF_TOOLS_INSTALL_CMD unset IDF_TOOLS_INSTALL_CMD
unset IDF_TOOLS_EXPORT_CMD unset IDF_TOOLS_EXPORT_CMD
unset IDF_TOOLS_EXPORT_CMD
unset ESPPORT unset ESPPORT
unset ESPBAUD unset ESPBAUD
unset ESPTARGET unset ESPTARGET
+38 -13
View File
@@ -263,10 +263,10 @@ function testAppendAlias() {
} }
function handleAliasEnviron() { function handleAliasEnviron() {
testAppendAlias "get_esp_tools" "alias get_esp_tools='. $exportScript'" testAppendAlias "get-esp-tools" "alias get-esp-tools='. $exportScript'"
testAppendAlias "run_esp_cmd" "alias run_esp_cmd='git -C $runningDir pull;echo -e \"\nOld Version:\";tail -1 $versionData;echo -e \"\n\";bash $runningDir/esp-idf-tools-cmd.sh'" testAppendAlias "run-esp-cmd" "alias run-esp-cmd='git -C $runningDir pull;echo -e \"\nOld Version:\";tail -1 $versionData;echo -e \"\n\";bash $runningDir/esp-idf-tools-cmd.sh'"
testAppendAlias "esp_install_monitor" "alias esp_install_monitor='tail -n 75 -f $log'" testAppendAlias "esp-install-monitor" "alias esp-install-monitor='tail -n 75 -f $log'"
testAppendAlias "esp_install_logs" "alias esp_install_logs='less $versionData;less $log'" testAppendAlias "esp-install-logs" "alias esp-install-logs='less $versionData;less $log'"
if [ -z $ESPIDF_INSTALLDIR ]; then if [ -z $ESPIDF_INSTALLDIR ]; then
writeToLog "ESPIDF_INSTALLDIR environment variable not found, appending to $rcFile" writeToLog "ESPIDF_INSTALLDIR environment variable not found, appending to $rcFile"
@@ -338,7 +338,14 @@ function handleDownloadInstall() {
returnStatus returnStatus
gitHashChk=$? gitHashChk=$?
gitDataLog="$(date '+%d/%m/%Y %H:%M:%S %Z (%s)') commit $commitHash branch $gitBranch version $scriptVers action $action" # if gitDataLog file doesnt exist, initialize with header
if [[ ! -f "$gitDataLog" ]]; then
writeToLog "$gitDataLog not found, initializing with header"
echo "date | esp-idf branch | esp-idf-tools version | action" > "$gitDataLog";
fi
# date | esp-idf branch | esp-idf-tools version | action
gitDataLog="$(date '+%d/%m/%Y %H:%M:%S %Z (%s)') | $commitHash | $gitBranch | $scriptVers | $action"
writeToLog "$gitDataLog" writeToLog "$gitDataLog"
echo "$gitDataLog" >> $versionData echo "$gitDataLog" >> $versionData
returnStatus returnStatus
@@ -347,7 +354,7 @@ function handleDownloadInstall() {
handleReboot() { handleReboot() {
# writeToLog "Handling reboot: (function ran)\n" # writeToLog "Handling reboot: (function ran)\n"
eval "sudo shutdown -r +$rebootMins" sudo shutdown -r +$rebootMins
} }
# warning not work how i make it work fuckin ell # warning not work how i make it work fuckin ell
@@ -481,7 +488,6 @@ function handleClearInstallLog() {
fi fi
} }
function handleEnd() { function handleEnd() {
handleChk handleChk
@@ -591,7 +597,7 @@ elif [[ "$arg" == "interactive" || "$arg" == "i" ]]; then
elif [[ "$arg" == "cron" || "$arg" == "c" ]]; then # full install with warn, sleep, and reboot elif [[ "$arg" == "cron" || "$arg" == "c" ]]; then # full install with warn, sleep, and reboot
action="REINSTALL (CRON)" action="REINSTALL (CRON)"
# sleepMins=3 sleepMins=1
idfGet="update" idfGet="update"
sleepMins=0 sleepMins=0
@@ -610,9 +616,8 @@ elif [[ "$arg" == "cron" || "$arg" == "c" ]]; then # full install with warn, sle
elif [[ "$arg" == "update" || "$arg" == "u" ]]; then # update without logouts or reboot elif [[ "$arg" == "update" || "$arg" == "u" ]]; then # update without logouts or reboot
action="UPDATE" action="UPDATE"
# sleepMins=3
idfGet="update" idfGet="update"
sleepMins=0 sleepMins=1
handleStart handleStart
handleClearInstallLog handleClearInstallLog
@@ -624,12 +629,12 @@ elif [[ "$arg" == "update" || "$arg" == "u" ]]; then # update without logouts or
exit exit
elif [[ "$arg" == "clearlogs" || "$arg" == "cl" || "$arg" == "clear" || "$arg" == "clean" ]]; then # clear logs elif [[ "$arg" == "clearlogs" || "$arg" == "cl" || "$arg" == "clear"]]; then
handleEmptyLogs handleEmptyLogs
exit exit
elif [[ "$arg" == "nuke" || "$arg" == "n" ]]; then # clear logs elif [[ "$arg" == "nuke" || "$arg" == "n" ]]; then
action="REINSTALL (NUKE)" action="REINSTALL (NUKE)"
idfGet="download" idfGet="download"
@@ -644,14 +649,34 @@ elif [[ "$arg" == "nuke" || "$arg" == "n" ]]; then # clear logs
exit exit
elif [ "$arg" == "uninstall" ]; then # clear logs elif [[ "$arg" == "nukereboot" || "$arg" == "nr" ]]; then
action="REINSTALL (NUKEREBOOT)"
sleepMins=1
idfGet="download"
handleStart
handleClearInstallLog
handleSetupEnvironment
handleCustomBins
handleDownloadInstall
handleExport
handleAliasEnviron
handleEnd
handleReboot
exit
elif [ "$arg" == "uninstall" ]; then
handleUninstall handleUninstall
echo -e "\nAll done :3\n" echo -e "\nAll done :3\n"
exit exit
elif [ ! -z $arg ]; then elif [ ! -z $arg ]; then
writeToLog "FAIL: bad argument. Terminating" writeToLog "FAIL: bad argument. Terminating"
exit exit
else # full noninteractive (re)install without logout, reboot, or sleeps else # full noninteractive (re)install without logout, reboot, or sleeps
action="REINSTALL (DEFAULT)" action="REINSTALL (DEFAULT)"
+50 -58
View File
@@ -1,76 +1,91 @@
Modes: Modes:
Some take optional [branch] paramater
[branch] is the esp-idf branch you desire, defaults to master if not specified.
default: default:
reinstalls non-interactively with no delays, logouts, or reboots reinstalls non-interactively with no delays, logouts, or reboots
`run_esp_cmd` `run-esp-cmd`
test: test:
tests the script. very fast. minimal actions taken. no reinstall is done tests the script. very fast. minimal actions taken. no reinstall is done
`run_esp_cmd test` `run-esp-cmd test [branch]`
`run_esp_cmd t` `run-esp-cmd t [branch]`
retool: retool:
reinstalls bins and export.sh, nothing else reinstalls bins and export.sh, nothing else
`run_esp_cmd retool` `run-esp-cmd retool`
`run_esp_cmd rt` `run-esp-cmd rt`
cron: cron:
runs noninteractively with forced user logout and automatic reboot, plus delays runs noninteractively with forced user logout and automatic reboot, plus delays
`run_esp_cmd cron` `run-esp-cmd cron [branch]`
`run_esp_cmd c` `run-esp-cmd c [branch]`
update: update:
updates and installs latest without reboot or user logout updates and installs latest without reboot or user logout
`run_esp_cmd update` `run-esp-cmd update [branch]`
`run_esp_cmd u` `run-esp-cmd u [branch]`
interactive: interactive:
interactively installs/reinstalls esp-idf interactively installs/reinstalls esp-idf
`run_esp_cmd interactive` `run-esp-cmd interactive`
`run_esp_cmd i` `run-esp-cmd i`
nuke: nuke:
full delete and re-download and install full delete and re-download and install
`run_esp_cmd nuke` `run-esp-cmd nuke [branch]`
`run_esp_cmd n` `run-esp-cmd n [branch]`
nukereboot
full delete and re-download and install, then reboot
`run-esp-cmd nukereboot [branch]`
`run-esp-cmd nr [branch]`
clearlogs: clearlogs:
clear logs clear logs
`run_esp_cmd clearlogs` `run-esp-cmd clearlogs`
`run_esp_cmd clear` `run-esp-cmd clear`
`run_esp_cmd clean` `run-esp-cmd cl`
`run_esp_cmd cl`
help: help:
display this help text display this help text
`run_esp_cmd help` `run-esp-cmd help`
`run_esp_cmd h` `run-esp-cmd h`
`run_esp_cmd -h` `run-esp-cmd -h`
`run_esp_cmd --help` `run-esp-cmd --help`
`help-esp-tools`
uninstall: uninstall:
uninstall esp-idf uninstall esp-idf
`run_esp_cmd uninstall` `run-esp-cmd uninstall`
Usage: Usage:
Once installed for the first time, restart your shell. Once installed for the first time, restart your shell.
to activate esp-idf with the custom additions, run: to activate esp-idf with the custom additions, run:
`get_esp_tools` `get-esp-tools`
exit with exit with
`exit_esp_tools` `exit-esp-tools`
for help for help
`help_esp_tools` `help-esp-tools`
Features: Features:
`help-esp` show this help `get-idf-tools` enter esp-idf
`get_idf` enter esp-idf `help-esp-tools` show this help
`exit_idf` exit esp-idf and reset terminal `exit-esp-tools` exit esp-idf and reset terminal
`build` idf.py build `build` idf.py build
`changebaud` prompts to enter a new baud `changebaud` prompts to enter a new baud
`changeesp` prompts to type in esp32s3, esp32c6, etc `changeesp` change esp device
`changeport` opens a menu to select a serial port `changeesp` alone prompts to enter
`clean` idf.py clean `changeesp <esp device>` manually changes to <esp device>
ex. `changeesp esp32p4`
`changeport` change serial port
`changeport` alone prompts to select
`changeport <tty device path>` manually specifies path
ex. `changeport /dev/ttyUSB0` changes to /dev/ttyUSB0
`clean` idf.py clean
`fullclean` fully resets a project, 'idf.py fullclean' plus remove the build dir and delete some temp and backup files `fullclean` fully resets a project, 'idf.py fullclean' plus remove the build dir and delete some temp and backup files
`rebuildfull` does a `fullclean` but also an `erase-flash` and also `setup` `rebuildfull` does a `fullclean` but also an `erase-flash` and also `setup`
`setup` same as running `idf.py set-target $ESPTARGET; idf.py menuconfig; idf.py build` `setup` same as running `idf.py set-target $ESPTARGET; idf.py menuconfig; idf.py build`
@@ -83,32 +98,15 @@ Features:
`chipinfo` get information from the esp chip `chipinfo` get information from the esp chip
`espinfo` get detailed information from the esp chip `espinfo` get detailed information from the esp chip
`menuconfig` run `idf.py menuconfig` `menuconfig` run `idf.py menuconfig`
`create-project <project name>` same as idf.py create-project <proejct name>
ex. `create-project hello-world`
`esp-install-monitor` monitors install.log. alias for `tail -n 75 -f $ESPIDF_INSTALLDIR/install.log`
`esp-install-logs` displays full text of install.log and version-data.txt
Aliases: Aliases:
run_esp_cmd
Updates the esp-install-custom code via git, displays the script version, then executes esp-idf-tools-cmd.sh with optional arument.
Takes identical arguments to running esp-idf-tools-cmd.sh manually
run_esp_cmd
run_esp_cmd clean
run_esp_cmd nuke [branch]
run_esp_cmd retool [branch]
run_esp_cmd cron [branch]
run_esp_cmd update [branch]
run_esp_cmd interactive
run_esp_cmd test
run_esp_cmd uninstall
Second optional argument specifies branch (requires two arguments!):
`run_esp_cmd nuke v5.4.1`
esp_install_monitor
monitors install.log
alias for tail -n 75 -f $ESPIDF_INSTALLDIR/install.log
no arguments
esp_install_logs
displays full text of install.log and version-data.txt
no arguments
Helpful Stuff: Helpful Stuff:
cron: cron:
@@ -116,9 +114,3 @@ Helpful Stuff:
`crontab -e` `crontab -e`
add below to bottom of file: add below to bottom of file:
0 4 * * * bash $HOME/esp/esp-install-custom/esp-idf-tools-cmd.sh cron 0 4 * * * bash $HOME/esp/esp-install-custom/esp-idf-tools-cmd.sh cron
monitor log file during install:
`tail -n 75 $ESPIDF_INSTALLDIR/install.log;`
view both logs from beginning:
`less $ESPIDF_INSTALLDIR/install.log; less $ESPIDF_INSTALLDIR/version-data.txt`
+1 -1
View File
@@ -1 +1 @@
8-rc-5 9-rc-2