Liu Song’s Projects


~/Projects/esptool-js

git clone https://code.lsong.org/esptool-js

Commit

Commit
b171a39a5a511766f46ce9d4066a1314137fa9c5
Author
Paul Kendall <[email protected]>
Date
2022-07-20 20:15:24 +1200 +1200
Diffstat
 ESPLoader.js | 6 ++++--

Allow passing the initial 'rom-baudrate' to the constructor


diff --git a/ESPLoader.js b/ESPLoader.js
index 4cebd0eec09f320f6e7cb9de200544c7cb746986..8fec440dad8a69a68a6f7c2aa6a2543a9ca7c7eb 100644
--- a/ESPLoader.js
+++ b/ESPLoader.js
@@ -48,10 +48,11 @@     CHIP_DETECT_MAGIC_REG_ADDR = 0x40001000;
 
     DETECTED_FLASH_SIZES = {0x12: '256KB', 0x13: '512KB', 0x14: '1MB', 0x15: '2MB', 0x16: '4MB', 0x17: '8MB', 0x18: '16MB'};
 
-    constructor(transport, baudrate, terminal) {
+    constructor(transport, baudrate, terminal, rom_baudrate = 115200) {
         this.transport = transport;
         this.baudrate = baudrate;
         this.terminal = terminal;
+        this.rom_baudrate = rom_baudrate;
         this.IS_STUB = false;
         this.chip = null;
 
@@ -280,7 +281,8 @@         var i;
         var resp;
         this.chip = null;
         this.write_char('Connecting...');
-    ESP_READ_REG = 0x0A;
+    [0x1b31506f]: () => import('./targets/esp32c3.js'),  // ESP32C3 eco3
+
         for (i = 0 ; i < attempts; i++) {
             resp = await this._connect_attempt({mode:mode, esp32r0_delay:false});
             if (resp === "success") {