10000 Refresh of ESP32 flash tool libraries · lebinlv/esp32-snippets@7a33f4b · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a33f4b

Browse files
committed
Refresh of ESP32 flash tool libraries
1 parent cd2b065 commit 7a33f4b

File tree

3 files changed

+198
-114
lines changed

3 files changed

+198
-114
lines changed

tools/esptool_libs/nodejs/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# NodeJS ESP Tools
2+
3+
The `build.js` tool is used to take the `stub_flasher_32.elf` and break it apart into the separate files that need to be individually pushed to ESP32 RAM for execution.

tools/esptool_libs/nodejs/build.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Extract the text and data sections to their own files.
3+
xtensa-esp32-elf-objcopy \
4+
--dump-section .text=text.dat \
5+
--dump-section .data=data.dat \
6+
stub_flasher_32.elf
7+
8+
# Parse out the text load address, the data load address and the entry point from the ELF.
9+
text_address=`xtensa-esp32-elf-objdump --section-headers --wide --section=.text stub_flasher_32.elf | sed -n '$s/^\s*[[:alnum:]]*\s*\S*\s*[[:alnum:]]*\s*[[:alnum:]]*\s*\([[:alnum:]]*\).*/\1/p'`
10+
#echo "Text address: 0x${text_address}"
11+
data_address=`xtensa-esp32-elf-objdump --section-headers --wide --section=.data stub_flasher_32.elf | sed -n '$s/^\s*[[:alnum:]]*\s*\S*\s*[[:alnum:]]*\s*[[:alnum:]]*\s*\([[:alnum:]]*\).*/\1/p'`
12+
#echo "Data address: 0x${data_address}"
13+
entry_point=`xtensa-esp32-elf-objdump --wide --file-headers stub_flasher_32.elf | sed -n '/start address/s/start address 0x\([[:alnum:]]\)/\1/p'`
14+
#echo "Entry point: 0x${entry_point}"
15+
16+
echo "{"
17+
echo " \"textAddress\": \"${text_address}\","
18+
echo " \"dataAddress\": \"${data_address}\","
19+
echo " \"entryPoint\": \"${entry_point}\","
20+
echo " \"textData\": \"$(base64 --wrap=0 text.dat)\","
21+
echo " \"dataData\": \"$(base64 --wrap=0 data.dat)\""
22+
echo "}"
23+
24+
# Remove the temporary text and data files.
25+
#rm text.dat data.dat

0 commit comments

Comments
 (0)
0