From af6d86c098966c5ea97c4c625b9343fad2acbcac Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Tue, 26 May 2026 21:24:29 -0600 Subject: [PATCH] migration --- args_file.txt | 5 +++ espdump.sh | 67 ++++++++++++++++++++++++++++++++++++++++ espflashdump-esptool.txt | 4 +++ 3 files changed, 76 insertions(+) create mode 100644 args_file.txt create mode 100644 espdump.sh create mode 100644 espflashdump-esptool.txt diff --git a/args_file.txt b/args_file.txt new file mode 100644 index 0000000..abaccad --- /dev/null +++ b/args_file.txt @@ -0,0 +1,5 @@ +internal-ROM0 instruction-bus 0x4000_0000 0x4003_FFFF +internal-ROM1 data-bus 0x3FF0_0000 0x3FF1_FFFF +internal-ROM1 instruction-bus 0x4004_0000 0x4005_FFFF +elf-start-addr unknown-bus 0x3FCD_7000 0x3FF1_8C00 +elf-later-addr unknown-bus 0x4000_0000 0x4005_8000 diff --git a/espdump.sh b/espdump.sh new file mode 100644 index 0000000..2e7aa3f --- /dev/null +++ b/espdump.sh @@ -0,0 +1,67 @@ +#!/bin/zsh +datestamp=$(date "+%d%m%y%H%M%S") +chip="esp32s3" +file_prefix=$1 +out_dir="./live-roms/$file_prefix-$datestamp" +no_stub=True # True/False case sensitive +args_file="./args_file.txt" +log_file="$out_dir/log.txt" +tmp_file="./.dump_rom_tmp.tmp" +start_header="Starting dump from chip: $chip\n on port: $ESPPORT\n at: $ESPBAUD baud\n to directory: $out_dir\n with log file: $log_file\n" + +mkdir $out_dir + +if [ "$no_stub" != "False" ]; then + stubby='--no-stub' +fi + + +echo "\n=====================" +echo $start_header + +echo $start_header >> $log_file + +# usage dump_section name bus start end +# start and end are hex values in bytes beginning with 0x +# name and bus are strings with no spaces +dump_section () { + dump_length=0x$(([##16] $4 - $3)) + file_name="$out_dir/$file_prefix-$chip-$1-$2-$3-$4-$dump_length-$datestamp.bin" + command="esptool.py \ \n $stubby --baud $ESPBAUD \ \n --port $ESPPORT \ \n --chip $chip \ \n dump_mem $3 $dump_length \ \n $file_name" + + header="$1\n on $2\n starting: $3\n ending: $4\n length: $dump_length\n on $chip\n no_stub: $no_stub\n\nRunning: $command" + + echo "\nDumping Section:\n$header\n\nPlease wait..." + + echo $header >> $log_file + echo " File: $file_name" >> $log_file + echo " $command" >> $log_file + + esptool.py `echo $stubby` --baud $ESPBAUD --port $ESPPORT --chip $chip dump_mem $3 $dump_length $file_name > $tmp_file + return_status=$? + + if [ $return_status -ne 0 ]; then + echo " ERROR: return status $return_status dump:" >> $log_file + cat $tmp_file >> $log_file + echo "ERROR: dump failed. check $log_file" + echo "esptool output:" + cat $tmp_file + rm $tmp_file + exit + fi + + checksum=$(sha256sum $file_name) + echo " Sucess\n===\n" >> $log_file + echo " sha256sum: $checksum" >> $log_file + echo "Successfully dumped\nsha256sum: $checksum\n continuing..." +} + + +for args in ${(f)"$(<$args_file)"}; +do + dump_section `echo $args` +done + +sha256sum "$out_dir/*" >> "$out_dir/sha256sum.txt" + +echo "\nDone :3" diff --git a/espflashdump-esptool.txt b/espflashdump-esptool.txt new file mode 100644 index 0000000..11c1a21 --- /dev/null +++ b/espflashdump-esptool.txt @@ -0,0 +1,4 @@ +esptool.py --port COMX --baud 115200 --chip esp32c3 get_security_info +esptool.py --port COMX --baud 115200 --chip esp32c3 flash_id +esptool.py --port COMX --baud 115200 --chip esp32c3 chip_id +esptool.py --port COMX --baud 460800 --chip esp32c3 read_flash 0 ALL FlashMate-Dump-seeed-xiao-esp32c3.binC:\Users\human\OneDrive\Documents\Git\esp-tooling-special\espdump.ps1 \ No newline at end of file