Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read current partitions #164

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
"license": "ISC",
"devDependencies": {
"@types/w3c-web-usb": "^1.0.10",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.1",
"parcel": "^2.8.3",
"parcel-resolver-ignore": "^2.1.5",
"rimraf": "^4.1.2",
"stream-browserify": "^3.0.0",
"string_decoder": "^1.3.0",
"typescript": "^4.9.4",
"web-serial-polyfill": "^1.0.15"
}
Expand Down
243 changes: 138 additions & 105 deletions examples/typescript/src/index.html
Original file line number Diff line number Diff line change
@@ -1,105 +1,138 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ESP Tool</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/xterm.css">
<link
href="https://fonts.googleapis.com/css?family=Orbitron"
rel="stylesheet"
/>
<link rel="icon" href="../assets/favicon.ico" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/crypto-js.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<h1 align="center"><p><img src="../assets/esp-logo.png" width="42" height="42" style="vertical-align:middle" crossorigin></img> ESP Tool</p></h1>
<h4 align="center">A Serial Flasher utility for Espressif chips</h4>
<div id="safariErr" style="display:none"><p align="center" style="color:red">This tool is not supported on Safari browser!</p>
</div>
<div align="center">
<a class="btn btn-info" href="./docs/index.html">View the API Documentation</a>

<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="debugLogging" value="">
<label class="form-check-label" for="debugLogging">Show Debug log</label>
</div>
</div>
<div class="container" id="main">
<hr/>
<div id="program">
<h3> Program </h3>
<label for="baudrates" id="lblBaudrate">Baudrate:</label>
<label style="display:none" id="lblConnTo">Connected to device: </label>
<select name="baudrates" id="baudrates">
<option value="921600">921600</option>
<option value="460800">460800</option>
<option value="230400">230400</option>
<option value="115200">115200</option>
</select>

<br><br>

<input class="btn btn-info btn-sm" type="button" id="connectButton" value="Connect" />
<input class="btn btn-info btn-sm" type="button" id="copyTraceButton" value="Copy Trace" />
<input class="btn btn-warning btn-sm" type="button" id="disconnectButton" value="Disconnect" />
<input class="btn btn-danger btn-sm" type="button" id="eraseButton" value="Erase Flash" />
<br>

<div class="alert alert-danger alert-dismissible" id="alertDiv" style="display:none; margin-top:10px">
<a href="#" class="close" aria-label="close" onclick="$('.alert').hide()">&times;</a>
<span id="alertmsg"></span>
</div>

<div id="files">
<table class="table table-striped" id="fileTable">
<thead class="thead-light">
<tr>
<th>Flash Address</th>
<th>File</th>
<th></th>
</tr>
</thead>
<tbody id="tableBody">
</tbody>
</table>
<input class="btn btn-info btn-sm" type="button" id="addFile" value="Add File" />
<input class="btn btn-info btn-sm" type="button" id="programButton" value="Program" />
</div>
<output id="list"></output>
<hr/>
</div>
<div id="console">
<h3>Console </h3>
<label style="display:none" id="lblConsoleFor">Connected to device: </label>
<label for="consoleBaudrates" id="lblConsoleBaudrate">Baudrate:</label>
<select name="consoleBaudrates" id="consoleBaudrates">
<option value="115200">115200</option>
<option value="74880">74880</option>
</select>

<br><br>

<input class="btn btn-info" type="button" id="consoleStartButton" value="Start" />
<input class="btn btn-info" type="button" id="consoleStopButton" value="Stop" />
<input class="btn btn-info" type="button" id="resetButton" value="Reset" />
<hr/>
</div>
<div id="terminal"></div>
</div>
<script src="index.ts" type="module"></script>
<script>
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && window['safari'].pushNotification));

if(isSafari)
{
document.getElementById("safariErr").style.display = "inline";
document.getElementById("main").style.display = "none";
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ESP Tool</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/xterm.css">
<link
href="https://fonts.googleapis.com/css?family=Orbitron"
rel="stylesheet"
/>
<link rel="icon" href="../assets/favicon.ico" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/crypto-js.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<h1 align="center"><p><img src="../assets/esp-logo.png" width="42" height="42" style="vertical-align:middle" crossorigin></img> ESP Tool</p></h1>
<h4 align="center">A Serial Flasher utility for Espressif chips</h4>
<div id="safariErr" style="display:none"><p align="center" style="color:red">This tool is not supported on Safari browser!</p>
</div>
<div align="center">
<a class="btn btn-info" href="./docs/index.html">View the API Documentation</a>

<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="debugLogging" value="">
<label class="form-check-label" for="debugLogging">Show Debug log</label>
</div>
</div>
<div class="container" id="main">
<hr/>
<div id="program">
<h3> Program </h3>
<label for="baudrates" id="lblBaudrate">Baudrate:</label>
<label style="display:none" id="lblConnTo">Connected to device: </label>
<select name="baudrates" id="baudrates">
<option value="921600">921600</option>
<option value="460800">460800</option>
<option value="230400">230400</option>
<option value="115200">115200</option>
</select>

<br><br>

<input class="btn btn-info btn-sm" type="button" id="connectButton" value="Connect" />
<input class="btn btn-info btn-sm" type="button" id="copyTraceButton" value="Copy Trace" />
<input class="btn btn-warning btn-sm" type="button" id="disconnectButton" value="Disconnect" />
<input class="btn btn-danger btn-sm" type="button" id="eraseButton" value="Erase Flash" />
<br>

<div class="alert alert-danger alert-dismissible" id="alertDiv" style="display:none; margin-top:10px">
<a href="#" class="close" aria-label="close" onclick="$('.alert').hide()">&times;</a>
<span id="alertmsg"></span>
</div>

<div id="files">
<table class="table table-striped" id="fileTable">
<thead class="thead-light">
<tr>
<th>Flash Address</th>
<th>File</th>
<th></th>
</tr>
</thead>
<tbody id="tableBody">
</tbody>
</table>
<input class="btn btn-info btn-sm" type="button" id="addFile" value="Add File" />
<input class="btn btn-info btn-sm" type="button" id="programButton" value="Program" />
</div>
<output id="list"></output>
<hr/>
<div id="readPartitionTable">
<h3>Read Flash</h3>
<div id="readFlash" style="display:flex; ">
<div style="display: inline-flex; flex-grow:1; align-self: flex-start; align-items: baseline; align-content: space-around;">
<label for="partitionOffset">Partition Table Offset: </label>
<div style="display:inline-block; padding: 0 1rem 0 1rem;"><b>0x</b> <input type="text" id="partitionOffset" value="8000" step="1000" style="width:7rem;" /></div>
<input class="btn btn-info btn-sm" type="button" id="readPartitionButton" value="Read Partition Table" />
</div>
<div style="display: inline-flex; flex-grow: 1; align-self: flex-end; align-items: baseline; padding-left: 3rem;">
<label for="readFlashOffset">Read Offset: </label>
<div style="display:inline-block; padding: 0 2rem 0 0.5rem;">
<b>0x</b> <input type="text" id="readFlashOffset" value="0" step="1000" style="width:7rem;" /></div>
<label for="readFlashSize">Size: </label>
<div style="display:inline-block; padding: 0 2rem 0 0.5rem;">
<b>0x</b> <input type="text" id="readFlashSize" value="1000" step="1000" style="width:10rem;" />
<div style="display: inline-block">
<input type="checkbox" id="readFlashAll" title="Read All data from offset to end of flash" />
<label for="readFlashAll" title="Read All data from offset to end of flash">&nbsp;All</label>
</div>
</div>
<input class="btn btn-info btn-sm" type="button" id="readFlashData" value="Read Flash Data" />
</div>
</div>
</div>
<div id="partitionTableOutput" style="margin: 1rem 0;">
<table class="table table-striped" id="partitionTable">
<thead class="thead-light">
<tr id="partitionHeader"></tr>
</thead>
<tbody id="partitionTableBody">
</tbody>
</table>
</div>
</div>
<div id="console">
<h3>Console </h3>
<label style="display:none" id="lblConsoleFor">Connected to device: </label>
<label for="consoleBaudrates" id="lblConsoleBaudrate">Baudrate:</label>
<select name="consoleBaudrates" id="consoleBaudrates">
<option value="115200">115200</option>
<option value="74880">74880</option>
</select>

<br><br>

<input class="btn btn-info" type="button" id="consoleStartButton" value="Start" />
<input class="btn btn-info" type="button" id="consoleStopButton" value="Stop" />
<input class="btn btn-info" type="button" id="resetButton" value="Reset" />
<hr/>
</div>
<div id="terminal"></div>
</div>
<script src="index.ts" type="module"></script>
<script>
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && window['safari'].pushNotification));

if(isSafari)
{
document.getElementById("safariErr").style.display = "inline";
document.getElementById("main").style.display = "none";
}
</script>
</body>
</html>
Loading