mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 07:36:11 +00:00
vs-code server
This commit is contained in:
202
node_modules/esptool-js/LICENSE
generated
vendored
Normal file
202
node_modules/esptool-js/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Espressif Systems (Shanghai) CO LTD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
83
node_modules/esptool-js/README.md
generated
vendored
Normal file
83
node_modules/esptool-js/README.md
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
# Javascript implementation of esptool
|
||||
|
||||
This repository contains a Javascript implementation of [esptool](https://github.com/espressif/esptool), a serial flasher utility for Espressif chips. `esptool-js` is based on [Web Serial API](https://wicg.github.io/serial/) and works in Google Chrome and Microsoft Edge [version 89 or later](https://developer.mozilla.org/en-US/docs/Web/API/Serial#browser_compatibility) browsers and Google Chrome on Android [version 61 or later](https://developer.mozilla.org/en-US/docs/Web/API/USB#browser_compatibility) via the [web-serial-polyfill](https://github.com/google/web-serial-polyfill) compatibility layer.
|
||||
|
||||
**NOTE:** Unlike the Python-based esptool, `esptool-js` doesn't implement generation of binary images out of ELF files, and doesn't include companion tools similar to [espefuse.py](https://github.com/espressif/esptool/wiki/espefuse) and [espsecure.py](https://github.com/espressif/esptool/wiki/espsecure).
|
||||
|
||||
## Usage
|
||||
|
||||
**CDN**
|
||||
|
||||
`https://unpkg.com/esptool-js/lib/index.js` or `https://unpkg.com/esptool-js/bundle.js` to use the single bundle JavaScript file.
|
||||
|
||||
**NPM**
|
||||
|
||||
`npm install --save esptool-js`
|
||||
|
||||
**Yarn**
|
||||
|
||||
`yarn add --save esptool-js`
|
||||
|
||||
Check an example project [here](https://github.com/espressif/esptool-js/tree/main/examples/typescript).
|
||||
|
||||
**Nightly builds** for <a href="https://nightly.link/espressif/esptool-js/workflows/ci/main">ESPTOOL-JS</a>
|
||||
|
||||
## Define port filters for device using WebSerial
|
||||
|
||||
```js
|
||||
const portFilters: { usbVendorId?: number | undefined, usbProductId?: number | undefined }[] = [];
|
||||
const device = await navigator.serial.requestPort({ filters: portFilters });
|
||||
```
|
||||
|
||||
## Inject a Terminal to use with esptool-js
|
||||
|
||||
```js
|
||||
// You can use any JavaScript compatible terminal by wrapping it in a helper object like this:
|
||||
let espLoaderTerminal = {
|
||||
clean() {
|
||||
// Implement the clean function call for your terminal here.
|
||||
},
|
||||
writeLine(data) {
|
||||
// Implement the writeLine function call for your terminal here.
|
||||
},
|
||||
write(data) {
|
||||
// Implement the write function call for your terminal here.
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
You can pass this terminal object to `ESPLoader` constructor as shown in the [examples projects](./examples/).
|
||||
|
||||
## Live demo
|
||||
|
||||
Visit https://espressif.github.io/esptool-js/ to see this tool in action.
|
||||
|
||||
## Testing it locally
|
||||
|
||||
```sh
|
||||
npm install
|
||||
npm run build
|
||||
cd examples/typescript
|
||||
npm install
|
||||
npm run dev # Run local sever with example code
|
||||
```
|
||||
|
||||
Then open `http://localhost:1234` in a Chrome browser. The `npm run build` step builds the `lib` used in the example `examples/typescript/index.html`. Update this reference as described in [Usage](#usage) section.
|
||||
|
||||
## Test from Pull Request artifact
|
||||
|
||||
If you are testing the main branch or any Pull Request (PR) artifact you can follow these steps:
|
||||
|
||||
1. Get the `esptool-js-<version>.tgz` where `<version>` is the current version and download it.
|
||||
2. Add the following line to your project's package.json dependencies
|
||||
|
||||
```json
|
||||
"dependencies": {
|
||||
"esptool-js": "file:../path/to/esptool-js-<version>.tgz"
|
||||
}
|
||||
```
|
||||
3. Use the package like `import "esptool-js/lib/index.js"` when added in package.json as shown before.
|
||||
|
||||
## License
|
||||
|
||||
The code in this repository is Copyright (c) 2023 Espressif Systems (Shanghai) Co. Ltd. It is licensed under Apache 2.0 license, as described in [LICENSE](https://github.com/espressif/esptool-js/blob/main/LICENSE) file.
|
2
node_modules/esptool-js/bundle.js
generated
vendored
Normal file
2
node_modules/esptool-js/bundle.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
400
node_modules/esptool-js/lib/esploader.d.ts
generated
vendored
Normal file
400
node_modules/esptool-js/lib/esploader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,400 @@
|
||||
import { Transport } from "./webserial.js";
|
||||
import { ROM } from "./targets/rom.js";
|
||||
import { ResetStrategy } from "./reset.js";
|
||||
import { LoaderOptions } from "./types/loaderOptions.js";
|
||||
import { FlashOptions } from "./types/flashOptions.js";
|
||||
import { After, Before } from "./types/resetModes.js";
|
||||
declare type FlashReadCallback = ((packet: Uint8Array, progress: number, totalSize: number) => void) | null;
|
||||
export declare class ESPLoader {
|
||||
ESP_RAM_BLOCK: number;
|
||||
ESP_FLASH_BEGIN: number;
|
||||
ESP_FLASH_DATA: number;
|
||||
ESP_FLASH_END: number;
|
||||
ESP_MEM_BEGIN: number;
|
||||
ESP_MEM_END: number;
|
||||
ESP_MEM_DATA: number;
|
||||
ESP_WRITE_REG: number;
|
||||
ESP_READ_REG: number;
|
||||
ESP_SPI_ATTACH: number;
|
||||
ESP_CHANGE_BAUDRATE: number;
|
||||
ESP_FLASH_DEFL_BEGIN: number;
|
||||
ESP_FLASH_DEFL_DATA: number;
|
||||
ESP_FLASH_DEFL_END: number;
|
||||
ESP_SPI_FLASH_MD5: number;
|
||||
ESP_ERASE_FLASH: number;
|
||||
ESP_ERASE_REGION: number;
|
||||
ESP_READ_FLASH: number;
|
||||
ESP_RUN_USER_CODE: number;
|
||||
ESP_IMAGE_MAGIC: number;
|
||||
ESP_CHECKSUM_MAGIC: number;
|
||||
ROM_INVALID_RECV_MSG: number;
|
||||
DEFAULT_TIMEOUT: number;
|
||||
ERASE_REGION_TIMEOUT_PER_MB: number;
|
||||
ERASE_WRITE_TIMEOUT_PER_MB: number;
|
||||
MD5_TIMEOUT_PER_MB: number;
|
||||
CHIP_ERASE_TIMEOUT: number;
|
||||
FLASH_READ_TIMEOUT: number;
|
||||
MAX_TIMEOUT: number;
|
||||
CHIP_DETECT_MAGIC_REG_ADDR: number;
|
||||
DETECTED_FLASH_SIZES: {
|
||||
[key: number]: string;
|
||||
};
|
||||
DETECTED_FLASH_SIZES_NUM: {
|
||||
[key: number]: number;
|
||||
};
|
||||
USB_JTAG_SERIAL_PID: number;
|
||||
chip: ROM;
|
||||
IS_STUB: boolean;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
transport: Transport;
|
||||
private baudrate;
|
||||
private serialOptions?;
|
||||
private terminal?;
|
||||
private romBaudrate;
|
||||
private debugLogging;
|
||||
private syncStubDetected;
|
||||
private resetConstructors;
|
||||
/**
|
||||
* Create a new ESPLoader to perform serial communication
|
||||
* such as read/write flash memory and registers using a LoaderOptions object.
|
||||
* @param {LoaderOptions} options - LoaderOptions object argument for ESPLoader.
|
||||
* ```
|
||||
* const myLoader = new ESPLoader({ transport: Transport, baudrate: number, terminal?: IEspLoaderTerminal });
|
||||
* ```
|
||||
*/
|
||||
constructor(options: LoaderOptions);
|
||||
_sleep(ms: number): Promise<unknown>;
|
||||
/**
|
||||
* Write to ESP Loader constructor's terminal with or without new line.
|
||||
* @param {string} str - String to write.
|
||||
* @param {boolean} withNewline - Add new line at the end ?
|
||||
*/
|
||||
write(str: string, withNewline?: boolean): void;
|
||||
/**
|
||||
* Write error message to ESP Loader constructor's terminal with or without new line.
|
||||
* @param {string} str - String to write.
|
||||
* @param {boolean} withNewline - Add new line at the end ?
|
||||
*/
|
||||
error(str: string, withNewline?: boolean): void;
|
||||
/**
|
||||
* Write information message to ESP Loader constructor's terminal with or without new line.
|
||||
* @param {string} str - String to write.
|
||||
* @param {boolean} withNewline - Add new line at the end ?
|
||||
*/
|
||||
info(str: string, withNewline?: boolean): void;
|
||||
/**
|
||||
* Write debug message to ESP Loader constructor's terminal with or without new line.
|
||||
* @param {string} str - String to write.
|
||||
* @param {boolean} withNewline - Add new line at the end ?
|
||||
*/
|
||||
debug(str: string, withNewline?: boolean): void;
|
||||
/**
|
||||
* Convert short integer to byte array
|
||||
* @param {number} i - Number to convert.
|
||||
* @returns {Uint8Array} Byte array.
|
||||
*/
|
||||
_shortToBytearray(i: number): Uint8Array;
|
||||
/**
|
||||
* Convert an integer to byte array
|
||||
* @param {number} i - Number to convert.
|
||||
* @returns {ROM} The chip ROM class related to given magic hex number.
|
||||
*/
|
||||
_intToByteArray(i: number): Uint8Array;
|
||||
/**
|
||||
* Convert a byte array to short integer.
|
||||
* @param {number} i - Number to convert.
|
||||
* @param {number} j - Number to convert.
|
||||
* @returns {number} Return a short integer number.
|
||||
*/
|
||||
_byteArrayToShort(i: number, j: number): number;
|
||||
/**
|
||||
* Convert a byte array to integer.
|
||||
* @param {number} i - Number to convert.
|
||||
* @param {number} j - Number to convert.
|
||||
* @param {number} k - Number to convert.
|
||||
* @param {number} l - Number to convert.
|
||||
* @returns {number} Return a integer number.
|
||||
*/
|
||||
_byteArrayToInt(i: number, j: number, k: number, l: number): number;
|
||||
/**
|
||||
* Append a buffer array after another buffer array
|
||||
* @param {ArrayBuffer} buffer1 - First array buffer.
|
||||
* @param {ArrayBuffer} buffer2 - magic hex number to select ROM.
|
||||
* @returns {ArrayBufferLike} Return an array buffer.
|
||||
*/
|
||||
_appendBuffer(buffer1: ArrayBuffer, buffer2: ArrayBuffer): ArrayBufferLike;
|
||||
/**
|
||||
* Append a buffer array after another buffer array
|
||||
* @param {Uint8Array} arr1 - First array buffer.
|
||||
* @param {Uint8Array} arr2 - magic hex number to select ROM.
|
||||
* @returns {Uint8Array} Return a 8 bit unsigned array.
|
||||
*/
|
||||
_appendArray(arr1: Uint8Array, arr2: Uint8Array): Uint8Array;
|
||||
/**
|
||||
* Convert a unsigned 8 bit integer array to byte string.
|
||||
* @param {Uint8Array} u8Array - magic hex number to select ROM.
|
||||
* @returns {string} Return the equivalent string.
|
||||
*/
|
||||
ui8ToBstr(u8Array: Uint8Array): string;
|
||||
/**
|
||||
* Convert a byte string to unsigned 8 bit integer array.
|
||||
* @param {string} bStr - binary string input
|
||||
* @returns {Uint8Array} Return a 8 bit unsigned integer array.
|
||||
*/
|
||||
bstrToUi8(bStr: string): Uint8Array;
|
||||
/**
|
||||
* Flush the serial input by raw read with 200 ms timeout.
|
||||
*/
|
||||
flushInput(): Promise<void>;
|
||||
/**
|
||||
* Use the device serial port read function with given timeout to create a valid packet.
|
||||
* @param {number} op Operation number
|
||||
* @param {number} timeout timeout number in milliseconds
|
||||
* @returns {[number, Uint8Array]} valid response packet.
|
||||
*/
|
||||
readPacket(op?: number | null, timeout?: number): Promise<[number, Uint8Array]>;
|
||||
/**
|
||||
* Write a serial command to the chip
|
||||
* @param {number} op - Operation number
|
||||
* @param {Uint8Array} data - Unsigned 8 bit array
|
||||
* @param {number} chk - channel number
|
||||
* @param {boolean} waitResponse - wait for response ?
|
||||
* @param {number} timeout - timeout number in milliseconds
|
||||
* @returns {Promise<[number, Uint8Array]>} Return a number and a 8 bit unsigned integer array.
|
||||
*/
|
||||
command(op?: number | null, data?: Uint8Array, chk?: number, waitResponse?: boolean, timeout?: number): Promise<[number, Uint8Array]>;
|
||||
/**
|
||||
* Read a register from chip.
|
||||
* @param {number} addr - Register address number
|
||||
* @param {number} timeout - Timeout in milliseconds (Default: 3000ms)
|
||||
* @returns {number} - Command number value
|
||||
*/
|
||||
readReg(addr: number, timeout?: number): Promise<number>;
|
||||
/**
|
||||
* Write a number value to register address in chip.
|
||||
* @param {number} addr - Register address number
|
||||
* @param {number} value - Number value to write in register
|
||||
* @param {number} mask - Hex number for mask
|
||||
* @param {number} delayUs Delay number
|
||||
* @param {number} delayAfterUs Delay after previous delay
|
||||
*/
|
||||
writeReg(addr: number, value: number, mask?: number, delayUs?: number, delayAfterUs?: number): Promise<void>;
|
||||
/**
|
||||
* Sync chip by sending sync command.
|
||||
* @returns {[number, Uint8Array]} Command result
|
||||
*/
|
||||
sync(): Promise<[number, Uint8Array]>;
|
||||
/**
|
||||
* Attempt to connect to the chip by sending a reset sequence and later a sync command.
|
||||
* @param {string} mode - Reset mode to use
|
||||
* @param {ResetStrategy} resetStrategy - Reset strategy class to use for connect
|
||||
* @returns {string} - Returns 'success' or 'error' message.
|
||||
*/
|
||||
_connectAttempt(mode: string | undefined, resetStrategy: ResetStrategy | null): Promise<string>;
|
||||
/**
|
||||
* Constructs a sequence of reset strategies based on the OS,
|
||||
* used ESP chip, external settings, and environment variables.
|
||||
* Returns a tuple of one or more reset strategies to be tried sequentially.
|
||||
* @param {string} mode - Reset mode to use
|
||||
* @returns {ResetStrategy[]} - Array of reset strategies
|
||||
*/
|
||||
constructResetSequence(mode: Before): ResetStrategy[];
|
||||
/**
|
||||
* Perform a connection to chip.
|
||||
* @param {string} mode - Reset mode to use. Example: 'default_reset' | 'no_reset'
|
||||
* @param {number} attempts - Number of connection attempts
|
||||
* @param {boolean} detecting - Detect the connected chip
|
||||
*/
|
||||
connect(mode?: Before, attempts?: number, detecting?: boolean): Promise<void>;
|
||||
/**
|
||||
* Connect and detect the existing chip.
|
||||
* @param {string} mode Reset mode to use for connection.
|
||||
*/
|
||||
detectChip(mode?: Before): Promise<void>;
|
||||
/**
|
||||
* Execute the command and check the command response.
|
||||
* @param {string} opDescription Command operation description.
|
||||
* @param {number} op Command operation number
|
||||
* @param {Uint8Array} data Command value
|
||||
* @param {number} chk Checksum to use
|
||||
* @param {number} timeout TImeout number in milliseconds (ms)
|
||||
* @returns {number} Command result
|
||||
*/
|
||||
checkCommand(opDescription?: string, op?: number | null, data?: Uint8Array, chk?: number, timeout?: number): Promise<number | Uint8Array>;
|
||||
/**
|
||||
* Start downloading an application image to RAM
|
||||
* @param {number} size Image size number
|
||||
* @param {number} blocks Number of data blocks
|
||||
* @param {number} blocksize Size of each data block
|
||||
* @param {number} offset Image offset number
|
||||
*/
|
||||
memBegin(size: number, blocks: number, blocksize: number, offset: number): Promise<void>;
|
||||
/**
|
||||
* Get the checksum for given unsigned 8-bit array
|
||||
* @param {Uint8Array} data Unsigned 8-bit integer array
|
||||
* @param {number} state Initial checksum
|
||||
* @returns {number} - Array checksum
|
||||
*/
|
||||
checksum(data: Uint8Array, state?: number): number;
|
||||
/**
|
||||
* Send a block of image to RAM
|
||||
* @param {Uint8Array} buffer Unsigned 8-bit array
|
||||
* @param {number} seq Sequence number
|
||||
*/
|
||||
memBlock(buffer: Uint8Array, seq: number): Promise<void>;
|
||||
/**
|
||||
* Leave RAM download mode and run application
|
||||
* @param {number} entrypoint - Entrypoint number
|
||||
*/
|
||||
memFinish(entrypoint: number): Promise<void>;
|
||||
/**
|
||||
* Configure SPI flash pins
|
||||
* @param {number} hspiArg - Argument for SPI attachment
|
||||
*/
|
||||
flashSpiAttach(hspiArg: number): Promise<void>;
|
||||
/**
|
||||
* Scale timeouts which are size-specific.
|
||||
* @param {number} secondsPerMb Seconds per megabytes as number
|
||||
* @param {number} sizeBytes Size bytes number
|
||||
* @returns {number} - Scaled timeout for specified size.
|
||||
*/
|
||||
timeoutPerMb(secondsPerMb: number, sizeBytes: number): number;
|
||||
/**
|
||||
* Start downloading to Flash (performs an erase)
|
||||
* @param {number} size Size to erase
|
||||
* @param {number} offset Offset to erase
|
||||
* @returns {number} Number of blocks (of size self.FLASH_WRITE_SIZE) to write.
|
||||
*/
|
||||
flashBegin(size: number, offset: number): Promise<number>;
|
||||
/**
|
||||
* Start downloading compressed data to Flash (performs an erase)
|
||||
* @param {number} size Write size
|
||||
* @param {number} compsize Compressed size
|
||||
* @param {number} offset Offset for write
|
||||
* @returns {number} Returns number of blocks (size self.FLASH_WRITE_SIZE) to write.
|
||||
*/
|
||||
flashDeflBegin(size: number, compsize: number, offset: number): Promise<number>;
|
||||
/**
|
||||
* Write block to flash, retry if fail
|
||||
* @param {Uint8Array} data Unsigned 8-bit array data.
|
||||
* @param {number} seq Sequence number
|
||||
* @param {number} timeout Timeout in milliseconds (ms)
|
||||
*/
|
||||
flashBlock(data: Uint8Array, seq: number, timeout: number): Promise<void>;
|
||||
/**
|
||||
* Write block to flash, send compressed, retry if fail
|
||||
* @param {Uint8Array} data Unsigned int 8-bit array data to write
|
||||
* @param {number} seq Sequence number
|
||||
* @param {number} timeout Timeout in milliseconds (ms)
|
||||
*/
|
||||
flashDeflBlock(data: Uint8Array, seq: number, timeout: number): Promise<void>;
|
||||
/**
|
||||
* Leave flash mode and run/reboot
|
||||
* @param {boolean} reboot Reboot after leaving flash mode ?
|
||||
*/
|
||||
flashFinish(reboot?: boolean): Promise<void>;
|
||||
/**
|
||||
* Leave compressed flash mode and run/reboot
|
||||
* @param {boolean} reboot Reboot after leaving flash mode ?
|
||||
*/
|
||||
flashDeflFinish(reboot?: boolean): Promise<void>;
|
||||
/**
|
||||
* Run an arbitrary SPI flash command.
|
||||
*
|
||||
* This function uses the "USR_COMMAND" functionality in the ESP
|
||||
* SPI hardware, rather than the precanned commands supported by
|
||||
* hardware. So the value of spiflashCommand is an actual command
|
||||
* byte, sent over the wire.
|
||||
*
|
||||
* After writing command byte, writes 'data' to MOSI and then
|
||||
* reads back 'readBits' of reply on MISO. Result is a number.
|
||||
* @param {number} spiflashCommand Command to execute in SPI
|
||||
* @param {Uint8Array} data Data to send
|
||||
* @param {number} readBits Number of bits to read
|
||||
* @returns {number} Register SPI_W0_REG value
|
||||
*/
|
||||
runSpiflashCommand(spiflashCommand: number, data: Uint8Array, readBits: number): Promise<number>;
|
||||
/**
|
||||
* Read flash id by executing the SPIFLASH_RDID flash command.
|
||||
* @returns {Promise<number>} Register SPI_W0_REG value
|
||||
*/
|
||||
readFlashId(): Promise<number>;
|
||||
/**
|
||||
* Execute the erase flash command
|
||||
* @returns {Promise<number | Uint8Array>} Erase flash command result
|
||||
*/
|
||||
eraseFlash(): Promise<number | Uint8Array>;
|
||||
/**
|
||||
* Convert a number or unsigned 8-bit array to hex string
|
||||
* @param {number | Uint8Array } buffer Data to convert to hex string.
|
||||
* @returns {string} A hex string
|
||||
*/
|
||||
toHex(buffer: number | Uint8Array): string;
|
||||
/**
|
||||
* Calculate the MD5 Checksum command
|
||||
* @param {number} addr Address number
|
||||
* @param {number} size Package size
|
||||
* @returns {string} MD5 Checksum string
|
||||
*/
|
||||
flashMd5sum(addr: number, size: number): Promise<string>;
|
||||
readFlash(addr: number, size: number, onPacketReceived?: FlashReadCallback): Promise<Uint8Array>;
|
||||
/**
|
||||
* Upload the flasher ROM bootloader (flasher stub) to the chip.
|
||||
* @returns {ROM} The Chip ROM
|
||||
*/
|
||||
runStub(): Promise<ROM>;
|
||||
/**
|
||||
* Change the chip baudrate.
|
||||
*/
|
||||
changeBaud(): Promise<void>;
|
||||
/**
|
||||
* Execute the main function of ESPLoader.
|
||||
* @param {string} mode Reset mode to use
|
||||
* @returns {string} chip ROM
|
||||
*/
|
||||
main(mode?: Before): Promise<string>;
|
||||
/**
|
||||
* Get flash size bytes from flash size string.
|
||||
* @param {string} flashSize Flash Size string
|
||||
* @returns {number} Flash size bytes
|
||||
*/
|
||||
flashSizeBytes: (flashSize: string) => number;
|
||||
/**
|
||||
* Parse a given flash size string to a number
|
||||
* @param {string} flsz Flash size to request
|
||||
* @returns {number} Flash size number
|
||||
*/
|
||||
parseFlashSizeArg(flsz: string): number;
|
||||
/**
|
||||
* Update the image flash parameters with given arguments.
|
||||
* @param {string} image binary image as string
|
||||
* @param {number} address flash address number
|
||||
* @param {string} flashSize Flash size string
|
||||
* @param {string} flashMode Flash mode string
|
||||
* @param {string} flashFreq Flash frequency string
|
||||
* @returns {string} modified image string
|
||||
*/
|
||||
_updateImageFlashParams(image: string, address: number, flashSize: string, flashMode: string, flashFreq: string): string;
|
||||
/**
|
||||
* Write set of file images into given address based on given FlashOptions object.
|
||||
* @param {FlashOptions} options FlashOptions to configure how and what to write into flash.
|
||||
*/
|
||||
writeFlash(options: FlashOptions): Promise<void>;
|
||||
/**
|
||||
* Read SPI flash manufacturer and device id.
|
||||
*/
|
||||
flashId(): Promise<void>;
|
||||
getFlashSize(): Promise<number>;
|
||||
/**
|
||||
* Soft reset the device chip. Soft reset with run user code is the closest.
|
||||
* @param {boolean} stayInBootloader Flag to indicate if to stay in bootloader
|
||||
*/
|
||||
softReset(stayInBootloader: boolean): Promise<void>;
|
||||
/**
|
||||
* Execute this function to execute after operation reset functions.
|
||||
* @param {After} mode After operation mode. Default is 'hard_reset'.
|
||||
* @param { boolean } usingUsbOtg For 'hard_reset' to specify if using USB-OTG
|
||||
*/
|
||||
after(mode?: After, usingUsbOtg?: boolean): Promise<void>;
|
||||
}
|
||||
export {};
|
1359
node_modules/esptool-js/lib/esploader.js
generated
vendored
Normal file
1359
node_modules/esptool-js/lib/esploader.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
node_modules/esptool-js/lib/index.d.ts
generated
vendored
Normal file
9
node_modules/esptool-js/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export { ESPLoader } from "./esploader.js";
|
||||
export { ClassicReset, CustomReset, HardReset, UsbJtagSerialReset, validateCustomResetStringSequence, ResetConstructors, } from "./reset.js";
|
||||
export { ROM } from "./targets/rom.js";
|
||||
export { Transport, SerialOptions } from "./webserial.js";
|
||||
export { decodeBase64Data, getStubJsonByChipName, Stub } from "./stubFlasher.js";
|
||||
export { LoaderOptions } from "./types/loaderOptions.js";
|
||||
export { FlashOptions } from "./types/flashOptions.js";
|
||||
export { IEspLoaderTerminal } from "./types/loaderTerminal.js";
|
||||
export { Before, After } from "./types/resetModes.js";
|
5
node_modules/esptool-js/lib/index.js
generated
vendored
Normal file
5
node_modules/esptool-js/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { ESPLoader } from "./esploader.js";
|
||||
export { ClassicReset, CustomReset, HardReset, UsbJtagSerialReset, validateCustomResetStringSequence, } from "./reset.js";
|
||||
export { ROM } from "./targets/rom.js";
|
||||
export { Transport } from "./webserial.js";
|
||||
export { decodeBase64Data, getStubJsonByChipName } from "./stubFlasher.js";
|
149
node_modules/esptool-js/lib/reset.d.ts
generated
vendored
Normal file
149
node_modules/esptool-js/lib/reset.d.ts
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
import { Transport } from "./webserial.js";
|
||||
/**
|
||||
* Set of reset functions for ESP Loader connection.
|
||||
* @interface ResetConstructors
|
||||
*/
|
||||
export interface ResetConstructors {
|
||||
/**
|
||||
* Execute a classic set of commands that will reset the chip.
|
||||
* @param transport Transport class to perform serial communication.
|
||||
* @param resetDelay Delay in milliseconds for reset.
|
||||
*/
|
||||
classicReset?: (transport: Transport, resetDelay: number) => ClassicReset;
|
||||
/**
|
||||
* Execute a set of commands for USB JTAG serial reset.
|
||||
* @param transport Transport class to perform serial communication.
|
||||
*/
|
||||
usbJTAGSerialReset?: (transport: Transport) => UsbJtagSerialReset;
|
||||
/**
|
||||
* Execute a classic set of commands that will reset the chip.
|
||||
* @param transport Transport class to perform serial communication.
|
||||
* @param {boolean} usingUsbOtg is it using USB-OTG ?
|
||||
*/
|
||||
hardReset?: (transport: Transport, usingUsbOtg?: boolean) => HardReset;
|
||||
/**
|
||||
* Execute a custom set of commands that will reset the chip.
|
||||
* @param transport Transport class to perform serial communication.
|
||||
* @param {string} sequenceString Custom string sequence for reset strategy
|
||||
*/
|
||||
customReset?: (transport: Transport, sequenceString: string) => CustomReset;
|
||||
}
|
||||
/**
|
||||
* Reset strategy class
|
||||
*/
|
||||
export interface ResetStrategy {
|
||||
transport: Transport;
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Execute a classic set of commands that will reset the chip.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
*
|
||||
* "D0|R1|W100|D1|R0|W50|D0" represents the classic reset strategy
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {number} resetDelay Delay in milliseconds for reset.
|
||||
*/
|
||||
export declare class ClassicReset implements ResetStrategy {
|
||||
resetDelay: number;
|
||||
transport: Transport;
|
||||
constructor(transport: Transport, resetDelay: number);
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Execute a set of commands for USB JTAG serial reset.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
*/
|
||||
export declare class UsbJtagSerialReset implements ResetStrategy {
|
||||
transport: Transport;
|
||||
constructor(transport: Transport);
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Execute a set of commands that will hard reset the chip.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {boolean} usingUsbOtg is it using USB-OTG ?
|
||||
*/
|
||||
export declare class HardReset implements ResetStrategy {
|
||||
transport: Transport;
|
||||
private usingUsbOtg;
|
||||
constructor(transport: Transport, usingUsbOtg?: boolean);
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Validate a sequence string based on the following format:
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {string} seqStr Sequence string to validate
|
||||
* @returns {boolean} Is the sequence string valid ?
|
||||
*/
|
||||
export declare function validateCustomResetStringSequence(seqStr: string): boolean;
|
||||
/**
|
||||
* Custom reset strategy defined with a string.
|
||||
*
|
||||
* The sequenceString input string consists of individual commands divided by "|".
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
*
|
||||
* "D0|R1|W100|D1|R0|W50|D0" represents the classic reset strategy
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {string} sequenceString Custom string sequence for reset strategy
|
||||
*/
|
||||
export declare class CustomReset implements ResetStrategy {
|
||||
transport: Transport;
|
||||
private sequenceString;
|
||||
constructor(transport: Transport, sequenceString: string);
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
declare const _default: {
|
||||
ClassicReset: typeof ClassicReset;
|
||||
CustomReset: typeof CustomReset;
|
||||
HardReset: typeof HardReset;
|
||||
UsbJtagSerialReset: typeof UsbJtagSerialReset;
|
||||
validateCustomResetStringSequence: typeof validateCustomResetStringSequence;
|
||||
};
|
||||
export default _default;
|
198
node_modules/esptool-js/lib/reset.js
generated
vendored
Normal file
198
node_modules/esptool-js/lib/reset.js
generated
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* Sleep for ms milliseconds
|
||||
* @param {number} ms Milliseconds to wait
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
/**
|
||||
* Execute a classic set of commands that will reset the chip.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
*
|
||||
* "D0|R1|W100|D1|R0|W50|D0" represents the classic reset strategy
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {number} resetDelay Delay in milliseconds for reset.
|
||||
*/
|
||||
export class ClassicReset {
|
||||
constructor(transport, resetDelay) {
|
||||
this.resetDelay = resetDelay;
|
||||
this.transport = transport;
|
||||
}
|
||||
async reset() {
|
||||
await this.transport.setDTR(false);
|
||||
await this.transport.setRTS(true);
|
||||
await sleep(100);
|
||||
await this.transport.setDTR(true);
|
||||
await this.transport.setRTS(false);
|
||||
await sleep(this.resetDelay);
|
||||
await this.transport.setDTR(false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute a set of commands for USB JTAG serial reset.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
*/
|
||||
export class UsbJtagSerialReset {
|
||||
constructor(transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
async reset() {
|
||||
await this.transport.setRTS(false);
|
||||
await this.transport.setDTR(false);
|
||||
await sleep(100);
|
||||
await this.transport.setDTR(true);
|
||||
await this.transport.setRTS(false);
|
||||
await sleep(100);
|
||||
await this.transport.setRTS(true);
|
||||
await this.transport.setDTR(false);
|
||||
await this.transport.setRTS(true);
|
||||
await sleep(100);
|
||||
await this.transport.setRTS(false);
|
||||
await this.transport.setDTR(false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute a set of commands that will hard reset the chip.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {boolean} usingUsbOtg is it using USB-OTG ?
|
||||
*/
|
||||
export class HardReset {
|
||||
constructor(transport, usingUsbOtg = false) {
|
||||
this.transport = transport;
|
||||
this.usingUsbOtg = usingUsbOtg;
|
||||
this.transport = transport;
|
||||
}
|
||||
async reset() {
|
||||
if (this.usingUsbOtg) {
|
||||
await sleep(200);
|
||||
await this.transport.setRTS(false);
|
||||
await sleep(200);
|
||||
}
|
||||
else {
|
||||
await sleep(100);
|
||||
await this.transport.setRTS(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Validate a sequence string based on the following format:
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {string} seqStr Sequence string to validate
|
||||
* @returns {boolean} Is the sequence string valid ?
|
||||
*/
|
||||
export function validateCustomResetStringSequence(seqStr) {
|
||||
const commands = ["D", "R", "W"];
|
||||
const commandsList = seqStr.split("|");
|
||||
for (const cmd of commandsList) {
|
||||
const code = cmd[0];
|
||||
const arg = cmd.slice(1);
|
||||
if (!commands.includes(code)) {
|
||||
return false; // Invalid command code
|
||||
}
|
||||
if (code === "D" || code === "R") {
|
||||
if (arg !== "0" && arg !== "1") {
|
||||
return false; // Invalid argument for D and R commands
|
||||
}
|
||||
}
|
||||
else if (code === "W") {
|
||||
const delay = parseInt(arg);
|
||||
if (isNaN(delay) || delay <= 0) {
|
||||
return false; // Invalid argument for W command
|
||||
}
|
||||
}
|
||||
}
|
||||
return true; // All commands are valid
|
||||
}
|
||||
/**
|
||||
* Custom reset strategy defined with a string.
|
||||
*
|
||||
* The sequenceString input string consists of individual commands divided by "|".
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
*
|
||||
* "D0|R1|W100|D1|R0|W50|D0" represents the classic reset strategy
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {string} sequenceString Custom string sequence for reset strategy
|
||||
*/
|
||||
export class CustomReset {
|
||||
constructor(transport, sequenceString) {
|
||||
this.transport = transport;
|
||||
this.sequenceString = sequenceString;
|
||||
this.transport = transport;
|
||||
}
|
||||
async reset() {
|
||||
const resetDictionary = {
|
||||
D: async (arg) => await this.transport.setDTR(arg),
|
||||
R: async (arg) => await this.transport.setRTS(arg),
|
||||
W: async (delay) => await sleep(delay),
|
||||
};
|
||||
try {
|
||||
const isValidSequence = validateCustomResetStringSequence(this.sequenceString);
|
||||
if (!isValidSequence) {
|
||||
return;
|
||||
}
|
||||
const cmds = this.sequenceString.split("|");
|
||||
for (const cmd of cmds) {
|
||||
const cmdKey = cmd[0];
|
||||
const cmdVal = cmd.slice(1);
|
||||
if (cmdKey === "W") {
|
||||
await resetDictionary["W"](Number(cmdVal));
|
||||
}
|
||||
else if (cmdKey === "D" || cmdKey === "R") {
|
||||
await resetDictionary[cmdKey](cmdVal === "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error("Invalid custom reset sequence");
|
||||
}
|
||||
}
|
||||
}
|
||||
export default { ClassicReset, CustomReset, HardReset, UsbJtagSerialReset, validateCustomResetStringSequence };
|
22
node_modules/esptool-js/lib/stubFlasher.d.ts
generated
vendored
Normal file
22
node_modules/esptool-js/lib/stubFlasher.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export interface Stub {
|
||||
bss_start?: number;
|
||||
data: string;
|
||||
decodedData: Uint8Array;
|
||||
data_start: number;
|
||||
entry: number;
|
||||
text: string;
|
||||
decodedText: Uint8Array;
|
||||
text_start: number;
|
||||
}
|
||||
/**
|
||||
* Import flash stub json for the given chip name.
|
||||
* @param {string} chipName Name of chip to obtain flasher stub
|
||||
* @returns {Stub} Stub information and decoded text and data
|
||||
*/
|
||||
export declare function getStubJsonByChipName(chipName: string): Promise<Stub | undefined>;
|
||||
/**
|
||||
* Convert a base 64 string to Uint8Array.
|
||||
* @param {string} dataStr Base64 String to decode
|
||||
* @returns {Uint8Array} Decoded Uint8Array
|
||||
*/
|
||||
export declare function decodeBase64Data(dataStr: string): Uint8Array;
|
69
node_modules/esptool-js/lib/stubFlasher.js
generated
vendored
Normal file
69
node_modules/esptool-js/lib/stubFlasher.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import atob from "atob-lite";
|
||||
/**
|
||||
* Import flash stub json for the given chip name.
|
||||
* @param {string} chipName Name of chip to obtain flasher stub
|
||||
* @returns {Stub} Stub information and decoded text and data
|
||||
*/
|
||||
export async function getStubJsonByChipName(chipName) {
|
||||
let jsonStub;
|
||||
switch (chipName) {
|
||||
case "ESP32":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32.json");
|
||||
break;
|
||||
case "ESP32-C2":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c2.json");
|
||||
break;
|
||||
case "ESP32-C3":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c3.json");
|
||||
break;
|
||||
case "ESP32-C5":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c5.json");
|
||||
break;
|
||||
case "ESP32-C6":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c6.json");
|
||||
break;
|
||||
case "ESP32-C61":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c61.json");
|
||||
break;
|
||||
case "ESP32-H2":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32h2.json");
|
||||
break;
|
||||
case "ESP32-P4":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32p4.json");
|
||||
break;
|
||||
case "ESP32-S2":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32s2.json");
|
||||
break;
|
||||
case "ESP32-S3":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32s3.json");
|
||||
break;
|
||||
case "ESP8266":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_8266.json");
|
||||
break;
|
||||
}
|
||||
if (jsonStub) {
|
||||
return {
|
||||
bss_start: jsonStub.bss_start,
|
||||
data: jsonStub.data,
|
||||
data_start: jsonStub.data_start,
|
||||
entry: jsonStub.entry,
|
||||
text: jsonStub.text,
|
||||
text_start: jsonStub.text_start,
|
||||
decodedData: decodeBase64Data(jsonStub.data),
|
||||
decodedText: decodeBase64Data(jsonStub.text),
|
||||
};
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Convert a base 64 string to Uint8Array.
|
||||
* @param {string} dataStr Base64 String to decode
|
||||
* @returns {Uint8Array} Decoded Uint8Array
|
||||
*/
|
||||
export function decodeBase64Data(dataStr) {
|
||||
const decoded = atob(dataStr);
|
||||
const chardata = decoded.split("").map(function (x) {
|
||||
return x.charCodeAt(0);
|
||||
});
|
||||
return new Uint8Array(chardata);
|
||||
}
|
32
node_modules/esptool-js/lib/targets/esp32.d.ts
generated
vendored
Normal file
32
node_modules/esptool-js/lib/targets/esp32.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
DR_REG_SYSCON_BASE: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
XTAL_CLK_DIVIDER: number;
|
||||
FLASH_SIZES: {
|
||||
[key: string]: number;
|
||||
};
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
readEfuse(loader: ESPLoader, offset: number): Promise<number>;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipRevision(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
}
|
185
node_modules/esptool-js/lib/targets/esp32.js
generated
vendored
Normal file
185
node_modules/esptool-js/lib/targets/esp32.js
generated
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32";
|
||||
this.IMAGE_CHIP_ID = 0;
|
||||
this.EFUSE_RD_REG_BASE = 0x3ff5a000;
|
||||
this.DR_REG_SYSCON_BASE = 0x3ff66000;
|
||||
this.UART_CLKDIV_REG = 0x3ff40014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x60000078;
|
||||
this.XTAL_CLK_DIVIDER = 1;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x1000;
|
||||
this.SPI_REG_BASE = 0x3ff42000;
|
||||
this.SPI_USR_OFFS = 0x1c;
|
||||
this.SPI_USR1_OFFS = 0x20;
|
||||
this.SPI_USR2_OFFS = 0x24;
|
||||
this.SPI_W0_OFFS = 0x80;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x28;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x2c;
|
||||
}
|
||||
async readEfuse(loader, offset) {
|
||||
const addr = this.EFUSE_RD_REG_BASE + 4 * offset;
|
||||
loader.debug("Read efuse " + addr);
|
||||
return await loader.readReg(addr);
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const word3 = await this.readEfuse(loader, 3);
|
||||
let pkgVersion = (word3 >> 9) & 0x07;
|
||||
pkgVersion += ((word3 >> 2) & 0x1) << 3;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getChipRevision(loader) {
|
||||
const word3 = await this.readEfuse(loader, 3);
|
||||
const word5 = await this.readEfuse(loader, 5);
|
||||
const apbCtlDate = await loader.readReg(this.DR_REG_SYSCON_BASE + 0x7c);
|
||||
const revBit0 = (word3 >> 15) & 0x1;
|
||||
const revBit1 = (word5 >> 20) & 0x1;
|
||||
const revBit2 = (apbCtlDate >> 31) & 0x1;
|
||||
if (revBit0 != 0) {
|
||||
if (revBit1 != 0) {
|
||||
if (revBit2 != 0) {
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const chipDesc = [
|
||||
"ESP32-D0WDQ6",
|
||||
"ESP32-D0WD",
|
||||
"ESP32-D2WD",
|
||||
"",
|
||||
"ESP32-U4WDH",
|
||||
"ESP32-PICO-D4",
|
||||
"ESP32-PICO-V3-02",
|
||||
];
|
||||
let chipName = "";
|
||||
const pkgVersion = await this.getPkgVersion(loader);
|
||||
const chipRevision = await this.getChipRevision(loader);
|
||||
const rev3 = chipRevision == 3;
|
||||
const single_core = (await this.readEfuse(loader, 3)) & (1 << 0);
|
||||
if (single_core != 0) {
|
||||
chipDesc[0] = "ESP32-S0WDQ6";
|
||||
chipDesc[1] = "ESP32-S0WD";
|
||||
}
|
||||
if (rev3) {
|
||||
chipDesc[5] = "ESP32-PICO-V3";
|
||||
}
|
||||
if (pkgVersion >= 0 && pkgVersion <= 6) {
|
||||
chipName = chipDesc[pkgVersion];
|
||||
}
|
||||
else {
|
||||
chipName = "Unknown ESP32";
|
||||
}
|
||||
if (rev3 && (pkgVersion === 0 || pkgVersion === 1)) {
|
||||
chipName += "-V3";
|
||||
}
|
||||
return chipName + " (revision " + chipRevision + ")";
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
const features = ["Wi-Fi"];
|
||||
const word3 = await this.readEfuse(loader, 3);
|
||||
const chipVerDisBt = word3 & (1 << 1);
|
||||
if (chipVerDisBt === 0) {
|
||||
features.push(" BT");
|
||||
}
|
||||
const chipVerDisAppCpu = word3 & (1 << 0);
|
||||
if (chipVerDisAppCpu !== 0) {
|
||||
features.push(" Single Core");
|
||||
}
|
||||
else {
|
||||
features.push(" Dual Core");
|
||||
}
|
||||
const chipCpuFreqRated = word3 & (1 << 13);
|
||||
if (chipCpuFreqRated !== 0) {
|
||||
const chipCpuFreqLow = word3 & (1 << 12);
|
||||
if (chipCpuFreqLow !== 0) {
|
||||
features.push(" 160MHz");
|
||||
}
|
||||
else {
|
||||
features.push(" 240MHz");
|
||||
}
|
||||
}
|
||||
const pkgVersion = await this.getPkgVersion(loader);
|
||||
if ([2, 4, 5, 6].indexOf(pkgVersion) !== -1) {
|
||||
features.push(" Embedded Flash");
|
||||
}
|
||||
if (pkgVersion === 6) {
|
||||
features.push(" Embedded PSRAM");
|
||||
}
|
||||
const word4 = await this.readEfuse(loader, 4);
|
||||
const adcVref = (word4 >> 8) & 0x1f;
|
||||
if (adcVref !== 0) {
|
||||
features.push(" VRef calibration in efuse");
|
||||
}
|
||||
const blk3PartRes = (word3 >> 14) & 0x1;
|
||||
if (blk3PartRes !== 0) {
|
||||
features.push(" BLK3 partially reserved");
|
||||
}
|
||||
const word6 = await this.readEfuse(loader, 6);
|
||||
const codingScheme = word6 & 0x3;
|
||||
const codingSchemeArr = ["None", "3/4", "Repeat (UNSUPPORTED)", "Invalid"];
|
||||
features.push(" Coding Scheme " + codingSchemeArr[codingScheme]);
|
||||
return features;
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
const uartDiv = (await loader.readReg(this.UART_CLKDIV_REG)) & this.UART_CLKDIV_MASK;
|
||||
const etsXtal = (loader.transport.baudrate * uartDiv) / 1000000 / this.XTAL_CLK_DIVIDER;
|
||||
let normXtal;
|
||||
if (etsXtal > 33) {
|
||||
normXtal = 40;
|
||||
}
|
||||
else {
|
||||
normXtal = 26;
|
||||
}
|
||||
if (Math.abs(normXtal - etsXtal) > 1) {
|
||||
loader.info("WARNING: Unsupported crystal in use");
|
||||
}
|
||||
return normXtal;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await this.readEfuse(loader, 1);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await this.readEfuse(loader, 2);
|
||||
mac1 = mac1 >>> 0;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
}
|
37
node_modules/esptool-js/lib/targets/esp32c2.d.ts
generated
vendored
Normal file
37
node_modules/esptool-js/lib/targets/esp32c2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ESP32C3ROM } from "./esp32c3.js";
|
||||
export declare class ESP32C2ROM extends ESP32C3ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
XTAL_CLK_DIVIDER: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipRevision(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
changeBaudRate(loader: ESPLoader): Promise<void>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
114
node_modules/esptool-js/lib/targets/esp32c2.js
generated
vendored
Normal file
114
node_modules/esptool-js/lib/targets/esp32c2.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
import { ESP32C3ROM } from "./esp32c3.js";
|
||||
export class ESP32C2ROM extends ESP32C3ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C2";
|
||||
this.IMAGE_CHIP_ID = 12;
|
||||
this.EFUSE_BASE = 0x60008800;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x040;
|
||||
this.UART_CLKDIV_REG = 0x60000014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x6000007c;
|
||||
this.XTAL_CLK_DIVIDER = 1;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 1;
|
||||
const block1Addr = this.EFUSE_BASE + 0x040;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const word3 = await loader.readReg(addr);
|
||||
const pkgVersion = (word3 >> 22) & 0x07;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getChipRevision(loader) {
|
||||
const block1Addr = this.EFUSE_BASE + 0x040;
|
||||
const numWord = 1;
|
||||
const pos = 20;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const ret = ((await loader.readReg(addr)) & (0x03 << pos)) >> pos;
|
||||
return ret;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
let desc;
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
if (pkgVer === 0 || pkgVer === 1) {
|
||||
desc = "ESP32-C2";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C2";
|
||||
}
|
||||
const chip_rev = await this.getChipRevision(loader);
|
||||
desc += " (revision " + chip_rev + ")";
|
||||
return desc;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["Wi-Fi", "BLE"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
const uartDiv = (await loader.readReg(this.UART_CLKDIV_REG)) & this.UART_CLKDIV_MASK;
|
||||
const etsXtal = (loader.transport.baudrate * uartDiv) / 1000000 / this.XTAL_CLK_DIVIDER;
|
||||
let normXtal;
|
||||
if (etsXtal > 33) {
|
||||
normXtal = 40;
|
||||
}
|
||||
else {
|
||||
normXtal = 26;
|
||||
}
|
||||
if (Math.abs(normXtal - etsXtal) > 1) {
|
||||
loader.info("WARNING: Unsupported crystal in use");
|
||||
}
|
||||
return normXtal;
|
||||
}
|
||||
async changeBaudRate(loader) {
|
||||
const rom_with_26M_XTAL = await this.getCrystalFreq(loader);
|
||||
if (rom_with_26M_XTAL === 26) {
|
||||
loader.changeBaud();
|
||||
}
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
37
node_modules/esptool-js/lib/targets/esp32c3.d.ts
generated
vendored
Normal file
37
node_modules/esptool-js/lib/targets/esp32c3.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32C3ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipRevision(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getFlashCap(loader: ESPLoader): Promise<number>;
|
||||
getFlashVendor(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
133
node_modules/esptool-js/lib/targets/esp32c3.js
generated
vendored
Normal file
133
node_modules/esptool-js/lib/targets/esp32c3.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32C3ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C3";
|
||||
this.IMAGE_CHIP_ID = 5;
|
||||
this.EFUSE_BASE = 0x60008800;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.UART_CLKDIV_REG = 0x3ff40014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x6000007c;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 3;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const word3 = await loader.readReg(addr);
|
||||
const pkgVersion = (word3 >> 21) & 0x07;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getChipRevision(loader) {
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const numWord = 3;
|
||||
const pos = 18;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const ret = ((await loader.readReg(addr)) & (0x7 << pos)) >> pos;
|
||||
return ret;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
let desc;
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-C3";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C3";
|
||||
}
|
||||
const chip_rev = await this.getChipRevision(loader);
|
||||
desc += " (revision " + chip_rev + ")";
|
||||
return desc;
|
||||
}
|
||||
async getFlashCap(loader) {
|
||||
const numWord = 3;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const flashCap = (registerValue >> 27) & 0x07;
|
||||
return flashCap;
|
||||
}
|
||||
async getFlashVendor(loader) {
|
||||
const numWord = 4;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const vendorId = (registerValue >> 0) & 0x07;
|
||||
const vendorMap = {
|
||||
1: "XMC",
|
||||
2: "GD",
|
||||
3: "FM",
|
||||
4: "TT",
|
||||
5: "ZBIT",
|
||||
};
|
||||
return vendorMap[vendorId] || "";
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
const features = ["Wi-Fi", "BLE"];
|
||||
const flashMap = {
|
||||
0: null,
|
||||
1: "Embedded Flash 4MB",
|
||||
2: "Embedded Flash 2MB",
|
||||
3: "Embedded Flash 1MB",
|
||||
4: "Embedded Flash 8MB",
|
||||
};
|
||||
const flashCap = await this.getFlashCap(loader);
|
||||
const flashVendor = await this.getFlashVendor(loader);
|
||||
const flash = flashMap[flashCap];
|
||||
const flashDescription = flash !== undefined ? flash : "Unknown Embedded Flash";
|
||||
if (flash !== null) {
|
||||
features.push(`${flashDescription} (${flashVendor})`);
|
||||
}
|
||||
return features;
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
70
node_modules/esptool-js/lib/targets/esp32c5.d.ts
generated
vendored
Normal file
70
node_modules/esptool-js/lib/targets/esp32c5.d.ts
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { ESPLoader } from "../esploader";
|
||||
import { ESP32C6ROM } from "./esp32c6";
|
||||
export declare class ESP32C5ROM extends ESP32C6ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
EFUSE_PURPOSE_KEY0_REG: number;
|
||||
EFUSE_PURPOSE_KEY0_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY1_REG: number;
|
||||
EFUSE_PURPOSE_KEY1_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY2_REG: number;
|
||||
EFUSE_PURPOSE_KEY2_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY3_REG: number;
|
||||
EFUSE_PURPOSE_KEY3_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY4_REG: number;
|
||||
EFUSE_PURPOSE_KEY4_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY5_REG: number;
|
||||
EFUSE_PURPOSE_KEY5_SHIFT: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK: number;
|
||||
EFUSE_SECURE_BOOT_EN_REG: number;
|
||||
EFUSE_SECURE_BOOT_EN_MASK: number;
|
||||
IROM_MAP_START: number;
|
||||
IROM_MAP_END: number;
|
||||
DROM_MAP_START: number;
|
||||
DROM_MAP_END: number;
|
||||
PCR_SYSCLK_CONF_REG: number;
|
||||
PCR_SYSCLK_XTAL_FREQ_V: number;
|
||||
PCR_SYSCLK_XTAL_FREQ_S: number;
|
||||
XTAL_CLK_DIVIDER: number;
|
||||
UARTDEV_BUF_NO: number;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
FLASH_FREQUENCY: {
|
||||
"80m": number;
|
||||
"40m": number;
|
||||
"20m": number;
|
||||
};
|
||||
MEMORY_MAP: (string | number)[][];
|
||||
UF2_FAMILY_ID: number;
|
||||
EFUSE_MAX_KEY: number;
|
||||
KEY_PURPOSES: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
12: string;
|
||||
};
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
getCrystalFreqRomExpect(loader: ESPLoader): Promise<number>;
|
||||
}
|
129
node_modules/esptool-js/lib/targets/esp32c5.js
generated
vendored
Normal file
129
node_modules/esptool-js/lib/targets/esp32c5.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
import { ESP32C6ROM } from "./esp32c6";
|
||||
export class ESP32C5ROM extends ESP32C6ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C5";
|
||||
this.IMAGE_CHIP_ID = 23;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x2000;
|
||||
this.EFUSE_BASE = 0x600b4800;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.UART_CLKDIV_REG = 0x60000014;
|
||||
this.EFUSE_RD_REG_BASE = this.EFUSE_BASE + 0x030; // BLOCK0 read base address
|
||||
this.EFUSE_PURPOSE_KEY0_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY0_SHIFT = 24;
|
||||
this.EFUSE_PURPOSE_KEY1_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY1_SHIFT = 28;
|
||||
this.EFUSE_PURPOSE_KEY2_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY2_SHIFT = 0;
|
||||
this.EFUSE_PURPOSE_KEY3_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY3_SHIFT = 4;
|
||||
this.EFUSE_PURPOSE_KEY4_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY4_SHIFT = 8;
|
||||
this.EFUSE_PURPOSE_KEY5_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY5_SHIFT = 12;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = this.EFUSE_RD_REG_BASE;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_REG = this.EFUSE_BASE + 0x034;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18;
|
||||
this.EFUSE_SECURE_BOOT_EN_REG = this.EFUSE_BASE + 0x038;
|
||||
this.EFUSE_SECURE_BOOT_EN_MASK = 1 << 20;
|
||||
this.IROM_MAP_START = 0x42000000;
|
||||
this.IROM_MAP_END = 0x42800000;
|
||||
this.DROM_MAP_START = 0x42800000;
|
||||
this.DROM_MAP_END = 0x43000000;
|
||||
this.PCR_SYSCLK_CONF_REG = 0x60096110;
|
||||
this.PCR_SYSCLK_XTAL_FREQ_V = 0x7f << 24;
|
||||
this.PCR_SYSCLK_XTAL_FREQ_S = 24;
|
||||
this.XTAL_CLK_DIVIDER = 1;
|
||||
this.UARTDEV_BUF_NO = 0x4085f51c; // Variable in ROM .bss which indicates the port in use
|
||||
// Magic value for ESP32C5
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0x1101406f, 0x63e1406f, 0x5fd1406f];
|
||||
this.FLASH_FREQUENCY = {
|
||||
"80m": 0xf,
|
||||
"40m": 0x0,
|
||||
"20m": 0x2,
|
||||
};
|
||||
this.MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x42800000, 0x43000000, "DROM"],
|
||||
[0x40800000, 0x40860000, "DRAM"],
|
||||
[0x40800000, 0x40860000, "BYTE_ACCESSIBLE"],
|
||||
[0x4003a000, 0x40040000, "DROM_MASK"],
|
||||
[0x40000000, 0x4003a000, "IROM_MASK"],
|
||||
[0x42000000, 0x42800000, "IROM"],
|
||||
[0x40800000, 0x40860000, "IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_DRAM"],
|
||||
[0x600fe000, 0x60100000, "MEM_INTERNAL2"],
|
||||
];
|
||||
this.UF2_FAMILY_ID = 0xf71c0343;
|
||||
this.EFUSE_MAX_KEY = 5;
|
||||
this.KEY_PURPOSES = {
|
||||
0: "USER/EMPTY",
|
||||
1: "ECDSA_KEY",
|
||||
2: "XTS_AES_256_KEY_1",
|
||||
3: "XTS_AES_256_KEY_2",
|
||||
4: "XTS_AES_128_KEY",
|
||||
5: "HMAC_DOWN_ALL",
|
||||
6: "HMAC_DOWN_JTAG",
|
||||
7: "HMAC_DOWN_DIGITAL_SIGNATURE",
|
||||
8: "HMAC_UP",
|
||||
9: "SECURE_BOOT_DIGEST0",
|
||||
10: "SECURE_BOOT_DIGEST1",
|
||||
11: "SECURE_BOOT_DIGEST2",
|
||||
12: "KM_INIT_KEY",
|
||||
};
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 26) & 0x07;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 0) & 0x0f;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 4) & 0x03;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
let desc;
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-C5";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C5";
|
||||
}
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${desc} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["Wi-Fi 6 (dual-band)", "BT 5 (LE)"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
// The crystal detection algorithm of ESP32/ESP8266
|
||||
// works for ESP32-C5 as well.
|
||||
const uartDiv = (await loader.readReg(this.UART_CLKDIV_REG)) & this.UART_CLKDIV_MASK;
|
||||
const etsXtal = (loader.transport.baudrate * uartDiv) / 1000000 / this.XTAL_CLK_DIVIDER;
|
||||
let normXtal;
|
||||
if (etsXtal > 45) {
|
||||
normXtal = 48;
|
||||
}
|
||||
else if (etsXtal > 33) {
|
||||
normXtal = 40;
|
||||
}
|
||||
else {
|
||||
normXtal = 26;
|
||||
}
|
||||
if (Math.abs(normXtal - etsXtal) > 1) {
|
||||
loader.info("WARNING: Unsupported crystal in use");
|
||||
}
|
||||
return normXtal;
|
||||
}
|
||||
async getCrystalFreqRomExpect(loader) {
|
||||
return (((await loader.readReg(this.PCR_SYSCLK_CONF_REG)) & this.PCR_SYSCLK_XTAL_FREQ_V) >> this.PCR_SYSCLK_XTAL_FREQ_S);
|
||||
}
|
||||
}
|
36
node_modules/esptool-js/lib/targets/esp32c6.d.ts
generated
vendored
Normal file
36
node_modules/esptool-js/lib/targets/esp32c6.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32C6ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipRevision(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
96
node_modules/esptool-js/lib/targets/esp32c6.js
generated
vendored
Normal file
96
node_modules/esptool-js/lib/targets/esp32c6.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32C6ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C6";
|
||||
this.IMAGE_CHIP_ID = 13;
|
||||
this.EFUSE_BASE = 0x600b0800;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.UART_CLKDIV_REG = 0x3ff40014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x6000007c;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 3;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const word3 = await loader.readReg(addr);
|
||||
const pkgVersion = (word3 >> 21) & 0x07;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getChipRevision(loader) {
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const numWord = 3;
|
||||
const pos = 18;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const ret = ((await loader.readReg(addr)) & (0x7 << pos)) >> pos;
|
||||
return ret;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
let desc;
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-C6";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C6";
|
||||
}
|
||||
const chipRev = await this.getChipRevision(loader);
|
||||
desc += " (revision " + chipRev + ")";
|
||||
return desc;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["Wi-Fi 6", "BT 5", "IEEE802.15.4"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
62
node_modules/esptool-js/lib/targets/esp32c61.d.ts
generated
vendored
Normal file
62
node_modules/esptool-js/lib/targets/esp32c61.d.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { ESPLoader } from "../esploader";
|
||||
import { ESP32C6ROM } from "./esp32c6";
|
||||
export declare class ESP32C61ROM extends ESP32C6ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
UART_DATE_REG_ADDR: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
EFUSE_PURPOSE_KEY0_REG: number;
|
||||
EFUSE_PURPOSE_KEY0_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY1_REG: number;
|
||||
EFUSE_PURPOSE_KEY1_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY2_REG: number;
|
||||
EFUSE_PURPOSE_KEY2_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY3_REG: number;
|
||||
EFUSE_PURPOSE_KEY3_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY4_REG: number;
|
||||
EFUSE_PURPOSE_KEY4_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY5_REG: number;
|
||||
EFUSE_PURPOSE_KEY5_SHIFT: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK: number;
|
||||
EFUSE_SECURE_BOOT_EN_REG: number;
|
||||
EFUSE_SECURE_BOOT_EN_MASK: number;
|
||||
FLASH_FREQUENCY: {
|
||||
"80m": number;
|
||||
"40m": number;
|
||||
"20m": number;
|
||||
};
|
||||
MEMORY_MAP: (string | number)[][];
|
||||
UF2_FAMILY_ID: number;
|
||||
EFUSE_MAX_KEY: number;
|
||||
KEY_PURPOSES: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
12: string;
|
||||
13: string;
|
||||
14: string;
|
||||
15: string;
|
||||
};
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
}
|
122
node_modules/esptool-js/lib/targets/esp32c61.js
generated
vendored
Normal file
122
node_modules/esptool-js/lib/targets/esp32c61.js
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
import { ESP32C6ROM } from "./esp32c6";
|
||||
export class ESP32C61ROM extends ESP32C6ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C61";
|
||||
this.IMAGE_CHIP_ID = 20;
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0x33f0206f, 0x2421606f];
|
||||
this.UART_DATE_REG_ADDR = 0x60000000 + 0x7c;
|
||||
this.EFUSE_BASE = 0x600b4800;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.EFUSE_RD_REG_BASE = this.EFUSE_BASE + 0x030; // BLOCK0 read base address
|
||||
this.EFUSE_PURPOSE_KEY0_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY0_SHIFT = 0;
|
||||
this.EFUSE_PURPOSE_KEY1_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY1_SHIFT = 4;
|
||||
this.EFUSE_PURPOSE_KEY2_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY2_SHIFT = 8;
|
||||
this.EFUSE_PURPOSE_KEY3_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY3_SHIFT = 12;
|
||||
this.EFUSE_PURPOSE_KEY4_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY4_SHIFT = 16;
|
||||
this.EFUSE_PURPOSE_KEY5_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY5_SHIFT = 20;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = this.EFUSE_RD_REG_BASE;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_REG = this.EFUSE_BASE + 0x030;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 23;
|
||||
this.EFUSE_SECURE_BOOT_EN_REG = this.EFUSE_BASE + 0x034;
|
||||
this.EFUSE_SECURE_BOOT_EN_MASK = 1 << 26;
|
||||
this.FLASH_FREQUENCY = {
|
||||
"80m": 0xf,
|
||||
"40m": 0x0,
|
||||
"20m": 0x2,
|
||||
};
|
||||
this.MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x41800000, 0x42000000, "DROM"],
|
||||
[0x40800000, 0x40860000, "DRAM"],
|
||||
[0x40800000, 0x40860000, "BYTE_ACCESSIBLE"],
|
||||
[0x4004ac00, 0x40050000, "DROM_MASK"],
|
||||
[0x40000000, 0x4004ac00, "IROM_MASK"],
|
||||
[0x41000000, 0x41800000, "IROM"],
|
||||
[0x40800000, 0x40860000, "IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_DRAM"],
|
||||
[0x600fe000, 0x60100000, "MEM_INTERNAL2"],
|
||||
];
|
||||
this.UF2_FAMILY_ID = 0x77d850c4;
|
||||
this.EFUSE_MAX_KEY = 5;
|
||||
this.KEY_PURPOSES = {
|
||||
0: "USER/EMPTY",
|
||||
1: "ECDSA_KEY",
|
||||
2: "XTS_AES_256_KEY_1",
|
||||
3: "XTS_AES_256_KEY_2",
|
||||
4: "XTS_AES_128_KEY",
|
||||
5: "HMAC_DOWN_ALL",
|
||||
6: "HMAC_DOWN_JTAG",
|
||||
7: "HMAC_DOWN_DIGITAL_SIGNATURE",
|
||||
8: "HMAC_UP",
|
||||
9: "SECURE_BOOT_DIGEST0",
|
||||
10: "SECURE_BOOT_DIGEST1",
|
||||
11: "SECURE_BOOT_DIGEST2",
|
||||
12: "KM_INIT_KEY",
|
||||
13: "XTS_AES_256_KEY_1_PSRAM",
|
||||
14: "XTS_AES_256_KEY_2_PSRAM",
|
||||
15: "XTS_AES_128_KEY_PSRAM",
|
||||
};
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 26) & 0x07;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 0) & 0x0f;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 4) & 0x03;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
let desc;
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-C61";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C61";
|
||||
}
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${desc} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["WiFi 6", "BT 5"];
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
}
|
41
node_modules/esptool-js/lib/targets/esp32h2.d.ts
generated
vendored
Normal file
41
node_modules/esptool-js/lib/targets/esp32h2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32H2ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
USB_RAM_BLOCK: number;
|
||||
UARTDEV_BUF_NO_USB: number;
|
||||
UARTDEV_BUF_NO: number;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
postConnect(loader: ESPLoader): Promise<void>;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
103
node_modules/esptool-js/lib/targets/esp32h2.js
generated
vendored
Normal file
103
node_modules/esptool-js/lib/targets/esp32h2.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32H2ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-H2";
|
||||
this.IMAGE_CHIP_ID = 16;
|
||||
this.EFUSE_BASE = 0x600b0800;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.UART_CLKDIV_REG = 0x3ff40014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x6000007c;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
this.USB_RAM_BLOCK = 0x800;
|
||||
this.UARTDEV_BUF_NO_USB = 3;
|
||||
this.UARTDEV_BUF_NO = 0x3fcef14c;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 4;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 0) & 0x07;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 18) & 0x07;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 21) & 0x03;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
let desc;
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-H2";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-H2";
|
||||
}
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${desc} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["BT 5 (LE)", "IEEE802.15.4", "Single Core", "96MHz"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
// ESP32H2 XTAL is fixed to 32MHz
|
||||
return 32;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async postConnect(loader) {
|
||||
const bufNo = (await loader.readReg(this.UARTDEV_BUF_NO)) & 0xff;
|
||||
loader.debug("In _post_connect " + bufNo);
|
||||
if (bufNo == this.UARTDEV_BUF_NO_USB) {
|
||||
loader.ESP_RAM_BLOCK = this.USB_RAM_BLOCK;
|
||||
}
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
78
node_modules/esptool-js/lib/targets/esp32p4.d.ts
generated
vendored
Normal file
78
node_modules/esptool-js/lib/targets/esp32p4.d.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ESP32ROM } from "./esp32.js";
|
||||
export declare class ESP32P4ROM extends ESP32ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
IROM_MAP_START: number;
|
||||
IROM_MAP_END: number;
|
||||
DROM_MAP_START: number;
|
||||
DROM_MAP_END: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
UART_DATE_REG_ADDR: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
EFUSE_PURPOSE_KEY0_REG: number;
|
||||
EFUSE_PURPOSE_KEY0_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY1_REG: number;
|
||||
EFUSE_PURPOSE_KEY1_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY2_REG: number;
|
||||
EFUSE_PURPOSE_KEY2_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY3_REG: number;
|
||||
EFUSE_PURPOSE_KEY3_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY4_REG: number;
|
||||
EFUSE_PURPOSE_KEY4_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY5_REG: number;
|
||||
EFUSE_PURPOSE_KEY5_SHIFT: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK: number;
|
||||
EFUSE_SECURE_BOOT_EN_REG: number;
|
||||
EFUSE_SECURE_BOOT_EN_MASK: number;
|
||||
PURPOSE_VAL_XTS_AES256_KEY_1: number;
|
||||
PURPOSE_VAL_XTS_AES256_KEY_2: number;
|
||||
PURPOSE_VAL_XTS_AES128_KEY: number;
|
||||
SUPPORTS_ENCRYPTED_FLASH: boolean;
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN: number;
|
||||
MEMORY_MAP: (string | number)[][];
|
||||
UF2_FAMILY_ID: number;
|
||||
EFUSE_MAX_KEY: number;
|
||||
KEY_PURPOSES: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
12: string;
|
||||
};
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
getFlashVoltage(loader: ESPLoader): Promise<void>;
|
||||
overrideVddsdio(loader: ESPLoader): Promise<void>;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getFlashCryptConfig(loader: ESPLoader): Promise<void>;
|
||||
getSecureBootEnabled(laoder: ESPLoader): Promise<number>;
|
||||
getKeyBlockPurpose(loader: ESPLoader, keyBlock: number): Promise<number | undefined>;
|
||||
isFlashEncryptionKeyValid(loader: ESPLoader): Promise<boolean>;
|
||||
}
|
181
node_modules/esptool-js/lib/targets/esp32p4.js
generated
vendored
Normal file
181
node_modules/esptool-js/lib/targets/esp32p4.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
import { ESP32ROM } from "./esp32.js";
|
||||
export class ESP32P4ROM extends ESP32ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-P4";
|
||||
this.IMAGE_CHIP_ID = 18;
|
||||
this.IROM_MAP_START = 0x40000000;
|
||||
this.IROM_MAP_END = 0x4c000000;
|
||||
this.DROM_MAP_START = 0x40000000;
|
||||
this.DROM_MAP_END = 0x4c000000;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x2000; // First 2 sectors are reserved for FE purposes
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0x0, 0x0addbad0];
|
||||
this.UART_DATE_REG_ADDR = 0x500ca000 + 0x8c;
|
||||
this.EFUSE_BASE = 0x5012d000;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.SPI_REG_BASE = 0x5008d000; // SPIMEM1
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
this.EFUSE_RD_REG_BASE = this.EFUSE_BASE + 0x030; // BLOCK0 read base address
|
||||
this.EFUSE_PURPOSE_KEY0_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY0_SHIFT = 24;
|
||||
this.EFUSE_PURPOSE_KEY1_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY1_SHIFT = 28;
|
||||
this.EFUSE_PURPOSE_KEY2_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY2_SHIFT = 0;
|
||||
this.EFUSE_PURPOSE_KEY3_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY3_SHIFT = 4;
|
||||
this.EFUSE_PURPOSE_KEY4_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY4_SHIFT = 8;
|
||||
this.EFUSE_PURPOSE_KEY5_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY5_SHIFT = 12;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = this.EFUSE_RD_REG_BASE;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_REG = this.EFUSE_BASE + 0x034;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18;
|
||||
this.EFUSE_SECURE_BOOT_EN_REG = this.EFUSE_BASE + 0x038;
|
||||
this.EFUSE_SECURE_BOOT_EN_MASK = 1 << 20;
|
||||
this.PURPOSE_VAL_XTS_AES256_KEY_1 = 2;
|
||||
this.PURPOSE_VAL_XTS_AES256_KEY_2 = 3;
|
||||
this.PURPOSE_VAL_XTS_AES128_KEY = 4;
|
||||
this.SUPPORTS_ENCRYPTED_FLASH = true;
|
||||
this.FLASH_ENCRYPTED_WRITE_ALIGN = 16;
|
||||
this.MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x40000000, 0x4c000000, "DROM"],
|
||||
[0x4ff00000, 0x4ffa0000, "DRAM"],
|
||||
[0x4ff00000, 0x4ffa0000, "BYTE_ACCESSIBLE"],
|
||||
[0x4fc00000, 0x4fc20000, "DROM_MASK"],
|
||||
[0x4fc00000, 0x4fc20000, "IROM_MASK"],
|
||||
[0x40000000, 0x4c000000, "IROM"],
|
||||
[0x4ff00000, 0x4ffa0000, "IRAM"],
|
||||
[0x50108000, 0x50110000, "RTC_IRAM"],
|
||||
[0x50108000, 0x50110000, "RTC_DRAM"],
|
||||
[0x600fe000, 0x60100000, "MEM_INTERNAL2"],
|
||||
];
|
||||
this.UF2_FAMILY_ID = 0x3d308e94;
|
||||
this.EFUSE_MAX_KEY = 5;
|
||||
this.KEY_PURPOSES = {
|
||||
0: "USER/EMPTY",
|
||||
1: "ECDSA_KEY",
|
||||
2: "XTS_AES_256_KEY_1",
|
||||
3: "XTS_AES_256_KEY_2",
|
||||
4: "XTS_AES_128_KEY",
|
||||
5: "HMAC_DOWN_ALL",
|
||||
6: "HMAC_DOWN_JTAG",
|
||||
7: "HMAC_DOWN_DIGITAL_SIGNATURE",
|
||||
8: "HMAC_UP",
|
||||
9: "SECURE_BOOT_DIGEST0",
|
||||
10: "SECURE_BOOT_DIGEST1",
|
||||
11: "SECURE_BOOT_DIGEST2",
|
||||
12: "KM_INIT_KEY",
|
||||
};
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 2;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
return (registerValue >> 27) & 0x07;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
return (registerValue >> 0) & 0x0f;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
return (registerValue >> 4) & 0x03;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const pkgVersion = await this.getPkgVersion(loader);
|
||||
const chipName = pkgVersion === 0 ? "ESP32-P4" : "unknown ESP32-P4";
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${chipName} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["High-Performance MCU"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40; // ESP32P4 XTAL is fixed to 40MHz
|
||||
}
|
||||
async getFlashVoltage(loader) {
|
||||
return;
|
||||
}
|
||||
async overrideVddsdio(loader) {
|
||||
loader.debug("VDD_SDIO overrides are not supported for ESP32-P4");
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
async getFlashCryptConfig(loader) {
|
||||
return; // doesn't exist on ESP32-P4
|
||||
}
|
||||
async getSecureBootEnabled(laoder) {
|
||||
const registerValue = await laoder.readReg(this.EFUSE_SECURE_BOOT_EN_REG);
|
||||
return registerValue & this.EFUSE_SECURE_BOOT_EN_MASK;
|
||||
}
|
||||
async getKeyBlockPurpose(loader, keyBlock) {
|
||||
if (keyBlock < 0 || keyBlock > this.EFUSE_MAX_KEY) {
|
||||
loader.debug(`Valid key block numbers must be in range 0-${this.EFUSE_MAX_KEY}`);
|
||||
return;
|
||||
}
|
||||
const regShiftDictionary = [
|
||||
[this.EFUSE_PURPOSE_KEY0_REG, this.EFUSE_PURPOSE_KEY0_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY1_REG, this.EFUSE_PURPOSE_KEY1_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY2_REG, this.EFUSE_PURPOSE_KEY2_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY3_REG, this.EFUSE_PURPOSE_KEY3_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY4_REG, this.EFUSE_PURPOSE_KEY4_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY5_REG, this.EFUSE_PURPOSE_KEY5_SHIFT],
|
||||
];
|
||||
const [reg, shift] = regShiftDictionary[keyBlock];
|
||||
const registerValue = await loader.readReg(reg);
|
||||
return (registerValue >> shift) & 0xf;
|
||||
}
|
||||
async isFlashEncryptionKeyValid(loader) {
|
||||
const purposes = [];
|
||||
for (let i = 0; i <= this.EFUSE_MAX_KEY; i++) {
|
||||
const purpose = await this.getKeyBlockPurpose(loader, i);
|
||||
purposes.push(purpose);
|
||||
}
|
||||
const isXtsAes128Key = purposes.find((p) => p === this.PURPOSE_VAL_XTS_AES128_KEY);
|
||||
if (typeof isXtsAes128Key !== undefined) {
|
||||
return true;
|
||||
}
|
||||
const isXtsAes256Key1 = purposes.find((p) => p === this.PURPOSE_VAL_XTS_AES256_KEY_1);
|
||||
const isXtsAes256Key2 = purposes.find((p) => p === this.PURPOSE_VAL_XTS_AES256_KEY_2);
|
||||
if (typeof isXtsAes256Key1 !== undefined && typeof isXtsAes256Key2 !== undefined) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
111
node_modules/esptool-js/lib/targets/esp32s2.d.ts
generated
vendored
Normal file
111
node_modules/esptool-js/lib/targets/esp32s2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32S2ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
IROM_MAP_START: number;
|
||||
IROM_MAP_END: number;
|
||||
DROM_MAP_START: number;
|
||||
DROM_MAP_END: number;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
SPI_ADDR_REG_MSB: boolean;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
SUPPORTS_ENCRYPTED_FLASH: boolean;
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
EFUSE_BLOCK2_ADDR: number;
|
||||
EFUSE_PURPOSE_KEY0_REG: number;
|
||||
EFUSE_PURPOSE_KEY0_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY1_REG: number;
|
||||
EFUSE_PURPOSE_KEY1_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY2_REG: number;
|
||||
EFUSE_PURPOSE_KEY2_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY3_REG: number;
|
||||
EFUSE_PURPOSE_KEY3_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY4_REG: number;
|
||||
EFUSE_PURPOSE_KEY4_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY5_REG: number;
|
||||
EFUSE_PURPOSE_KEY5_SHIFT: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK: number;
|
||||
EFUSE_SECURE_BOOT_EN_REG: number;
|
||||
EFUSE_SECURE_BOOT_EN_MASK: number;
|
||||
EFUSE_RD_REPEAT_DATA3_REG: number;
|
||||
EFUSE_RD_REPEAT_DATA3_REG_FLASH_TYPE_MASK: number;
|
||||
PURPOSE_VAL_XTS_AES256_KEY_1: number;
|
||||
PURPOSE_VAL_XTS_AES256_KEY_2: number;
|
||||
PURPOSE_VAL_XTS_AES128_KEY: number;
|
||||
UARTDEV_BUF_NO: number;
|
||||
UARTDEV_BUF_NO_USB_OTG: number;
|
||||
USB_RAM_BLOCK: number;
|
||||
GPIO_STRAP_REG: number;
|
||||
GPIO_STRAP_SPI_BOOT_MASK: number;
|
||||
GPIO_STRAP_VDDSPI_MASK: number;
|
||||
RTC_CNTL_OPTION1_REG: number;
|
||||
RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK: number;
|
||||
RTCCNTL_BASE_REG: number;
|
||||
RTC_CNTL_WDTCONFIG0_REG: number;
|
||||
RTC_CNTL_WDTCONFIG1_REG: number;
|
||||
RTC_CNTL_WDTWPROTECT_REG: number;
|
||||
RTC_CNTL_WDT_WKEY: number;
|
||||
MEMORY_MAP: (string | number)[][];
|
||||
EFUSE_VDD_SPI_REG: number;
|
||||
VDD_SPI_XPD: number;
|
||||
VDD_SPI_TIEH: number;
|
||||
VDD_SPI_FORCE: number;
|
||||
UF2_FAMILY_ID: number;
|
||||
EFUSE_MAX_KEY: number;
|
||||
KEY_PURPOSES: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
};
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getFlashVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getFlashCap(loader: ESPLoader): Promise<number>;
|
||||
getPsramVersion(loader: ESPLoader): Promise<number>;
|
||||
getPsramCap(loader: ESPLoader): Promise<number>;
|
||||
getBlock2Version(loader: ESPLoader): Promise<number>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
usingUsbOtg(loader: ESPLoader): Promise<boolean>;
|
||||
postConnect(loader: ESPLoader): Promise<void>;
|
||||
}
|
239
node_modules/esptool-js/lib/targets/esp32s2.js
generated
vendored
Normal file
239
node_modules/esptool-js/lib/targets/esp32s2.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32S2ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-S2";
|
||||
this.IMAGE_CHIP_ID = 2;
|
||||
this.IROM_MAP_START = 0x40080000;
|
||||
this.IROM_MAP_END = 0x40b80000;
|
||||
this.DROM_MAP_START = 0x3f000000;
|
||||
this.DROM_MAP_END = 0x3f3f0000;
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0x000007c6];
|
||||
this.SPI_REG_BASE = 0x3f402000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
this.SPI_ADDR_REG_MSB = false;
|
||||
this.MAC_EFUSE_REG = 0x3f41a044; // ESP32-S2 has special block for MAC efuses
|
||||
this.UART_CLKDIV_REG = 0x3f400014;
|
||||
this.SUPPORTS_ENCRYPTED_FLASH = true;
|
||||
this.FLASH_ENCRYPTED_WRITE_ALIGN = 16;
|
||||
// todo: use espefuse APIs to get this info
|
||||
this.EFUSE_BASE = 0x3f41a000;
|
||||
this.EFUSE_RD_REG_BASE = this.EFUSE_BASE + 0x030; // BLOCK0 read base address
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.EFUSE_BLOCK2_ADDR = this.EFUSE_BASE + 0x05c;
|
||||
this.EFUSE_PURPOSE_KEY0_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY0_SHIFT = 24;
|
||||
this.EFUSE_PURPOSE_KEY1_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY1_SHIFT = 28;
|
||||
this.EFUSE_PURPOSE_KEY2_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY2_SHIFT = 0;
|
||||
this.EFUSE_PURPOSE_KEY3_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY3_SHIFT = 4;
|
||||
this.EFUSE_PURPOSE_KEY4_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY4_SHIFT = 8;
|
||||
this.EFUSE_PURPOSE_KEY5_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY5_SHIFT = 12;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = this.EFUSE_RD_REG_BASE;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 19;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_REG = this.EFUSE_BASE + 0x034;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18;
|
||||
this.EFUSE_SECURE_BOOT_EN_REG = this.EFUSE_BASE + 0x038;
|
||||
this.EFUSE_SECURE_BOOT_EN_MASK = 1 << 20;
|
||||
this.EFUSE_RD_REPEAT_DATA3_REG = this.EFUSE_BASE + 0x3c;
|
||||
this.EFUSE_RD_REPEAT_DATA3_REG_FLASH_TYPE_MASK = 1 << 9;
|
||||
this.PURPOSE_VAL_XTS_AES256_KEY_1 = 2;
|
||||
this.PURPOSE_VAL_XTS_AES256_KEY_2 = 3;
|
||||
this.PURPOSE_VAL_XTS_AES128_KEY = 4;
|
||||
this.UARTDEV_BUF_NO = 0x3ffffd14; // Variable in ROM .bss which indicates the port in use
|
||||
this.UARTDEV_BUF_NO_USB_OTG = 2; // Value of the above indicating that USB-OTG is in use
|
||||
this.USB_RAM_BLOCK = 0x800; // Max block size USB-OTG is used
|
||||
this.GPIO_STRAP_REG = 0x3f404038;
|
||||
this.GPIO_STRAP_SPI_BOOT_MASK = 1 << 3; // Not download mode
|
||||
this.GPIO_STRAP_VDDSPI_MASK = 1 << 4;
|
||||
this.RTC_CNTL_OPTION1_REG = 0x3f408128;
|
||||
this.RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK = 0x1; // Is download mode forced over USB?
|
||||
this.RTCCNTL_BASE_REG = 0x3f408000;
|
||||
this.RTC_CNTL_WDTCONFIG0_REG = this.RTCCNTL_BASE_REG + 0x0094;
|
||||
this.RTC_CNTL_WDTCONFIG1_REG = this.RTCCNTL_BASE_REG + 0x0098;
|
||||
this.RTC_CNTL_WDTWPROTECT_REG = this.RTCCNTL_BASE_REG + 0x00ac;
|
||||
this.RTC_CNTL_WDT_WKEY = 0x50d83aa1;
|
||||
this.MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x3f000000, 0x3ff80000, "DROM"],
|
||||
[0x3f500000, 0x3ff80000, "EXTRAM_DATA"],
|
||||
[0x3ff9e000, 0x3ffa0000, "RTC_DRAM"],
|
||||
[0x3ff9e000, 0x40000000, "BYTE_ACCESSIBLE"],
|
||||
[0x3ff9e000, 0x40072000, "MEM_INTERNAL"],
|
||||
[0x3ffb0000, 0x40000000, "DRAM"],
|
||||
[0x40000000, 0x4001a100, "IROM_MASK"],
|
||||
[0x40020000, 0x40070000, "IRAM"],
|
||||
[0x40070000, 0x40072000, "RTC_IRAM"],
|
||||
[0x40080000, 0x40800000, "IROM"],
|
||||
[0x50000000, 0x50002000, "RTC_DATA"],
|
||||
];
|
||||
this.EFUSE_VDD_SPI_REG = this.EFUSE_BASE + 0x34;
|
||||
this.VDD_SPI_XPD = 1 << 4;
|
||||
this.VDD_SPI_TIEH = 1 << 5;
|
||||
this.VDD_SPI_FORCE = 1 << 6;
|
||||
this.UF2_FAMILY_ID = 0xbfdd4eee;
|
||||
this.EFUSE_MAX_KEY = 5;
|
||||
this.KEY_PURPOSES = {
|
||||
0: "USER/EMPTY",
|
||||
1: "RESERVED",
|
||||
2: "XTS_AES_256_KEY_1",
|
||||
3: "XTS_AES_256_KEY_2",
|
||||
4: "XTS_AES_128_KEY",
|
||||
5: "HMAC_DOWN_ALL",
|
||||
6: "HMAC_DOWN_JTAG",
|
||||
7: "HMAC_DOWN_DIGITAL_SIGNATURE",
|
||||
8: "HMAC_UP",
|
||||
9: "SECURE_BOOT_DIGEST0",
|
||||
10: "SECURE_BOOT_DIGEST1",
|
||||
11: "SECURE_BOOT_DIGEST2",
|
||||
};
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x60000078;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x1000;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 4;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const word = await loader.readReg(addr);
|
||||
const pkgVersion = (word >> 0) & 0x0f;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const hiNumWord = 3;
|
||||
const hi = ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * hiNumWord)) >> 20) & 0x01;
|
||||
const lowNumWord = 4;
|
||||
const low = ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * lowNumWord)) >> 4) & 0x07;
|
||||
return (hi << 3) + low;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 18) & 0x03;
|
||||
}
|
||||
async getFlashVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 21) & 0x0f;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const chipDesc = {
|
||||
0: "ESP32-S2",
|
||||
1: "ESP32-S2FH2",
|
||||
2: "ESP32-S2FH4",
|
||||
102: "ESP32-S2FNR2",
|
||||
100: "ESP32-S2R2",
|
||||
};
|
||||
const chipIndex = (await this.getFlashCap(loader)) + (await this.getPsramCap(loader)) * 100;
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${chipDesc[chipIndex] || "unknown ESP32-S2"} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getFlashCap(loader) {
|
||||
return await this.getFlashVersion(loader);
|
||||
}
|
||||
async getPsramVersion(loader) {
|
||||
const numWord = 3;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const psramCap = (registerValue >> 28) & 0x0f;
|
||||
return psramCap;
|
||||
}
|
||||
async getPsramCap(loader) {
|
||||
return await this.getPsramVersion(loader);
|
||||
}
|
||||
async getBlock2Version(loader) {
|
||||
const numWord = 4;
|
||||
const addr = this.EFUSE_BLOCK2_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const block2Ver = (registerValue >> 4) & 0x07;
|
||||
return block2Ver;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
const features = ["Wi-Fi"];
|
||||
const flashMap = {
|
||||
0: "No Embedded Flash",
|
||||
1: "Embedded Flash 2MB",
|
||||
2: "Embedded Flash 4MB",
|
||||
};
|
||||
const flashCap = await this.getFlashCap(loader);
|
||||
const flashDescription = flashMap[flashCap] || "Unknown Embedded Flash";
|
||||
features.push(flashDescription);
|
||||
const psramMap = {
|
||||
0: "No Embedded Flash",
|
||||
1: "Embedded PSRAM 2MB",
|
||||
2: "Embedded PSRAM 4MB",
|
||||
};
|
||||
const psramCap = await this.getPsramCap(loader);
|
||||
const psramDescription = psramMap[psramCap] || "Unknown Embedded PSRAM";
|
||||
features.push(psramDescription);
|
||||
const block2VersionMap = {
|
||||
0: "No calibration in BLK2 of efuse",
|
||||
1: "ADC and temperature sensor calibration in BLK2 of efuse V1",
|
||||
2: "ADC and temperature sensor calibration in BLK2 of efuse V2",
|
||||
};
|
||||
const block2Ver = await this.getBlock2Version(loader);
|
||||
const block2VersionDescription = block2VersionMap[block2Ver] || "Unknown Calibration in BLK2";
|
||||
features.push(block2VersionDescription);
|
||||
return features;
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
async usingUsbOtg(loader) {
|
||||
const uartNo = (await loader.readReg(this.UARTDEV_BUF_NO)) & 0xff;
|
||||
return uartNo === this.UARTDEV_BUF_NO_USB_OTG;
|
||||
}
|
||||
async postConnect(loader) {
|
||||
const usingUsbOtg = await this.usingUsbOtg(loader);
|
||||
loader.debug("In _post_connect using USB OTG ?" + usingUsbOtg);
|
||||
if (usingUsbOtg) {
|
||||
loader.ESP_RAM_BLOCK = this.USB_RAM_BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
51
node_modules/esptool-js/lib/targets/esp32s3.d.ts
generated
vendored
Normal file
51
node_modules/esptool-js/lib/targets/esp32s3.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32S3ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
EFUSE_BLOCK2_ADDR: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
USB_RAM_BLOCK: number;
|
||||
UARTDEV_BUF_NO_USB: number;
|
||||
UARTDEV_BUF_NO: number;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getRawMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getRawMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getBlkVersionMajor(loader: ESPLoader): Promise<number>;
|
||||
getBlkVersionMinor(loader: ESPLoader): Promise<number>;
|
||||
isEco0(loader: ESPLoader, minorRaw: number): Promise<boolean>;
|
||||
getFlashCap(loader: ESPLoader): Promise<number>;
|
||||
getFlashVendor(loader: ESPLoader): Promise<string>;
|
||||
getPsramCap(loader: ESPLoader): Promise<number>;
|
||||
getPsramVendor(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
postConnect(loader: ESPLoader): Promise<void>;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
201
node_modules/esptool-js/lib/targets/esp32s3.js
generated
vendored
Normal file
201
node_modules/esptool-js/lib/targets/esp32s3.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32S3ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-S3";
|
||||
this.IMAGE_CHIP_ID = 9;
|
||||
this.EFUSE_BASE = 0x60007000;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x44;
|
||||
this.EFUSE_BLOCK2_ADDR = this.EFUSE_BASE + 0x5c;
|
||||
this.UART_CLKDIV_REG = 0x60000014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x60000080;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
this.USB_RAM_BLOCK = 0x800;
|
||||
this.UARTDEV_BUF_NO_USB = 3;
|
||||
this.UARTDEV_BUF_NO = 0x3fcef14c;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
const pkgVersion = await this.getPkgVersion(loader);
|
||||
const chipName = {
|
||||
0: "ESP32-S3 (QFN56)",
|
||||
1: "ESP32-S3-PICO-1 (LGA56)",
|
||||
};
|
||||
return `${chipName[pkgVersion] || "unknown ESP32-S3"} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 21) & 0x07;
|
||||
}
|
||||
async getRawMinorChipVersion(loader) {
|
||||
const hiNumWord = 5;
|
||||
const hi = ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * hiNumWord)) >> 23) & 0x01;
|
||||
const lowNumWord = 3;
|
||||
const low = ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * lowNumWord)) >> 18) & 0x07;
|
||||
return (hi << 3) + low;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const minorRaw = await this.getRawMinorChipVersion(loader);
|
||||
if (await this.isEco0(loader, minorRaw)) {
|
||||
return 0;
|
||||
}
|
||||
return this.getRawMinorChipVersion(loader);
|
||||
}
|
||||
async getRawMajorChipVersion(loader) {
|
||||
const numWord = 5;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 24) & 0x03;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const minorRaw = await this.getRawMinorChipVersion(loader);
|
||||
if (await this.isEco0(loader, minorRaw)) {
|
||||
return 0;
|
||||
}
|
||||
return this.getRawMajorChipVersion(loader);
|
||||
}
|
||||
async getBlkVersionMajor(loader) {
|
||||
const numWord = 4;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK2_ADDR + 4 * numWord)) >> 0) & 0x03;
|
||||
}
|
||||
async getBlkVersionMinor(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 24) & 0x07;
|
||||
}
|
||||
async isEco0(loader, minorRaw) {
|
||||
// Workaround: The major version field was allocated to other purposes
|
||||
// when block version is v1.1.
|
||||
// Luckily only chip v0.0 have this kind of block version and efuse usage.
|
||||
return ((minorRaw & 0x7) === 0 &&
|
||||
(await this.getBlkVersionMajor(loader)) === 1 &&
|
||||
(await this.getBlkVersionMinor(loader)) === 1);
|
||||
}
|
||||
async getFlashCap(loader) {
|
||||
const numWord = 3;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const flashCap = (registerValue >> 27) & 0x07;
|
||||
return flashCap;
|
||||
}
|
||||
async getFlashVendor(loader) {
|
||||
const numWord = 4;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const vendorId = (registerValue >> 0) & 0x07;
|
||||
const vendorMap = {
|
||||
1: "XMC",
|
||||
2: "GD",
|
||||
3: "FM",
|
||||
4: "TT",
|
||||
5: "BY",
|
||||
};
|
||||
return vendorMap[vendorId] || "";
|
||||
}
|
||||
async getPsramCap(loader) {
|
||||
const numWord = 4;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const psramCap = (registerValue >> 3) & 0x03;
|
||||
return psramCap;
|
||||
}
|
||||
async getPsramVendor(loader) {
|
||||
const numWord = 4;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const vendorId = (registerValue >> 7) & 0x03;
|
||||
const vendorMap = {
|
||||
1: "AP_3v3",
|
||||
2: "AP_1v8",
|
||||
};
|
||||
return vendorMap[vendorId] || "";
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
const features = ["Wi-Fi", "BLE"];
|
||||
const flashMap = {
|
||||
0: null,
|
||||
1: "Embedded Flash 8MB",
|
||||
2: "Embedded Flash 4MB",
|
||||
};
|
||||
const flashCap = await this.getFlashCap(loader);
|
||||
const flashVendor = await this.getFlashVendor(loader);
|
||||
const flash = flashMap[flashCap];
|
||||
const flashDescription = flash !== undefined ? flash : "Unknown Embedded Flash";
|
||||
if (flash !== null) {
|
||||
features.push(`${flashDescription} (${flashVendor})`);
|
||||
}
|
||||
const psramMap = {
|
||||
0: null,
|
||||
1: "Embedded PSRAM 8MB",
|
||||
2: "Embedded PSRAM 2MB",
|
||||
};
|
||||
const psramCap = await this.getPsramCap(loader);
|
||||
const psramVendor = await this.getPsramVendor(loader);
|
||||
const psram = psramMap[psramCap];
|
||||
const psramDescription = psram !== undefined ? psram : "Unknown Embedded PSRAM";
|
||||
if (psram !== null) {
|
||||
features.push(`${psramDescription} (${psramVendor})`);
|
||||
}
|
||||
return features;
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async postConnect(loader) {
|
||||
const bufNo = (await loader.readReg(this.UARTDEV_BUF_NO)) & 0xff;
|
||||
loader.debug("In _post_connect " + bufNo);
|
||||
if (bufNo == this.UARTDEV_BUF_NO_USB) {
|
||||
loader.ESP_RAM_BLOCK = this.USB_RAM_BLOCK;
|
||||
}
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
38
node_modules/esptool-js/lib/targets/esp8266.d.ts
generated
vendored
Normal file
38
node_modules/esptool-js/lib/targets/esp8266.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP8266ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
XTAL_CLK_DIVIDER: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_SIZES: {
|
||||
"512KB": number;
|
||||
"256KB": number;
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"2MB-c1": number;
|
||||
"4MB-c1": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
readEfuse(loader: ESPLoader, offset: number): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<"ESP8285" | "ESP8266EX">;
|
||||
getChipFeatures: (loader: ESPLoader) => Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
118
node_modules/esptool-js/lib/targets/esp8266.js
generated
vendored
Normal file
118
node_modules/esptool-js/lib/targets/esp8266.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP8266ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP8266";
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0xfff0c101];
|
||||
this.EFUSE_RD_REG_BASE = 0x3ff00050;
|
||||
this.UART_CLKDIV_REG = 0x60000014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.XTAL_CLK_DIVIDER = 2;
|
||||
this.FLASH_WRITE_SIZE = 0x4000;
|
||||
// NOT IMPLEMENTED, SETTING EMPTY VALUE
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0;
|
||||
this.UART_DATE_REG_ADDR = 0;
|
||||
this.FLASH_SIZES = {
|
||||
"512KB": 0x00,
|
||||
"256KB": 0x10,
|
||||
"1MB": 0x20,
|
||||
"2MB": 0x30,
|
||||
"4MB": 0x40,
|
||||
"2MB-c1": 0x50,
|
||||
"4MB-c1": 0x60,
|
||||
"8MB": 0x80,
|
||||
"16MB": 0x90,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60000200;
|
||||
this.SPI_USR_OFFS = 0x1c;
|
||||
this.SPI_USR1_OFFS = 0x20;
|
||||
this.SPI_USR2_OFFS = 0x24;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0; // not in esp8266
|
||||
this.SPI_MISO_DLEN_OFFS = 0; // not in esp8266
|
||||
this.SPI_W0_OFFS = 0x40;
|
||||
this.getChipFeatures = async (loader) => {
|
||||
const features = ["WiFi"];
|
||||
if ((await this.getChipDescription(loader)) == "ESP8285")
|
||||
features.push("Embedded Flash");
|
||||
return features;
|
||||
};
|
||||
}
|
||||
async readEfuse(loader, offset) {
|
||||
const addr = this.EFUSE_RD_REG_BASE + 4 * offset;
|
||||
loader.debug("Read efuse " + addr);
|
||||
return await loader.readReg(addr);
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const efuse3 = await this.readEfuse(loader, 2);
|
||||
const efuse0 = await this.readEfuse(loader, 0);
|
||||
const is8285 = ((efuse0 & (1 << 4)) | (efuse3 & (1 << 16))) != 0; // One or the other efuse bit is set for ESP8285
|
||||
return is8285 ? "ESP8285" : "ESP8266EX";
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
const uartDiv = (await loader.readReg(this.UART_CLKDIV_REG)) & this.UART_CLKDIV_MASK;
|
||||
const etsXtal = (loader.transport.baudrate * uartDiv) / 1000000 / this.XTAL_CLK_DIVIDER;
|
||||
let normXtal;
|
||||
if (etsXtal > 33) {
|
||||
normXtal = 40;
|
||||
}
|
||||
else {
|
||||
normXtal = 26;
|
||||
}
|
||||
if (Math.abs(normXtal - etsXtal) > 1) {
|
||||
loader.info("WARNING: Detected crystal freq " +
|
||||
etsXtal +
|
||||
"MHz is quite different to normalized freq " +
|
||||
normXtal +
|
||||
"MHz. Unsupported crystal in use?");
|
||||
}
|
||||
return normXtal;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await this.readEfuse(loader, 0);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await this.readEfuse(loader, 1);
|
||||
mac1 = mac1 >>> 0;
|
||||
let mac3 = await this.readEfuse(loader, 3);
|
||||
mac3 = mac3 >>> 0;
|
||||
const mac = new Uint8Array(6);
|
||||
if (mac3 != 0) {
|
||||
mac[0] = (mac3 >> 16) & 0xff;
|
||||
mac[1] = (mac3 >> 8) & 0xff;
|
||||
mac[2] = mac3 & 0xff;
|
||||
}
|
||||
else if (((mac1 >> 16) & 0xff) == 0) {
|
||||
mac[0] = 0x18;
|
||||
mac[1] = 0xfe;
|
||||
mac[2] = 0x34;
|
||||
}
|
||||
else if (((mac1 >> 16) & 0xff) == 1) {
|
||||
mac[0] = 0xac;
|
||||
mac[1] = 0xd0;
|
||||
mac[2] = 0x74;
|
||||
}
|
||||
else {
|
||||
loader.error("Unknown OUI");
|
||||
}
|
||||
mac[3] = (mac1 >> 8) & 0xff;
|
||||
mac[4] = mac1 & 0xff;
|
||||
mac[5] = (mac0 >> 24) & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
83
node_modules/esptool-js/lib/targets/rom.d.ts
generated
vendored
Normal file
83
node_modules/esptool-js/lib/targets/rom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
/**
|
||||
* Represents a chip ROM with basic registers field and abstract functions.
|
||||
*/
|
||||
export declare abstract class ROM {
|
||||
/**
|
||||
* Read ESP32 eFuse.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @param {number} offset - Offset to start erase.
|
||||
* @returns {number} The eFuse number.
|
||||
*/
|
||||
protected readEfuse?(loader: ESPLoader, offset: number): Promise<number>;
|
||||
/**
|
||||
* Get the package version number.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {number} The package version number.
|
||||
*/
|
||||
protected getPkgVersion?(loader: ESPLoader): Promise<number>;
|
||||
/**
|
||||
* Get the chip revision number.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {number} The chip revision number.
|
||||
*/
|
||||
protected getChipRevision?(loader: ESPLoader): Promise<number>;
|
||||
/**
|
||||
* Get the chip description.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {string} The chip description as string.
|
||||
*/
|
||||
abstract getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
/**
|
||||
* Get the chip features.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {string} The chip features as string.
|
||||
*/
|
||||
abstract getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
/**
|
||||
* Get the crystal frequency for the chip.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {string} The crystal frequency as number.
|
||||
*/
|
||||
abstract getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
/**
|
||||
* Convert a number to hex string.
|
||||
* @param {number} d - Number to convert to hex string.
|
||||
* @returns {string} The hex string.
|
||||
*/
|
||||
abstract _d2h(d: number): string;
|
||||
/**
|
||||
* Get the chip mac address.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {string} The mac address string.
|
||||
*/
|
||||
abstract readMac(loader: ESPLoader): Promise<string>;
|
||||
/**
|
||||
* Function to be executed after chip connection
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
*/
|
||||
postConnect?(loader: ESPLoader): Promise<void>;
|
||||
/**
|
||||
* Get the chip erase size.
|
||||
* @param {number} offset - Offset to start erase.
|
||||
* @param {number} size - Size to erase.
|
||||
* @returns {number} The erase size of the chip as number.
|
||||
*/
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
abstract FLASH_SIZES: {
|
||||
[key: string]: number;
|
||||
};
|
||||
abstract BOOTLOADER_FLASH_OFFSET: number;
|
||||
abstract CHIP_NAME: string;
|
||||
abstract FLASH_WRITE_SIZE: number;
|
||||
abstract SPI_MOSI_DLEN_OFFS: number;
|
||||
abstract SPI_MISO_DLEN_OFFS: number;
|
||||
abstract SPI_REG_BASE: number;
|
||||
abstract SPI_USR_OFFS: number;
|
||||
abstract SPI_USR1_OFFS: number;
|
||||
abstract SPI_USR2_OFFS: number;
|
||||
abstract SPI_W0_OFFS: number;
|
||||
abstract UART_CLKDIV_MASK: number;
|
||||
abstract UART_CLKDIV_REG: number;
|
||||
abstract UART_DATE_REG_ADDR: number;
|
||||
}
|
14
node_modules/esptool-js/lib/targets/rom.js
generated
vendored
Normal file
14
node_modules/esptool-js/lib/targets/rom.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Represents a chip ROM with basic registers field and abstract functions.
|
||||
*/
|
||||
export class ROM {
|
||||
/**
|
||||
* Get the chip erase size.
|
||||
* @param {number} offset - Offset to start erase.
|
||||
* @param {number} size - Size to erase.
|
||||
* @returns {number} The erase size of the chip as number.
|
||||
*/
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"entry": 1074521580,
|
||||
"text": "CAD0PxwA9D8AAPQ/AMD8PxAA9D82QQAh+v/AIAA4AkH5/8AgACgEICB0nOIGBQAAAEH1/4H2/8AgAKgEiAigoHTgCAALImYC54b0/yHx/8AgADkCHfAAAK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jRiQNGAQAAAAwcnQyMsjg1jHPAPzHAM8CWs/XWfAAioMcpVQZn/lacmSg1FkKZIqDIBvv/qCNWmpiBLf7gCACionHAqhGBJv7gCACBKv7gCACGW/4AACgzFnKWDAqBJP7gCACio+iBHv7gCADgAgAGVP4d8AAAADZBAJ0CgqDAKAOHmQ/MMgwShgcADAIpA3zihg8AJhIHJiIYhgMAAACCoNuAKSOHmSoMIikDfPJGCAAAACKg3CeZCgwSKQMtCAYEAAAAgqDdfPKHmQYMEikDIqDbHfAAAA==",
|
||||
"text_start": 1074520064,
|
||||
"data": "DMD8P+znC0B/6AtAZ+0LQAbpC0Cf6AtABukLQGXpC0CC6gtA9OoLQJ3qC0CV5wtAGuoLQHTqC0CI6QtAGOsLQLDpC0AY6wtAbegLQMroC0AG6QtAZekLQIXoC0DI6wtAKe0LQLjmC0BL7QtAuOYLQLjmC0C45gtAuOYLQLjmC0C45gtAuOYLQLjmC0Bv6wtAuOYLQEnsC0Ap7QtA",
|
||||
"data_start": 1073605544,
|
||||
"bss_start": 1073528832
|
||||
}
|
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c2.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c2.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"entry": 1077413304,
|
||||
"text": "ARG3BwBgTsaDqYcASsg3Sco/JspSxAbOIsy3BABgfVoTCQkAwEwTdPQ/DeDyQGJEI6g0AUJJ0kSySSJKBWGCgIhAgycJABN19Q+Cl30U4xlE/8m/EwcADJRBqodjGOUAhUeFxiOgBQB5VYKABUdjh+YACUZjjcYAfVWCgEIFEwewDUGFY5XnAolHnMH1t5MGwA1jFtUAmMETBQAMgoCTBtANfVVjldcAmMETBbANgoC3dcs/QRGThQW6BsZhP2NFBQa3d8s/k4eHsQOnBwgD1kcIE3X1D5MGFgDCBsGCI5LXCDKXIwCnAAPXRwiRZ5OHBwRjHvcCN/fKPxMHh7G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CCDhAyAg4QBYNOEAsCThA1gs4QMoMOECkBjhA9Aw4QKQGOECkBjhApAY4QKQGOECkBjhApAY4QKQGOECkBjhAcgs4QKQGOEDyCzhAygw4QA==",
|
||||
"data_start": 1070295976,
|
||||
"bss_start": 1070219264
|
||||
}
|
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c3.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c3.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c5.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c5.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c6.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c6.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c61.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c61.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32h2.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32h2.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32p4.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32p4.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"entry": 1341195918,
|
||||
"text": "QREixCbCBsa3Jw1QEUc3BPVP2Mu3JA1QEwQEANxAkYuR57JAIkSSREEBgoCIQBxAE3X1D4KX3bcBEbenDFBOxoOphwBKyDcJ9U8mylLEBs4izLekDFB9WhMJCQDATBN09D8N4PJAYkQjqD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cEV7/DP21207/Avyz2/A8Q7AIPHKwATjIsBIgRdjNxEQRTN45FHhUtj/4cIkweQDNzIrbwDpw0AItAFSLOH7EA+1oMnirBjc/QADUhCxjrE7/CvxiJHMkg3hfVP4oV8EJOGCgEQEBMFhQKX8M7/54BgNze39U+TCAcBglcDp4iwg6UNAB2MHY8+nLJXI6TosKqLvpUjoL0Ak4cKAZ2NAcWhZ2OX9QBahe/wb9EjoG0BCcTcRJnD409w92PfCwCTB3AMvbeFS7c99k+3jPVPk43NupOMDAHpv+OaC5zcROOHB5yTB4AMqbeDp4sA45AHnO/wD9YJZRMFBXGX8M7/54CgIpfwzv/ngKAnTbIDpMsA4w4EmO/wz9MTBYA+l/DO/+eAgCAClFmy9lBmVNZURlm2WSZalloGW/ZLZkzWTEZNtk0JYYKAAAA=",
|
||||
"text_start": 1341194240,
|
||||
"data": "EAD1TwYK8U9WCvFPrgrxT4QL8U/wC/FPngvxT9QI8U9AC/FPgAvxT8IK8U+ECPFP9grxT4QI8U/gCfFPJgrxT1YK8U+uCvFP8gnxTzgJ8U9oCfFP7gnxT0AO8U9WCvFPCA3xTwAO8U/EB/FPJA7xT8QH8U/EB/FPxAfxT8QH8U/EB/FPxAfxT8QH8U/EB/FPpAzxT8QH8U8mDfFPAA7xTw==",
|
||||
"data_start": 1341533100,
|
||||
"bss_start": 1341456384
|
||||
}
|
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32s2.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32s2.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32s3.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32s3.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_8266.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_8266.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
node_modules/esptool-js/lib/types/error.d.ts
generated
vendored
Normal file
11
node_modules/esptool-js/lib/types/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Represents a Espressif chip error.
|
||||
*/
|
||||
declare class ESPError extends Error {
|
||||
}
|
||||
/**
|
||||
* Represents a Espressif timeout chip error.
|
||||
*/
|
||||
declare class TimeoutError extends ESPError {
|
||||
}
|
||||
export { ESPError, TimeoutError };
|
11
node_modules/esptool-js/lib/types/error.js
generated
vendored
Normal file
11
node_modules/esptool-js/lib/types/error.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Represents a Espressif chip error.
|
||||
*/
|
||||
class ESPError extends Error {
|
||||
}
|
||||
/**
|
||||
* Represents a Espressif timeout chip error.
|
||||
*/
|
||||
class TimeoutError extends ESPError {
|
||||
}
|
||||
export { ESPError, TimeoutError };
|
49
node_modules/esptool-js/lib/types/flashOptions.d.ts
generated
vendored
Normal file
49
node_modules/esptool-js/lib/types/flashOptions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Options for flashing a device with firmware.
|
||||
* @interface FlashOptions
|
||||
*/
|
||||
export interface FlashOptions {
|
||||
/**
|
||||
* An array of file objects representing the data to be flashed.
|
||||
* @type {Array<{ data: string; address: number }>}
|
||||
*/
|
||||
fileArray: {
|
||||
data: string;
|
||||
address: number;
|
||||
}[];
|
||||
/**
|
||||
* The size of the flash memory to be used.
|
||||
* @type {string}
|
||||
*/
|
||||
flashSize: string;
|
||||
/**
|
||||
* The flash mode to be used (e.g., QIO, QOUT, DIO, DOUT).
|
||||
* @type {string}
|
||||
*/
|
||||
flashMode: string;
|
||||
/**
|
||||
* The flash frequency to be used (e.g., 40MHz, 80MHz).
|
||||
* @type {string}
|
||||
*/
|
||||
flashFreq: string;
|
||||
/**
|
||||
* Flag indicating whether to erase all existing data in the flash memory before flashing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
eraseAll: boolean;
|
||||
/**
|
||||
* Flag indicating whether to compress the data before flashing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
compress: boolean;
|
||||
/**
|
||||
* A function to report the progress of the flashing operation (optional).
|
||||
* @type {(fileIndex: number, written: number, total: number) => void}
|
||||
*/
|
||||
reportProgress?: (fileIndex: number, written: number, total: number) => void;
|
||||
/**
|
||||
* A function to calculate the MD5 hash of the firmware image (optional).
|
||||
* @type {(image: string) => string}
|
||||
*/
|
||||
calculateMD5Hash?: (image: string) => string;
|
||||
}
|
1
node_modules/esptool-js/lib/types/flashOptions.js
generated
vendored
Normal file
1
node_modules/esptool-js/lib/types/flashOptions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
54
node_modules/esptool-js/lib/types/loaderOptions.d.ts
generated
vendored
Normal file
54
node_modules/esptool-js/lib/types/loaderOptions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/// <reference types="w3c-web-serial" />
|
||||
import { ResetConstructors } from "../reset";
|
||||
import { Transport } from "../webserial";
|
||||
import { IEspLoaderTerminal } from "./loaderTerminal";
|
||||
/**
|
||||
* Options to configure ESPLoader.
|
||||
* @interface LoaderOptions
|
||||
*/
|
||||
export interface LoaderOptions {
|
||||
/**
|
||||
* The transport mechanism to communicate with the device.
|
||||
* @type {Transport}
|
||||
*/
|
||||
transport: Transport;
|
||||
/**
|
||||
* The port to initialize the transport class.
|
||||
* @type {SerialPort}
|
||||
*/
|
||||
port?: SerialPort;
|
||||
/**
|
||||
* Set of options for SerialPort class.
|
||||
* @type {Transport}
|
||||
*/
|
||||
serialOptions?: SerialOptions;
|
||||
/**
|
||||
* The baud rate to be used for communication with the device.
|
||||
* @type {number}
|
||||
*/
|
||||
baudrate: number;
|
||||
/**
|
||||
* An optional terminal interface to interact with the loader during the process.
|
||||
* @type {IEspLoaderTerminal}
|
||||
*/
|
||||
terminal?: IEspLoaderTerminal;
|
||||
/**
|
||||
* The baud rate to be used during the initial ROM communication with the device.
|
||||
* @type {number}
|
||||
*/
|
||||
romBaudrate: number;
|
||||
/**
|
||||
* Flag indicating whether to enable debug logging for the loader (optional).
|
||||
* @type {boolean}
|
||||
*/
|
||||
debugLogging?: boolean;
|
||||
/**
|
||||
* Reset functions for connection. If undefined will use default ones.
|
||||
* @type {ResetConstructors}
|
||||
*/
|
||||
resetConstructors?: ResetConstructors;
|
||||
/**
|
||||
* Indicate if trace messages should be enabled or not.
|
||||
*/
|
||||
enableTracing?: boolean;
|
||||
}
|
1
node_modules/esptool-js/lib/types/loaderOptions.js
generated
vendored
Normal file
1
node_modules/esptool-js/lib/types/loaderOptions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
22
node_modules/esptool-js/lib/types/loaderTerminal.d.ts
generated
vendored
Normal file
22
node_modules/esptool-js/lib/types/loaderTerminal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* A wrapper around your implementation of a terminal by
|
||||
* implementing the clean, write and writeLine methods
|
||||
* which are called by the ESPLoader class.
|
||||
* @interface IEspLoaderTerminal
|
||||
*/
|
||||
export interface IEspLoaderTerminal {
|
||||
/**
|
||||
* Execute a terminal clean command.
|
||||
*/
|
||||
clean: () => void;
|
||||
/**
|
||||
* Write a string of data that include a line terminator.
|
||||
* @param {string} data - The string to write with line terminator.
|
||||
*/
|
||||
writeLine: (data: string) => void;
|
||||
/**
|
||||
* Write a string of data.
|
||||
* @param {string} data - The string to write.
|
||||
*/
|
||||
write: (data: string) => void;
|
||||
}
|
1
node_modules/esptool-js/lib/types/loaderTerminal.js
generated
vendored
Normal file
1
node_modules/esptool-js/lib/types/loaderTerminal.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
8
node_modules/esptool-js/lib/types/resetModes.d.ts
generated
vendored
Normal file
8
node_modules/esptool-js/lib/types/resetModes.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Reset modes that can be used before connection to chip
|
||||
*/
|
||||
export declare type Before = "default_reset" | "usb_reset" | "no_reset" | "no_reset_no_sync";
|
||||
/**
|
||||
* Reset modes that can be used after operation is finished.
|
||||
*/
|
||||
export declare type After = "hard_reset" | "soft_reset" | "no_reset" | "no_reset_stub";
|
1
node_modules/esptool-js/lib/types/resetModes.js
generated
vendored
Normal file
1
node_modules/esptool-js/lib/types/resetModes.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
8
node_modules/esptool-js/lib/util.d.ts
generated
vendored
Normal file
8
node_modules/esptool-js/lib/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Pad to the next alignment boundary
|
||||
* @param {Uint8Array} data Uint8Array data to pad
|
||||
* @param {number} alignment Alignment boundary to fulfill
|
||||
* @param {number} padCharacter Character to fill with
|
||||
* @returns {Uint8Array} Padded UInt8Array image
|
||||
*/
|
||||
export declare function padTo(data: Uint8Array, alignment: number, padCharacter?: number): Uint8Array;
|
18
node_modules/esptool-js/lib/util.js
generated
vendored
Normal file
18
node_modules/esptool-js/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Pad to the next alignment boundary
|
||||
* @param {Uint8Array} data Uint8Array data to pad
|
||||
* @param {number} alignment Alignment boundary to fulfill
|
||||
* @param {number} padCharacter Character to fill with
|
||||
* @returns {Uint8Array} Padded UInt8Array image
|
||||
*/
|
||||
export function padTo(data, alignment, padCharacter = 0xff) {
|
||||
const padMod = data.length % alignment;
|
||||
if (padMod !== 0) {
|
||||
const padding = new Uint8Array(alignment - padMod).fill(padCharacter);
|
||||
const paddedData = new Uint8Array(data.length + padding.length);
|
||||
paddedData.set(data);
|
||||
paddedData.set(padding, data.length);
|
||||
return paddedData;
|
||||
}
|
||||
return data;
|
||||
}
|
154
node_modules/esptool-js/lib/webserial.d.ts
generated
vendored
Normal file
154
node_modules/esptool-js/lib/webserial.d.ts
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
/// <reference types="w3c-web-serial" />
|
||||
/**
|
||||
* Options for device serialPort.
|
||||
* @interface SerialOptions
|
||||
*
|
||||
* Note: According to the documentation of the Web Serial API, 'baudRate' is a
|
||||
* 'required' field as part of serial options. However, we are currently
|
||||
* maintaining 'baudRate' as a separate parameter outside the options
|
||||
* dictionary, and it is effectively used in the code. For now, we are
|
||||
* keeping it optional in the dictionary to avoid conflicts.
|
||||
*/
|
||||
export interface SerialOptions {
|
||||
/**
|
||||
* A positive, non-zero value indicating the baud rate at which serial communication should be established.
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
baudRate?: number | undefined;
|
||||
/**
|
||||
* The number of data bits per frame. Either 7 or 8.
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
dataBits?: number | undefined;
|
||||
/**
|
||||
* The number of stop bits at the end of a frame. Either 1 or 2.
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
stopBits?: number | undefined;
|
||||
/**
|
||||
* The parity mode: none, even or odd
|
||||
* @type {ParityType | undefined}
|
||||
*/
|
||||
parity?: ParityType | undefined;
|
||||
/**
|
||||
* A positive, non-zero value indicating the size of the read and write buffers that should be created.
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
bufferSize?: number | undefined;
|
||||
/**
|
||||
* The flow control mode: none or hardware.
|
||||
* @type {FlowControlType | undefined}
|
||||
*/
|
||||
flowControl?: FlowControlType | undefined;
|
||||
}
|
||||
/**
|
||||
* Wrapper class around Webserial API to communicate with the serial device.
|
||||
* @param {typeof import("w3c-web-serial").SerialPort} device - Requested device prompted by the browser.
|
||||
*
|
||||
* ```
|
||||
* const port = await navigator.serial.requestPort();
|
||||
* ```
|
||||
*/
|
||||
declare class Transport {
|
||||
device: SerialPort;
|
||||
tracing: boolean;
|
||||
slipReaderEnabled: boolean;
|
||||
baudrate: number;
|
||||
private traceLog;
|
||||
private lastTraceTime;
|
||||
private reader;
|
||||
private buffer;
|
||||
constructor(device: SerialPort, tracing?: boolean, enableSlipReader?: boolean);
|
||||
/**
|
||||
* Request the serial device vendor ID and Product ID as string.
|
||||
* @returns {string} Return the device VendorID and ProductID from SerialPortInfo as formatted string.
|
||||
*/
|
||||
getInfo(): string;
|
||||
/**
|
||||
* Request the serial device product id from SerialPortInfo.
|
||||
* @returns {number | undefined} Return the product ID.
|
||||
*/
|
||||
getPid(): number | undefined;
|
||||
/**
|
||||
* Format received or sent data for tracing output.
|
||||
* @param {string} message Message to format as trace line.
|
||||
*/
|
||||
trace(message: string): void;
|
||||
returnTrace(): Promise<void>;
|
||||
hexify(s: Uint8Array): string;
|
||||
hexConvert(uint8Array: Uint8Array, autoSplit?: boolean): string;
|
||||
/**
|
||||
* Format data packet using the Serial Line Internet Protocol (SLIP).
|
||||
* @param {Uint8Array} data Binary unsigned 8 bit array data to format.
|
||||
* @returns {Uint8Array} Formatted unsigned 8 bit data array.
|
||||
*/
|
||||
slipWriter(data: Uint8Array): Uint8Array;
|
||||
/**
|
||||
* Write binary data to device using the WebSerial device writable stream.
|
||||
* @param {Uint8Array} data 8 bit unsigned data array to write to device.
|
||||
*/
|
||||
write(data: Uint8Array): Promise<void>;
|
||||
/**
|
||||
* Append a buffer array after another buffer array
|
||||
* @param {Uint8Array} arr1 - First array buffer.
|
||||
* @param {Uint8Array} arr2 - magic hex number to select ROM.
|
||||
* @returns {Uint8Array} Return a 8 bit unsigned array.
|
||||
*/
|
||||
appendArray(arr1: Uint8Array, arr2: Uint8Array): Uint8Array;
|
||||
private readLoop;
|
||||
newRead(numBytes: number, timeout: number): Promise<Uint8Array>;
|
||||
flushInput(): Promise<void>;
|
||||
flushOutput(): Promise<void>;
|
||||
inWaiting(): number;
|
||||
/**
|
||||
* Detect if the data read from device is a Fatal or Guru meditation error.
|
||||
* @param {Uint8Array} input Data read from device
|
||||
*/
|
||||
private detectPanicHandler;
|
||||
private SLIP_END;
|
||||
private SLIP_ESC;
|
||||
private SLIP_ESC_END;
|
||||
private SLIP_ESC_ESC;
|
||||
/**
|
||||
* Take a data array and return the first well formed packet after
|
||||
* replacing the escape sequence. Reads at least 8 bytes.
|
||||
* @param {number} timeout Timeout read data.
|
||||
* @yields {Uint8Array} Formatted packet using SLIP escape sequences.
|
||||
*/
|
||||
read(timeout: number): AsyncGenerator<Uint8Array>;
|
||||
/**
|
||||
* Read from serial device without slip formatting.
|
||||
* @yields {Uint8Array} The next number in the Fibonacci sequence.
|
||||
*/
|
||||
rawRead(): AsyncGenerator<Uint8Array>;
|
||||
_DTR_state: boolean;
|
||||
/**
|
||||
* Send the RequestToSend (RTS) signal to given state
|
||||
* # True for EN=LOW, chip in reset and False EN=HIGH, chip out of reset
|
||||
* @param {boolean} state Boolean state to set the signal
|
||||
*/
|
||||
setRTS(state: boolean): Promise<void>;
|
||||
/**
|
||||
* Send the dataTerminalReady (DTS) signal to given state
|
||||
* # True for IO0=LOW, chip in reset and False IO0=HIGH
|
||||
* @param {boolean} state Boolean state to set the signal
|
||||
*/
|
||||
setDTR(state: boolean): Promise<void>;
|
||||
/**
|
||||
* Connect to serial device using the Webserial open method.
|
||||
* @param {number} baud Number baud rate for serial connection. Default is 115200.
|
||||
* @param {typeof import("w3c-web-serial").SerialOptions} serialOptions Serial Options for WebUSB SerialPort class.
|
||||
*/
|
||||
connect(baud?: number, serialOptions?: SerialOptions): Promise<void>;
|
||||
sleep(ms: number): Promise<unknown>;
|
||||
/**
|
||||
* Wait for a given timeout ms for serial device unlock.
|
||||
* @param {number} timeout Timeout time in milliseconds (ms) to sleep
|
||||
*/
|
||||
waitForUnlock(timeout: number): Promise<void>;
|
||||
/**
|
||||
* Disconnect from serial device by running SerialPort.close() after streams unlock.
|
||||
*/
|
||||
disconnect(): Promise<void>;
|
||||
}
|
||||
export { Transport };
|
383
node_modules/esptool-js/lib/webserial.js
generated
vendored
Normal file
383
node_modules/esptool-js/lib/webserial.js
generated
vendored
Normal file
@@ -0,0 +1,383 @@
|
||||
/* global SerialPort, ParityType, FlowControlType */
|
||||
/**
|
||||
* Wrapper class around Webserial API to communicate with the serial device.
|
||||
* @param {typeof import("w3c-web-serial").SerialPort} device - Requested device prompted by the browser.
|
||||
*
|
||||
* ```
|
||||
* const port = await navigator.serial.requestPort();
|
||||
* ```
|
||||
*/
|
||||
class Transport {
|
||||
constructor(device, tracing = false, enableSlipReader = true) {
|
||||
this.device = device;
|
||||
this.tracing = tracing;
|
||||
this.slipReaderEnabled = false;
|
||||
this.baudrate = 0;
|
||||
this.traceLog = "";
|
||||
this.lastTraceTime = Date.now();
|
||||
this.buffer = new Uint8Array(0);
|
||||
this.SLIP_END = 0xc0;
|
||||
this.SLIP_ESC = 0xdb;
|
||||
this.SLIP_ESC_END = 0xdc;
|
||||
this.SLIP_ESC_ESC = 0xdd;
|
||||
this._DTR_state = false;
|
||||
this.slipReaderEnabled = enableSlipReader;
|
||||
}
|
||||
/**
|
||||
* Request the serial device vendor ID and Product ID as string.
|
||||
* @returns {string} Return the device VendorID and ProductID from SerialPortInfo as formatted string.
|
||||
*/
|
||||
getInfo() {
|
||||
const info = this.device.getInfo();
|
||||
return info.usbVendorId && info.usbProductId
|
||||
? `WebSerial VendorID 0x${info.usbVendorId.toString(16)} ProductID 0x${info.usbProductId.toString(16)}`
|
||||
: "";
|
||||
}
|
||||
/**
|
||||
* Request the serial device product id from SerialPortInfo.
|
||||
* @returns {number | undefined} Return the product ID.
|
||||
*/
|
||||
getPid() {
|
||||
return this.device.getInfo().usbProductId;
|
||||
}
|
||||
/**
|
||||
* Format received or sent data for tracing output.
|
||||
* @param {string} message Message to format as trace line.
|
||||
*/
|
||||
trace(message) {
|
||||
const delta = Date.now() - this.lastTraceTime;
|
||||
const prefix = `TRACE ${delta.toFixed(3)}`;
|
||||
const traceMessage = `${prefix} ${message}`;
|
||||
console.log(traceMessage);
|
||||
this.traceLog += traceMessage + "\n";
|
||||
}
|
||||
async returnTrace() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(this.traceLog);
|
||||
console.log("Text copied to clipboard!");
|
||||
}
|
||||
catch (err) {
|
||||
console.error("Failed to copy text:", err);
|
||||
}
|
||||
}
|
||||
hexify(s) {
|
||||
return Array.from(s)
|
||||
.map((byte) => byte.toString(16).padStart(2, "0"))
|
||||
.join("")
|
||||
.padEnd(16, " ");
|
||||
}
|
||||
hexConvert(uint8Array, autoSplit = true) {
|
||||
if (autoSplit && uint8Array.length > 16) {
|
||||
let result = "";
|
||||
let s = uint8Array;
|
||||
while (s.length > 0) {
|
||||
const line = s.slice(0, 16);
|
||||
const asciiLine = String.fromCharCode(...line)
|
||||
.split("")
|
||||
.map((c) => (c === " " || (c >= " " && c <= "~" && c !== " ") ? c : "."))
|
||||
.join("");
|
||||
s = s.slice(16);
|
||||
result += `\n ${this.hexify(line.slice(0, 8))} ${this.hexify(line.slice(8))} | ${asciiLine}`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
return this.hexify(uint8Array);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format data packet using the Serial Line Internet Protocol (SLIP).
|
||||
* @param {Uint8Array} data Binary unsigned 8 bit array data to format.
|
||||
* @returns {Uint8Array} Formatted unsigned 8 bit data array.
|
||||
*/
|
||||
slipWriter(data) {
|
||||
const outData = [];
|
||||
outData.push(0xc0);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i] === 0xdb) {
|
||||
outData.push(0xdb, 0xdd);
|
||||
}
|
||||
else if (data[i] === 0xc0) {
|
||||
outData.push(0xdb, 0xdc);
|
||||
}
|
||||
else {
|
||||
outData.push(data[i]);
|
||||
}
|
||||
}
|
||||
outData.push(0xc0);
|
||||
return new Uint8Array(outData);
|
||||
}
|
||||
/**
|
||||
* Write binary data to device using the WebSerial device writable stream.
|
||||
* @param {Uint8Array} data 8 bit unsigned data array to write to device.
|
||||
*/
|
||||
async write(data) {
|
||||
const outData = this.slipWriter(data);
|
||||
if (this.device.writable) {
|
||||
const writer = this.device.writable.getWriter();
|
||||
if (this.tracing) {
|
||||
console.log("Write bytes");
|
||||
this.trace(`Write ${outData.length} bytes: ${this.hexConvert(outData)}`);
|
||||
}
|
||||
await writer.write(outData);
|
||||
writer.releaseLock();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Append a buffer array after another buffer array
|
||||
* @param {Uint8Array} arr1 - First array buffer.
|
||||
* @param {Uint8Array} arr2 - magic hex number to select ROM.
|
||||
* @returns {Uint8Array} Return a 8 bit unsigned array.
|
||||
*/
|
||||
appendArray(arr1, arr2) {
|
||||
const combined = new Uint8Array(arr1.length + arr2.length);
|
||||
combined.set(arr1);
|
||||
combined.set(arr2, arr1.length);
|
||||
return combined;
|
||||
}
|
||||
// Asynchronous generator to yield incoming data chunks
|
||||
async *readLoop(timeout) {
|
||||
if (!this.reader)
|
||||
return;
|
||||
try {
|
||||
while (true) {
|
||||
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error("Read timeout exceeded")), timeout));
|
||||
// Await the race between the timeout and the reader read
|
||||
const result = await Promise.race([this.reader.read(), timeoutPromise]);
|
||||
// If a timeout occurs, result will be null; otherwise, it will have { value, done }
|
||||
if (result === null)
|
||||
break;
|
||||
const { value, done } = result;
|
||||
if (done || !value)
|
||||
break;
|
||||
yield value; // Yield each data chunk
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Error reading from serial port:", error);
|
||||
}
|
||||
finally {
|
||||
this.buffer = new Uint8Array(0);
|
||||
}
|
||||
}
|
||||
// Read a specific number of bytes
|
||||
async newRead(numBytes, timeout) {
|
||||
if (this.buffer.length >= numBytes) {
|
||||
const output = this.buffer.slice(0, numBytes);
|
||||
this.buffer = this.buffer.slice(numBytes); // Remove the returned data from buffer
|
||||
return output;
|
||||
}
|
||||
while (this.buffer.length < numBytes) {
|
||||
const readLoop = this.readLoop(timeout);
|
||||
const { value, done } = await readLoop.next();
|
||||
if (done || !value) {
|
||||
break;
|
||||
}
|
||||
// Append the newly read data to the buffer
|
||||
this.buffer = this.appendArray(this.buffer, value);
|
||||
}
|
||||
// Return as much data as possible
|
||||
const output = this.buffer.slice(0, numBytes);
|
||||
this.buffer = this.buffer.slice(numBytes);
|
||||
return output;
|
||||
}
|
||||
async flushInput() {
|
||||
var _a;
|
||||
if (this.reader && !(await this.reader.closed)) {
|
||||
await this.reader.cancel();
|
||||
this.reader.releaseLock();
|
||||
this.reader = (_a = this.device.readable) === null || _a === void 0 ? void 0 : _a.getReader();
|
||||
}
|
||||
}
|
||||
async flushOutput() {
|
||||
var _a, _b;
|
||||
this.buffer = new Uint8Array(0);
|
||||
await ((_a = this.device.writable) === null || _a === void 0 ? void 0 : _a.getWriter().close());
|
||||
(_b = this.device.writable) === null || _b === void 0 ? void 0 : _b.getWriter().releaseLock();
|
||||
}
|
||||
// `inWaiting` returns the count of bytes in the buffer
|
||||
inWaiting() {
|
||||
return this.buffer.length;
|
||||
}
|
||||
/**
|
||||
* Detect if the data read from device is a Fatal or Guru meditation error.
|
||||
* @param {Uint8Array} input Data read from device
|
||||
*/
|
||||
detectPanicHandler(input) {
|
||||
const guruMeditationRegex = /G?uru Meditation Error: (?:Core \d panic'ed \(([a-zA-Z ]*)\))?/;
|
||||
const fatalExceptionRegex = /F?atal exception \(\d+\): (?:([a-zA-Z ]*)?.*epc)?/;
|
||||
const inputString = new TextDecoder("utf-8").decode(input);
|
||||
const match = inputString.match(guruMeditationRegex) || inputString.match(fatalExceptionRegex);
|
||||
if (match) {
|
||||
const cause = match[1] || match[2];
|
||||
const msg = `Guru Meditation Error detected${cause ? ` (${cause})` : ""}`;
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Take a data array and return the first well formed packet after
|
||||
* replacing the escape sequence. Reads at least 8 bytes.
|
||||
* @param {number} timeout Timeout read data.
|
||||
* @yields {Uint8Array} Formatted packet using SLIP escape sequences.
|
||||
*/
|
||||
async *read(timeout) {
|
||||
var _a;
|
||||
if (!this.reader) {
|
||||
this.reader = (_a = this.device.readable) === null || _a === void 0 ? void 0 : _a.getReader();
|
||||
}
|
||||
let partialPacket = null;
|
||||
let isEscaping = false;
|
||||
let successfulSlip = false;
|
||||
while (true) {
|
||||
const waitingBytes = this.inWaiting();
|
||||
const readBytes = await this.newRead(waitingBytes > 0 ? waitingBytes : 1, timeout);
|
||||
if (!readBytes || readBytes.length === 0) {
|
||||
const msg = partialPacket === null
|
||||
? successfulSlip
|
||||
? "Serial data stream stopped: Possible serial noise or corruption."
|
||||
: "No serial data received."
|
||||
: `Packet content transfer stopped`;
|
||||
this.trace(msg);
|
||||
throw new Error(msg);
|
||||
}
|
||||
this.trace(`Read ${readBytes.length} bytes: ${this.hexConvert(readBytes)}`);
|
||||
let i = 0; // Track position in readBytes
|
||||
while (i < readBytes.length) {
|
||||
const byte = readBytes[i++];
|
||||
if (partialPacket === null) {
|
||||
if (byte === this.SLIP_END) {
|
||||
partialPacket = new Uint8Array(0); // Start of a new packet
|
||||
}
|
||||
else {
|
||||
this.trace(`Read invalid data: ${this.hexConvert(readBytes)}`);
|
||||
const remainingData = await this.newRead(this.inWaiting(), timeout);
|
||||
this.trace(`Remaining data in serial buffer: ${this.hexConvert(remainingData)}`);
|
||||
this.detectPanicHandler(new Uint8Array([...readBytes, ...(remainingData || [])]));
|
||||
throw new Error(`Invalid head of packet (0x${byte.toString(16)}): Possible serial noise or corruption.`);
|
||||
}
|
||||
}
|
||||
else if (isEscaping) {
|
||||
isEscaping = false;
|
||||
if (byte === this.SLIP_ESC_END) {
|
||||
partialPacket = this.appendArray(partialPacket, new Uint8Array([this.SLIP_END]));
|
||||
}
|
||||
else if (byte === this.SLIP_ESC_ESC) {
|
||||
partialPacket = this.appendArray(partialPacket, new Uint8Array([this.SLIP_ESC]));
|
||||
}
|
||||
else {
|
||||
this.trace(`Read invalid data: ${this.hexConvert(readBytes)}`);
|
||||
const remainingData = await this.newRead(this.inWaiting(), timeout);
|
||||
this.trace(`Remaining data in serial buffer: ${this.hexConvert(remainingData)}`);
|
||||
this.detectPanicHandler(new Uint8Array([...readBytes, ...(remainingData || [])]));
|
||||
throw new Error(`Invalid SLIP escape (0xdb, 0x${byte.toString(16)})`);
|
||||
}
|
||||
}
|
||||
else if (byte === this.SLIP_ESC) {
|
||||
isEscaping = true;
|
||||
}
|
||||
else if (byte === this.SLIP_END) {
|
||||
this.trace(`Received full packet: ${this.hexConvert(partialPacket)}`);
|
||||
this.buffer = this.appendArray(this.buffer, readBytes.slice(i));
|
||||
yield partialPacket;
|
||||
partialPacket = null;
|
||||
successfulSlip = true;
|
||||
}
|
||||
else {
|
||||
partialPacket = this.appendArray(partialPacket, new Uint8Array([byte]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Read from serial device without slip formatting.
|
||||
* @yields {Uint8Array} The next number in the Fibonacci sequence.
|
||||
*/
|
||||
async *rawRead() {
|
||||
if (!this.reader)
|
||||
return;
|
||||
try {
|
||||
while (true) {
|
||||
const { value, done } = await this.reader.read();
|
||||
if (done || !value)
|
||||
break;
|
||||
if (this.tracing) {
|
||||
console.log("Raw Read bytes");
|
||||
this.trace(`Read ${value.length} bytes: ${this.hexConvert(value)}`);
|
||||
}
|
||||
yield value; // Yield each data chunk
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Error reading from serial port:", error);
|
||||
}
|
||||
finally {
|
||||
this.buffer = new Uint8Array(0);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Send the RequestToSend (RTS) signal to given state
|
||||
* # True for EN=LOW, chip in reset and False EN=HIGH, chip out of reset
|
||||
* @param {boolean} state Boolean state to set the signal
|
||||
*/
|
||||
async setRTS(state) {
|
||||
await this.device.setSignals({ requestToSend: state });
|
||||
// # Work-around for adapters on Windows using the usbser.sys driver:
|
||||
// # generate a dummy change to DTR so that the set-control-line-state
|
||||
// # request is sent with the updated RTS state and the same DTR state
|
||||
// Referenced to esptool.py
|
||||
await this.setDTR(this._DTR_state);
|
||||
}
|
||||
/**
|
||||
* Send the dataTerminalReady (DTS) signal to given state
|
||||
* # True for IO0=LOW, chip in reset and False IO0=HIGH
|
||||
* @param {boolean} state Boolean state to set the signal
|
||||
*/
|
||||
async setDTR(state) {
|
||||
this._DTR_state = state;
|
||||
await this.device.setSignals({ dataTerminalReady: state });
|
||||
}
|
||||
/**
|
||||
* Connect to serial device using the Webserial open method.
|
||||
* @param {number} baud Number baud rate for serial connection. Default is 115200.
|
||||
* @param {typeof import("w3c-web-serial").SerialOptions} serialOptions Serial Options for WebUSB SerialPort class.
|
||||
*/
|
||||
async connect(baud = 115200, serialOptions = {}) {
|
||||
var _a;
|
||||
await this.device.open({
|
||||
baudRate: baud,
|
||||
dataBits: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.dataBits,
|
||||
stopBits: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.stopBits,
|
||||
bufferSize: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.bufferSize,
|
||||
parity: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.parity,
|
||||
flowControl: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.flowControl,
|
||||
});
|
||||
this.baudrate = baud;
|
||||
this.reader = (_a = this.device.readable) === null || _a === void 0 ? void 0 : _a.getReader();
|
||||
}
|
||||
async sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
/**
|
||||
* Wait for a given timeout ms for serial device unlock.
|
||||
* @param {number} timeout Timeout time in milliseconds (ms) to sleep
|
||||
*/
|
||||
async waitForUnlock(timeout) {
|
||||
while ((this.device.readable && this.device.readable.locked) ||
|
||||
(this.device.writable && this.device.writable.locked)) {
|
||||
await this.sleep(timeout);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Disconnect from serial device by running SerialPort.close() after streams unlock.
|
||||
*/
|
||||
async disconnect() {
|
||||
var _a, _b;
|
||||
if ((_a = this.device.readable) === null || _a === void 0 ? void 0 : _a.locked) {
|
||||
await ((_b = this.reader) === null || _b === void 0 ? void 0 : _b.cancel());
|
||||
}
|
||||
await this.waitForUnlock(400);
|
||||
await this.device.close();
|
||||
this.reader = undefined;
|
||||
}
|
||||
}
|
||||
export { Transport };
|
57
node_modules/esptool-js/package.json
generated
vendored
Normal file
57
node_modules/esptool-js/package.json
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "esptool-js",
|
||||
"version": "0.5.6",
|
||||
"module": "lib/index.js",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"bundle.js"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run clean && tsc && rollup --config",
|
||||
"clean": "rimraf lib bundle.js .parcel-cache esptool-js-*.tgz",
|
||||
"format": "prettier --write \"src/**/*.ts\"",
|
||||
"genDocs": "rimraf docs && typedoc",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"lintAndFix": "eslint . --ext .ts --fix",
|
||||
"prepare": "npm run build",
|
||||
"test": "echo \"Error: no test specified\"",
|
||||
"prepublishOnly": "npm run test && npm run lint"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/espressif/esptool-js.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/espressif/esptool-js/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"atob-lite": "^2.0.0",
|
||||
"pako": "^2.1.0",
|
||||
"tslib": "^2.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-babel": "^6.0.2",
|
||||
"@rollup/plugin-commonjs": "^23.0.2",
|
||||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"@rollup/plugin-terser": "^0.1.0",
|
||||
"@types/atob-lite": "^2.0.2",
|
||||
"@types/pako": "^2.0.0",
|
||||
"@types/w3c-web-serial": "^1.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.43.0",
|
||||
"@typescript-eslint/parser": "^5.43.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jsdoc": "^46.4.5",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"prettier": "^2.7.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^3.3.0",
|
||||
"typedoc": "^0.25.2",
|
||||
"typescript": "^4.8.4"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user