esp32tool 1.3.6 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apple-touch-icon.png +0 -0
- package/dist/console.js +18 -7
- package/dist/const.d.ts +20 -0
- package/dist/const.js +23 -0
- package/dist/esp_loader.d.ts +40 -38
- package/dist/esp_loader.js +674 -448
- package/dist/flash_jedec.d.ts +2 -0
- package/dist/flash_jedec.js +113 -0
- package/dist/web/index.js +1 -1
- package/icons/icon-128.png +0 -0
- package/icons/icon-144.png +0 -0
- package/icons/icon-152.png +0 -0
- package/icons/icon-192.png +0 -0
- package/icons/icon-384.png +0 -0
- package/icons/icon-512.png +0 -0
- package/icons/icon-72.png +0 -0
- package/icons/icon-96.png +0 -0
- package/js/console.js +60 -0
- package/js/modules/esptool.js +1 -1
- package/js/script.js +160 -117
- package/package.json +5 -5
- package/screenshots/desktop.png +0 -0
- package/screenshots/mobile.png +0 -0
- package/src/console.ts +28 -11
- package/src/const.ts +23 -0
- package/src/esp_loader.ts +812 -488
- package/src/flash_jedec.ts +114 -0
- package/sw.js +1 -1
package/apple-touch-icon.png
CHANGED
|
Binary file
|
package/dist/console.js
CHANGED
|
@@ -149,14 +149,25 @@ export class ESP32ToolConsole {
|
|
|
149
149
|
}
|
|
150
150
|
async _connect(abortSignal) {
|
|
151
151
|
console.log("Starting console read loop");
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
152
|
+
// Wait for readable stream to be available with timeout
|
|
153
|
+
const maxWaitTime = 3000; // 3 seconds
|
|
154
|
+
const startTime = Date.now();
|
|
155
|
+
while (!this.port.readable) {
|
|
156
|
+
const elapsed = Date.now() - startTime;
|
|
157
|
+
if (elapsed > maxWaitTime) {
|
|
158
|
+
this.console.addLine("");
|
|
159
|
+
this.console.addLine("");
|
|
160
|
+
this.console.addLine(`Terminal disconnected: Port readable stream not available after ${maxWaitTime}ms`);
|
|
161
|
+
this.console.addLine(`This can happen if:`);
|
|
162
|
+
this.console.addLine(`1. Port was just opened and streams are not ready yet`);
|
|
163
|
+
this.console.addLine(`2. Device was reset and port needs to be reopened`);
|
|
164
|
+
this.console.addLine(`3. USB device re-enumerated after reset`);
|
|
165
|
+
console.error("Port readable stream not available - port may need to be reopened at correct baudrate");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
159
169
|
}
|
|
170
|
+
console.log("Port readable stream is ready - starting console");
|
|
160
171
|
try {
|
|
161
172
|
await this.port
|
|
162
173
|
.readable.pipeThrough(new TextDecoderStream(), {
|
package/dist/const.d.ts
CHANGED
|
@@ -56,8 +56,10 @@ export declare const ESP32_SPI_MISO_DLEN_OFFS = 44;
|
|
|
56
56
|
export declare const ESP32_SPI_W0_OFFS = 128;
|
|
57
57
|
export declare const ESP32_UART_DATE_REG_ADDR = 1610612856;
|
|
58
58
|
export declare const ESP32_BOOTLOADER_FLASH_OFFSET = 4096;
|
|
59
|
+
export declare const ESP32_APB_CTL_DATE_ADDR: number;
|
|
59
60
|
export declare const ESP32S2_SPI_REG_BASE = 1061167104;
|
|
60
61
|
export declare const ESP32S2_BASEFUSEADDR = 1061265408;
|
|
62
|
+
export declare const ESP32S2_EFUSE_BLOCK1_ADDR: number;
|
|
61
63
|
export declare const ESP32S2_MACFUSEADDR = 1061265476;
|
|
62
64
|
export declare const ESP32S2_SPI_USR_OFFS = 24;
|
|
63
65
|
export declare const ESP32S2_SPI_USR1_OFFS = 28;
|
|
@@ -81,6 +83,7 @@ export declare const ESP32S2_UARTDEV_BUF_NO = 1073741076;
|
|
|
81
83
|
export declare const ESP32S2_UARTDEV_BUF_NO_USB_OTG = 2;
|
|
82
84
|
export declare const ESP32S3_SPI_REG_BASE = 1610620928;
|
|
83
85
|
export declare const ESP32S3_BASEFUSEADDR = 1610641408;
|
|
86
|
+
export declare const ESP32S3_EFUSE_BLOCK1_ADDR: number;
|
|
84
87
|
export declare const ESP32S3_MACFUSEADDR: number;
|
|
85
88
|
export declare const ESP32S3_SPI_USR_OFFS = 24;
|
|
86
89
|
export declare const ESP32S3_SPI_USR1_OFFS = 28;
|
|
@@ -105,6 +108,7 @@ export declare const ESP32S3_UARTDEV_BUF_NO_USB_OTG = 3;
|
|
|
105
108
|
export declare const ESP32S3_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 4;
|
|
106
109
|
export declare const ESP32C2_SPI_REG_BASE = 1610620928;
|
|
107
110
|
export declare const ESP32C2_BASEFUSEADDR = 1610647552;
|
|
111
|
+
export declare const ESP32C2_EFUSE_BLOCK2_ADDR: number;
|
|
108
112
|
export declare const ESP32C2_MACFUSEADDR: number;
|
|
109
113
|
export declare const ESP32C2_SPI_USR_OFFS = 24;
|
|
110
114
|
export declare const ESP32C2_SPI_USR1_OFFS = 28;
|
|
@@ -146,6 +150,7 @@ export declare const ESP32C3_EFUSE_RD_MAC_SPI_SYS_3_REG = 1610647632;
|
|
|
146
150
|
export declare const ESP32C3_EFUSE_RD_MAC_SPI_SYS_5_REG = 1610647640;
|
|
147
151
|
export declare const ESP32C5_SPI_REG_BASE = 1610625024;
|
|
148
152
|
export declare const ESP32C5_BASEFUSEADDR = 1611352064;
|
|
153
|
+
export declare const ESP32C5_EFUSE_BLOCK1_ADDR: number;
|
|
149
154
|
export declare const ESP32C5_MACFUSEADDR: number;
|
|
150
155
|
export declare const ESP32C5_SPI_USR_OFFS = 24;
|
|
151
156
|
export declare const ESP32C5_SPI_USR1_OFFS = 28;
|
|
@@ -154,11 +159,16 @@ export declare const ESP32C5_SPI_MOSI_DLEN_OFFS = 36;
|
|
|
154
159
|
export declare const ESP32C5_SPI_MISO_DLEN_OFFS = 40;
|
|
155
160
|
export declare const ESP32C5_SPI_W0_OFFS = 88;
|
|
156
161
|
export declare const ESP32C5_UART_DATE_REG_ADDR = 1610612860;
|
|
162
|
+
export declare const ESP32C5_UART_CLKDIV_REG = 1610612756;
|
|
157
163
|
export declare const ESP32C5_BOOTLOADER_FLASH_OFFSET = 8192;
|
|
164
|
+
export declare const ESP32C5_PCR_SYSCLK_CONF_REG = 1611227408;
|
|
165
|
+
export declare const ESP32C5_PCR_SYSCLK_XTAL_FREQ_V: number;
|
|
166
|
+
export declare const ESP32C5_PCR_SYSCLK_XTAL_FREQ_S = 24;
|
|
158
167
|
export declare const ESP32C5_UARTDEV_BUF_NO = 1082520852;
|
|
159
168
|
export declare const ESP32C5_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3;
|
|
160
169
|
export declare const ESP32C6_SPI_REG_BASE = 1610625024;
|
|
161
170
|
export declare const ESP32C6_BASEFUSEADDR = 1611335680;
|
|
171
|
+
export declare const ESP32C6_EFUSE_BLOCK1_ADDR: number;
|
|
162
172
|
export declare const ESP32C6_MACFUSEADDR: number;
|
|
163
173
|
export declare const ESP32C6_SPI_USR_OFFS = 24;
|
|
164
174
|
export declare const ESP32C6_SPI_USR1_OFFS = 28;
|
|
@@ -186,6 +196,7 @@ export declare const ESP32C5_C6_RTC_CNTL_SWD_AUTO_FEED_EN: number;
|
|
|
186
196
|
export declare const ESP32C5_C6_RTC_CNTL_SWD_WPROTECT_REG: number;
|
|
187
197
|
export declare const ESP32C61_SPI_REG_BASE = 1610625024;
|
|
188
198
|
export declare const ESP32C61_BASEFUSEADDR = 1611352064;
|
|
199
|
+
export declare const ESP32C61_EFUSE_BLOCK1_ADDR: number;
|
|
189
200
|
export declare const ESP32C61_MACFUSEADDR: number;
|
|
190
201
|
export declare const ESP32C61_SPI_USR_OFFS = 24;
|
|
191
202
|
export declare const ESP32C61_SPI_USR1_OFFS = 28;
|
|
@@ -195,8 +206,13 @@ export declare const ESP32C61_SPI_MISO_DLEN_OFFS = 40;
|
|
|
195
206
|
export declare const ESP32C61_SPI_W0_OFFS = 88;
|
|
196
207
|
export declare const ESP32C61_UART_DATE_REG_ADDR = 1610612860;
|
|
197
208
|
export declare const ESP32C61_BOOTLOADER_FLASH_OFFSET = 0;
|
|
209
|
+
export declare const ESP32C61_UARTDEV_BUF_NO_REV_LE2 = 1082455532;
|
|
210
|
+
export declare const ESP32C61_UARTDEV_BUF_NO_REV_GT2 = 1082455524;
|
|
211
|
+
export declare const ESP32C61_UARTDEV_BUF_NO_USB_JTAG_SERIAL_REV_LE2 = 3;
|
|
212
|
+
export declare const ESP32C61_UARTDEV_BUF_NO_USB_JTAG_SERIAL_REV_GT2 = 4;
|
|
198
213
|
export declare const ESP32H2_SPI_REG_BASE = 1610625024;
|
|
199
214
|
export declare const ESP32H2_BASEFUSEADDR = 1611335680;
|
|
215
|
+
export declare const ESP32H2_EFUSE_BLOCK1_ADDR: number;
|
|
200
216
|
export declare const ESP32H2_MACFUSEADDR: number;
|
|
201
217
|
export declare const ESP32H2_SPI_USR_OFFS = 24;
|
|
202
218
|
export declare const ESP32H2_SPI_USR1_OFFS = 28;
|
|
@@ -216,6 +232,7 @@ export declare const ESP32H2_UARTDEV_BUF_NO = 1082457852;
|
|
|
216
232
|
export declare const ESP32H2_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3;
|
|
217
233
|
export declare const ESP32H4_SPI_REG_BASE = 1611239424;
|
|
218
234
|
export declare const ESP32H4_BASEFUSEADDR = 1611339776;
|
|
235
|
+
export declare const ESP32H4_EFUSE_BLOCK1_ADDR: number;
|
|
219
236
|
export declare const ESP32H4_MACFUSEADDR: number;
|
|
220
237
|
export declare const ESP32H4_SPI_USR_OFFS = 24;
|
|
221
238
|
export declare const ESP32H4_SPI_USR1_OFFS = 28;
|
|
@@ -231,8 +248,11 @@ export declare const ESP32H4_RTC_CNTL_WDTCONFIG0_REG: number;
|
|
|
231
248
|
export declare const ESP32H4_RTC_CNTL_WDTCONFIG1_REG: number;
|
|
232
249
|
export declare const ESP32H4_RTC_CNTL_WDT_WKEY = 1356348065;
|
|
233
250
|
export declare const ESP32H4_RTC_CNTL_SWD_WKEY = 1356348065;
|
|
251
|
+
export declare const ESP32H4_UARTDEV_BUF_NO = 1082652032;
|
|
252
|
+
export declare const ESP32H4_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3;
|
|
234
253
|
export declare const ESP32H21_SPI_REG_BASE = 1610625024;
|
|
235
254
|
export declare const ESP32H21_BASEFUSEADDR = 1611350016;
|
|
255
|
+
export declare const ESP32H21_EFUSE_BLOCK1_ADDR: number;
|
|
236
256
|
export declare const ESP32H21_MACFUSEADDR: number;
|
|
237
257
|
export declare const ESP32H21_SPI_USR_OFFS = 24;
|
|
238
258
|
export declare const ESP32H21_SPI_USR1_OFFS = 28;
|
package/dist/const.js
CHANGED
|
@@ -75,8 +75,10 @@ export const ESP32_SPI_MISO_DLEN_OFFS = 0x2c;
|
|
|
75
75
|
export const ESP32_SPI_W0_OFFS = 0x80;
|
|
76
76
|
export const ESP32_UART_DATE_REG_ADDR = 0x60000078;
|
|
77
77
|
export const ESP32_BOOTLOADER_FLASH_OFFSET = 0x1000;
|
|
78
|
+
export const ESP32_APB_CTL_DATE_ADDR = 0x3ff66000 + 0x7c;
|
|
78
79
|
export const ESP32S2_SPI_REG_BASE = 0x3f402000;
|
|
79
80
|
export const ESP32S2_BASEFUSEADDR = 0x3f41a000;
|
|
81
|
+
export const ESP32S2_EFUSE_BLOCK1_ADDR = ESP32S2_BASEFUSEADDR + 0x044;
|
|
80
82
|
export const ESP32S2_MACFUSEADDR = 0x3f41a044;
|
|
81
83
|
export const ESP32S2_SPI_USR_OFFS = 0x18;
|
|
82
84
|
export const ESP32S2_SPI_USR1_OFFS = 0x1c;
|
|
@@ -102,6 +104,7 @@ export const ESP32S2_UARTDEV_BUF_NO = 0x3ffffd14; // Variable in ROM .bss which
|
|
|
102
104
|
export const ESP32S2_UARTDEV_BUF_NO_USB_OTG = 2; // Value of the above indicating that USB-OTG is in use
|
|
103
105
|
export const ESP32S3_SPI_REG_BASE = 0x60002000;
|
|
104
106
|
export const ESP32S3_BASEFUSEADDR = 0x60007000;
|
|
107
|
+
export const ESP32S3_EFUSE_BLOCK1_ADDR = ESP32S3_BASEFUSEADDR + 0x044;
|
|
105
108
|
export const ESP32S3_MACFUSEADDR = 0x60007000 + 0x044;
|
|
106
109
|
export const ESP32S3_SPI_USR_OFFS = 0x18;
|
|
107
110
|
export const ESP32S3_SPI_USR1_OFFS = 0x1c;
|
|
@@ -128,6 +131,7 @@ export const ESP32S3_UARTDEV_BUF_NO_USB_OTG = 3; // The above var when USB-OTG i
|
|
|
128
131
|
export const ESP32S3_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 4; // The above var when USB-JTAG/Serial is used
|
|
129
132
|
export const ESP32C2_SPI_REG_BASE = 0x60002000;
|
|
130
133
|
export const ESP32C2_BASEFUSEADDR = 0x60008800;
|
|
134
|
+
export const ESP32C2_EFUSE_BLOCK2_ADDR = ESP32C2_BASEFUSEADDR + 0x040;
|
|
131
135
|
export const ESP32C2_MACFUSEADDR = ESP32C2_BASEFUSEADDR + 0x040;
|
|
132
136
|
export const ESP32C2_SPI_USR_OFFS = 0x18;
|
|
133
137
|
export const ESP32C2_SPI_USR1_OFFS = 0x1c;
|
|
@@ -174,6 +178,7 @@ export const ESP32C3_EFUSE_RD_MAC_SPI_SYS_3_REG = 0x60008850;
|
|
|
174
178
|
export const ESP32C3_EFUSE_RD_MAC_SPI_SYS_5_REG = 0x60008858;
|
|
175
179
|
export const ESP32C5_SPI_REG_BASE = 0x60003000;
|
|
176
180
|
export const ESP32C5_BASEFUSEADDR = 0x600b4800;
|
|
181
|
+
export const ESP32C5_EFUSE_BLOCK1_ADDR = ESP32C5_BASEFUSEADDR + 0x044;
|
|
177
182
|
export const ESP32C5_MACFUSEADDR = 0x600b4800 + 0x044;
|
|
178
183
|
export const ESP32C5_SPI_USR_OFFS = 0x18;
|
|
179
184
|
export const ESP32C5_SPI_USR1_OFFS = 0x1c;
|
|
@@ -182,12 +187,18 @@ export const ESP32C5_SPI_MOSI_DLEN_OFFS = 0x24;
|
|
|
182
187
|
export const ESP32C5_SPI_MISO_DLEN_OFFS = 0x28;
|
|
183
188
|
export const ESP32C5_SPI_W0_OFFS = 0x58;
|
|
184
189
|
export const ESP32C5_UART_DATE_REG_ADDR = 0x6000007c;
|
|
190
|
+
export const ESP32C5_UART_CLKDIV_REG = 0x60000014;
|
|
185
191
|
export const ESP32C5_BOOTLOADER_FLASH_OFFSET = 0x2000;
|
|
192
|
+
// ESP32-C5 Crystal frequency detection registers
|
|
193
|
+
export const ESP32C5_PCR_SYSCLK_CONF_REG = 0x60096110;
|
|
194
|
+
export const ESP32C5_PCR_SYSCLK_XTAL_FREQ_V = 0x7f << 24;
|
|
195
|
+
export const ESP32C5_PCR_SYSCLK_XTAL_FREQ_S = 24;
|
|
186
196
|
// ESP32-C5 USB-JTAG/Serial detection
|
|
187
197
|
export const ESP32C5_UARTDEV_BUF_NO = 0x4085f514; // Variable in ROM .bss which indicates the port in use
|
|
188
198
|
export const ESP32C5_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3; // The above var when USB-JTAG/Serial is used
|
|
189
199
|
export const ESP32C6_SPI_REG_BASE = 0x60003000;
|
|
190
200
|
export const ESP32C6_BASEFUSEADDR = 0x600b0800;
|
|
201
|
+
export const ESP32C6_EFUSE_BLOCK1_ADDR = ESP32C6_BASEFUSEADDR + 0x044;
|
|
191
202
|
export const ESP32C6_MACFUSEADDR = 0x600b0800 + 0x044;
|
|
192
203
|
export const ESP32C6_SPI_USR_OFFS = 0x18;
|
|
193
204
|
export const ESP32C6_SPI_USR1_OFFS = 0x1c;
|
|
@@ -218,6 +229,7 @@ export const ESP32C5_C6_RTC_CNTL_SWD_AUTO_FEED_EN = 1 << 18;
|
|
|
218
229
|
export const ESP32C5_C6_RTC_CNTL_SWD_WPROTECT_REG = ESP32C5_C6_DR_REG_LP_WDT_BASE + 0x0020; // LP_WDT_SWD_WPROTECT_REG
|
|
219
230
|
export const ESP32C61_SPI_REG_BASE = 0x60003000;
|
|
220
231
|
export const ESP32C61_BASEFUSEADDR = 0x600b4800;
|
|
232
|
+
export const ESP32C61_EFUSE_BLOCK1_ADDR = ESP32C61_BASEFUSEADDR + 0x044;
|
|
221
233
|
export const ESP32C61_MACFUSEADDR = 0x600b4800 + 0x044;
|
|
222
234
|
export const ESP32C61_SPI_USR_OFFS = 0x18;
|
|
223
235
|
export const ESP32C61_SPI_USR1_OFFS = 0x1c;
|
|
@@ -227,8 +239,14 @@ export const ESP32C61_SPI_MISO_DLEN_OFFS = 0x28;
|
|
|
227
239
|
export const ESP32C61_SPI_W0_OFFS = 0x58;
|
|
228
240
|
export const ESP32C61_UART_DATE_REG_ADDR = 0x6000007c;
|
|
229
241
|
export const ESP32C61_BOOTLOADER_FLASH_OFFSET = 0x0000;
|
|
242
|
+
// ESP32-C61 USB-JTAG/Serial detection (dynamic based on chip revision)
|
|
243
|
+
export const ESP32C61_UARTDEV_BUF_NO_REV_LE2 = 0x4084f5ec; // revision <= 2
|
|
244
|
+
export const ESP32C61_UARTDEV_BUF_NO_REV_GT2 = 0x4084f5e4; // revision > 2
|
|
245
|
+
export const ESP32C61_UARTDEV_BUF_NO_USB_JTAG_SERIAL_REV_LE2 = 3; // revision <= 2
|
|
246
|
+
export const ESP32C61_UARTDEV_BUF_NO_USB_JTAG_SERIAL_REV_GT2 = 4; // revision > 2
|
|
230
247
|
export const ESP32H2_SPI_REG_BASE = 0x60003000;
|
|
231
248
|
export const ESP32H2_BASEFUSEADDR = 0x600b0800;
|
|
249
|
+
export const ESP32H2_EFUSE_BLOCK1_ADDR = ESP32H2_BASEFUSEADDR + 0x044;
|
|
232
250
|
export const ESP32H2_MACFUSEADDR = 0x600b0800 + 0x044;
|
|
233
251
|
export const ESP32H2_SPI_USR_OFFS = 0x18;
|
|
234
252
|
export const ESP32H2_SPI_USR1_OFFS = 0x1c;
|
|
@@ -250,6 +268,7 @@ export const ESP32H2_UARTDEV_BUF_NO = 0x4084fefc; // Variable in ROM .bss which
|
|
|
250
268
|
export const ESP32H2_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3; // The above var when USB-JTAG/Serial is used
|
|
251
269
|
export const ESP32H4_SPI_REG_BASE = 0x60099000;
|
|
252
270
|
export const ESP32H4_BASEFUSEADDR = 0x600b1800;
|
|
271
|
+
export const ESP32H4_EFUSE_BLOCK1_ADDR = ESP32H4_BASEFUSEADDR + 0x044;
|
|
253
272
|
export const ESP32H4_MACFUSEADDR = 0x600b1800 + 0x044;
|
|
254
273
|
export const ESP32H4_SPI_USR_OFFS = 0x18;
|
|
255
274
|
export const ESP32H4_SPI_USR1_OFFS = 0x1c;
|
|
@@ -266,8 +285,12 @@ export const ESP32H4_RTC_CNTL_WDTCONFIG0_REG = ESP32H4_DR_REG_LP_WDT_BASE + 0x00
|
|
|
266
285
|
export const ESP32H4_RTC_CNTL_WDTCONFIG1_REG = ESP32H4_DR_REG_LP_WDT_BASE + 0x0004; // LP_WDT_RWDT_CONFIG1_REG
|
|
267
286
|
export const ESP32H4_RTC_CNTL_WDT_WKEY = 0x50d83aa1; // LP_WDT_SWD_WKEY, same as WDT key in this case
|
|
268
287
|
export const ESP32H4_RTC_CNTL_SWD_WKEY = 0x50d83aa1; // LP_WDT_SWD_WKEY, same as WDT key in this case
|
|
288
|
+
// ESP32-H4 USB-JTAG/Serial detection
|
|
289
|
+
export const ESP32H4_UARTDEV_BUF_NO = 0x4087f580; // Variable in ROM .bss which indicates the port in use
|
|
290
|
+
export const ESP32H4_UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3; // The above var when USB-JTAG/Serial is used
|
|
269
291
|
export const ESP32H21_SPI_REG_BASE = 0x60003000;
|
|
270
292
|
export const ESP32H21_BASEFUSEADDR = 0x600b4000;
|
|
293
|
+
export const ESP32H21_EFUSE_BLOCK1_ADDR = ESP32H21_BASEFUSEADDR + 0x044;
|
|
271
294
|
export const ESP32H21_MACFUSEADDR = 0x600b4000 + 0x044;
|
|
272
295
|
export const ESP32H21_SPI_USR_OFFS = 0x18;
|
|
273
296
|
export const ESP32H21_SPI_USR1_OFFS = 0x1c;
|
package/dist/esp_loader.d.ts
CHANGED
|
@@ -84,9 +84,6 @@ export declare class ESPLoader extends EventTarget {
|
|
|
84
84
|
* Detect chip type using GET_SECURITY_INFO (for newer chips) or magic value (for older chips)
|
|
85
85
|
*/
|
|
86
86
|
detectChip(): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Get chip revision for ESP32-P4
|
|
89
|
-
*/
|
|
90
87
|
getChipRevision(): Promise<number>;
|
|
91
88
|
/**
|
|
92
89
|
* Power on the flash chip for ESP32-P4 Rev 301 (ECO6)
|
|
@@ -113,12 +110,12 @@ export declare class ESPLoader extends EventTarget {
|
|
|
113
110
|
* Reads data from the input stream and places it in the inputBuffer
|
|
114
111
|
*/
|
|
115
112
|
readLoop(): Promise<void>;
|
|
116
|
-
sleep(ms?: number): Promise<unknown>;
|
|
117
113
|
state_DTR: boolean;
|
|
118
114
|
state_RTS: boolean;
|
|
119
115
|
setRTS(state: boolean): Promise<void>;
|
|
120
116
|
setDTR(state: boolean): Promise<void>;
|
|
121
117
|
setDTRandRTS(dtr: boolean, rts: boolean): Promise<void>;
|
|
118
|
+
private runSignalSequence;
|
|
122
119
|
/**
|
|
123
120
|
* @name hardResetUSBJTAGSerial
|
|
124
121
|
* USB-JTAG/Serial reset for Web Serial (Desktop)
|
|
@@ -134,11 +131,6 @@ export declare class ESPLoader extends EventTarget {
|
|
|
134
131
|
* Keeps IO0=HIGH during reset so chip boots into firmware
|
|
135
132
|
*/
|
|
136
133
|
hardResetToFirmware(): Promise<void>;
|
|
137
|
-
/**
|
|
138
|
-
* Reset to firmware mode (not bootloader) for WebUSB
|
|
139
|
-
* Keeps IO0=HIGH during reset so chip boots into firmware
|
|
140
|
-
*/
|
|
141
|
-
hardResetToFirmwareWebUSB(): Promise<void>;
|
|
142
134
|
/**
|
|
143
135
|
* @name hardResetUnixTight
|
|
144
136
|
* Unix Tight reset for Web Serial (Desktop) - sets DTR and RTS simultaneously
|
|
@@ -147,26 +139,11 @@ export declare class ESPLoader extends EventTarget {
|
|
|
147
139
|
setRTSWebUSB(state: boolean): Promise<void>;
|
|
148
140
|
setDTRWebUSB(state: boolean): Promise<void>;
|
|
149
141
|
setDTRandRTSWebUSB(dtr: boolean, rts: boolean): Promise<void>;
|
|
150
|
-
/**
|
|
151
|
-
* @name hardResetUSBJTAGSerialWebUSB
|
|
152
|
-
* USB-JTAG/Serial reset for WebUSB (Android)
|
|
153
|
-
*/
|
|
154
|
-
hardResetUSBJTAGSerialWebUSB(): Promise<void>;
|
|
155
142
|
/**
|
|
156
143
|
* @name hardResetUSBJTAGSerialInvertedDTRWebUSB
|
|
157
144
|
* USB-JTAG/Serial reset with inverted DTR for WebUSB (Android)
|
|
158
145
|
*/
|
|
159
146
|
hardResetUSBJTAGSerialInvertedDTRWebUSB(): Promise<void>;
|
|
160
|
-
/**
|
|
161
|
-
* @name hardResetClassicWebUSB
|
|
162
|
-
* Classic reset for WebUSB (Android)
|
|
163
|
-
*/
|
|
164
|
-
hardResetClassicWebUSB(): Promise<void>;
|
|
165
|
-
/**
|
|
166
|
-
* @name hardResetUnixTightWebUSB
|
|
167
|
-
* Unix Tight reset for WebUSB (Android) - sets DTR and RTS simultaneously
|
|
168
|
-
*/
|
|
169
|
-
hardResetUnixTightWebUSB(): Promise<void>;
|
|
170
147
|
/**
|
|
171
148
|
* @name hardResetClassicLongDelayWebUSB
|
|
172
149
|
* Classic reset with longer delays for WebUSB (Android)
|
|
@@ -210,11 +187,6 @@ export declare class ESPLoader extends EventTarget {
|
|
|
210
187
|
* This is an alias for rtcWdtResetChipSpecific() for backwards compatibility
|
|
211
188
|
*/
|
|
212
189
|
watchdogReset(): Promise<void>;
|
|
213
|
-
/**
|
|
214
|
-
* Get chip revision for ESP32-C3
|
|
215
|
-
* Reads from EFUSE registers and calculates revision
|
|
216
|
-
*/
|
|
217
|
-
getChipRevisionC3(): Promise<number>;
|
|
218
190
|
/**
|
|
219
191
|
* RTC watchdog timer reset for ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C5, ESP32-C6, and ESP32-P4
|
|
220
192
|
* Uses specific registers for each chip family
|
|
@@ -222,10 +194,12 @@ export declare class ESPLoader extends EventTarget {
|
|
|
222
194
|
*/
|
|
223
195
|
rtcWdtResetChipSpecific(): Promise<void>;
|
|
224
196
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
197
|
+
* Reset device from bootloader mode to firmware mode
|
|
198
|
+
* Automatically selects the correct reset strategy based on USB connection type
|
|
199
|
+
* @param clearForceDownloadFlag - If true, clears the force download boot flag (USB-OTG only)
|
|
200
|
+
* @returns true if port will change (USB-OTG), false otherwise
|
|
227
201
|
*/
|
|
228
|
-
|
|
202
|
+
resetToFirmwareMode(clearForceDownloadFlag?: boolean): Promise<boolean>;
|
|
229
203
|
hardReset(bootloader?: boolean): Promise<void>;
|
|
230
204
|
/**
|
|
231
205
|
* @name macAddr
|
|
@@ -271,7 +245,10 @@ export declare class ESPLoader extends EventTarget {
|
|
|
271
245
|
* Calculate checksum of a blob, as it is defined by the ROM
|
|
272
246
|
*/
|
|
273
247
|
checksum(data: number[], state?: number): number;
|
|
248
|
+
getC5CrystalFreqRomExpect(): Promise<number>;
|
|
249
|
+
getC5CrystalFreqDetected(): Promise<number>;
|
|
274
250
|
setBaudrate(baud: number): Promise<void>;
|
|
251
|
+
private setBaudrateC5Rom;
|
|
275
252
|
reconfigurePort(baud: number): Promise<void>;
|
|
276
253
|
/**
|
|
277
254
|
* @name syncWithTimeout
|
|
@@ -386,6 +363,22 @@ export declare class ESPLoader extends EventTarget {
|
|
|
386
363
|
* @returns true if USB-JTAG or USB-OTG, false if external serial chip
|
|
387
364
|
*/
|
|
388
365
|
detectUsbConnectionType(): Promise<boolean>;
|
|
366
|
+
getUsbMode(): Promise<{
|
|
367
|
+
mode: "uart" | "usb-jtag-serial" | "usb-otg";
|
|
368
|
+
uartNo: number;
|
|
369
|
+
}>;
|
|
370
|
+
/**
|
|
371
|
+
* Check if the current chip supports USB-JTAG or USB-OTG
|
|
372
|
+
* @returns true if chip has native USB support (JTAG or OTG)
|
|
373
|
+
*/
|
|
374
|
+
supportsNativeUsb(): boolean;
|
|
375
|
+
/**
|
|
376
|
+
* @name _ensureStreamsReady
|
|
377
|
+
* After a hardware reset, ensure port streams are available.
|
|
378
|
+
* On WebUSB, recreates streams since they break after reset.
|
|
379
|
+
* On Web Serial, waits for streams to become available.
|
|
380
|
+
*/
|
|
381
|
+
private _ensureStreamsReady;
|
|
389
382
|
/**
|
|
390
383
|
* @name enterConsoleMode
|
|
391
384
|
* Prepare device for console mode by resetting to firmware
|
|
@@ -393,12 +386,6 @@ export declare class ESPLoader extends EventTarget {
|
|
|
393
386
|
* @returns true if port was closed (USB-JTAG), false if port stays open (serial chip)
|
|
394
387
|
*/
|
|
395
388
|
enterConsoleMode(): Promise<boolean>;
|
|
396
|
-
/**
|
|
397
|
-
* @name _resetToFirmwareIfNeeded
|
|
398
|
-
* Reset device from bootloader to firmware when switching to console mode
|
|
399
|
-
* Detects USB-JTAG/Serial and USB-OTG devices and performs appropriate reset
|
|
400
|
-
* @returns true if reconnect was performed, false otherwise
|
|
401
|
-
*/
|
|
402
389
|
/**
|
|
403
390
|
* @name _clearForceDownloadBootIfNeeded
|
|
404
391
|
* Read and clear the force download boot flag if it is set
|
|
@@ -407,6 +394,12 @@ export declare class ESPLoader extends EventTarget {
|
|
|
407
394
|
* Returns true if the flag was cleared, false if it was already clear
|
|
408
395
|
*/
|
|
409
396
|
private _clearForceDownloadBootIfNeeded;
|
|
397
|
+
/**
|
|
398
|
+
* @name _resetToFirmwareIfNeeded
|
|
399
|
+
* Reset device from bootloader to firmware when switching to console mode
|
|
400
|
+
* Detects USB-JTAG/Serial and USB-OTG devices and performs appropriate reset
|
|
401
|
+
* @returns true if reconnect was performed, false otherwise
|
|
402
|
+
*/
|
|
410
403
|
private _resetToFirmwareIfNeeded;
|
|
411
404
|
/**
|
|
412
405
|
* @name reconnectAndResume
|
|
@@ -442,6 +435,15 @@ export declare class ESPLoader extends EventTarget {
|
|
|
442
435
|
* This is a hardware limitation - use isConsoleResetSupported() to check first.
|
|
443
436
|
*/
|
|
444
437
|
resetInConsoleMode(): Promise<void>;
|
|
438
|
+
/**
|
|
439
|
+
* @name syncAndWdtReset
|
|
440
|
+
* Open a new bootloader port, sync with ROM (no stub, no reset strategies), and fire WDT reset.
|
|
441
|
+
* This is used for ESP32-S2 USB-OTG devices which require WDT reset to switch modes.
|
|
442
|
+
* After WDT reset the port will re-enumerate again.
|
|
443
|
+
* The user must select the new port after this method is called.
|
|
444
|
+
* @param newPort - The bootloader port selected by the user
|
|
445
|
+
*/
|
|
446
|
+
syncAndWdtReset(newPort: SerialPort): Promise<void>;
|
|
445
447
|
/**
|
|
446
448
|
* @name drainInputBuffer
|
|
447
449
|
* Actively drain the input buffer by reading data for a specified time.
|