Board Info Generator Script
This commit is contained in:
parent
51265597d4
commit
dcf69a3dfd
3 changed files with 70 additions and 147 deletions
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
|
|
@ -50,6 +50,14 @@ jobs:
|
|||
run: python3 check-boards.py
|
||||
- name: Check Image Dimensions
|
||||
run: python3 check-images.py
|
||||
- name: Generate ESP32 Boards JSON
|
||||
run: python3 generate-board-info.py
|
||||
- name: Upload ESP32 Boards JSON To AWS S3
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
run: |
|
||||
[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp esp32_boards.json s3://adafruit-circuit-python/esp32_boards.json --no-progress --region us-east-1
|
||||
- name: Build site with jekyll
|
||||
run: |
|
||||
bundle exec jekyll build -d build
|
||||
|
|
|
|||
|
|
@ -1,147 +0,0 @@
|
|||
<!--
|
||||
// Wizard screens
|
||||
// - Menu (installerMenu)
|
||||
// - Verify user wants to install (installerVerify)
|
||||
// - erase flash (installerErase)
|
||||
// - if esp32 or c3 flash bin (installerFlash)
|
||||
// - if s2 or s3, flash bootloader (installerFlash)
|
||||
// - if s2 or s3, copy uf2 (May need to use File System Access API)
|
||||
// - request wifi credentials (skip, connect buttons) and AP password
|
||||
// - generate and program settings.toml via REPL
|
||||
// - install complete
|
||||
-->
|
||||
|
||||
<dialog class="installer" id="installerMenu">
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog class="installer" id="installerVerify">
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog class="installer" id="installerErase">
|
||||
|
||||
</dialog>
|
||||
|
||||
<!-- Used for flashing either bin or uf2 -->
|
||||
<dialog class="installer" id="installerFlash">
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog class="installer" id="installerCopyUf2">
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog class="installer" id="installerCredentials">
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog class="installer" id="installerGenerateSettings">
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog class="installer" id="installerSuccess">
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog class="installer" id="installerError">
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog id="installerDialog">
|
||||
<main class="main">
|
||||
<div id="notSupported" class="notSupported">
|
||||
Sorry, <b>Web Serial</b> is not supported on your browser at this time. Browsers we expect to work:
|
||||
<ul>
|
||||
<li>Google Chrome 89 (and higher)</li>
|
||||
<li>Microsoft Edge 89 (and higher)</li>
|
||||
<li>Opera 75 (and higher)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="subheader">
|
||||
<div class="left">
|
||||
<span class="title">ESP32 CircuitPython Installer</span>
|
||||
<span><strong>This tool will install CircuitPython on ESP32 boards. Click below to see if your board is supported, then follow the instructions to install the firmware.</strong></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="app">
|
||||
<ol class="tutorial-steps">
|
||||
<li class="step-1">
|
||||
<p>
|
||||
Make sure your board is plugged into this computer via a Serial connection using a USB Cable.
|
||||
</p>
|
||||
<ul>
|
||||
<li><p><em><strong>NOTE:</strong> A lot of people end up using charge-only USB cables and it is very frustrating! Make sure you have a USB cable you know is good for data sync.</em></p></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="step-1">
|
||||
<p>
|
||||
<button id="butConnect" type="button">Connect</button>
|
||||
Click this button to open the Web Serial connection menu.
|
||||
</p>
|
||||
|
||||
<p>There may be many devices listed, such as your remembered Bluetooth peripherals, anything else plugged into USB, etc.</p>
|
||||
|
||||
<p>
|
||||
If you aren't sure which to choose, look for words like "USB", "UART", and "Bridge Controller". There may be more than one right option depending on your system configuration. Experiment if needed.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li class="step-2 hidden">
|
||||
<p><strong>Do not disconnect your board from your computer from this point!</strong></p>
|
||||
</li>
|
||||
|
||||
<li class="step-2 hidden">
|
||||
<p>Enter the credentials for the wifi network your board will connect to, as well as the initial Web Workflow password.</p>
|
||||
|
||||
<ul>
|
||||
<li><p><em><strong>NOTE:</strong> Your wifi network must be using 2.4Ghz frequency.</em></p></li>
|
||||
</ul>
|
||||
|
||||
<div id="commands">
|
||||
<div class="field">
|
||||
<label><span>WiFi Network Name (SSID):</span>
|
||||
<input id="network_type_wifi.network_ssid" class="partition-data" type="text" placeholder="WiFi SSID" value="" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label><span>WiFi Password:</span>
|
||||
<input id="network_type_wifi.network_password" class="partition-data" type="text" placeholder="WiFi Password" value="" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label><span>Web Workflow Password:</span>
|
||||
<input id="web_workflow_password" class="partition-data" type="text" placeholder="Web Workflow Password" value="" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="step-3 hidden">
|
||||
<p>Click "Install CircuitPython" to get the process started. If you would like to manually install CircuitPython and simply want to perform a factory reset, click "Install UF2 Bootloader ONLY".</p>
|
||||
<div class="buttons" style="text-align: center;">
|
||||
<button id="butProgram" type="button">Install CircuitPython</button>
|
||||
<button id="butProgramBootloader" type="button">Install UF2 Bootloader ONLY</button>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="step-4 hidden">
|
||||
<p>CircuitPython is installing, please wait...</p>
|
||||
<div class="buttons">
|
||||
<div id="stepname" class="hidden"></div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div id="progressBar" class="progress-bar hidden"><div></div></div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="step-5 hidden">
|
||||
<p>CircuitPython successfully installed. <strong>Reset your board</strong>!</a></p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div id="log" class="hidden console-item"></div>
|
||||
</main>
|
||||
</dialog>
|
||||
62
generate-board-info.py
Normal file
62
generate-board-info.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/python3
|
||||
import json
|
||||
from pathlib import Path
|
||||
import frontmatter
|
||||
|
||||
INCLUDED_CHIP_FAMILIES = ("esp32s2", "esp32s3", "esp32c3", "esp32")
|
||||
BOOTLOADER_URL_PREFIX = "https://adafruit-circuit-python.s3.amazonaws.com/bootloaders/esp32/"
|
||||
DOWNLOAD_URL_PREFIX = "https://adafruit-circuit-python.s3.amazonaws.com/bin/"
|
||||
OUTPUT_FILENAME = 'esp32_boards.json'
|
||||
|
||||
# Get CircuitPython Bootloader Info
|
||||
with open('./_data/bootloaders.json', "rt") as f:
|
||||
bootloaders = json.load(f)
|
||||
|
||||
with open('./_data/files.json', "rt") as f:
|
||||
board_info = json.load(f)
|
||||
|
||||
def get_releases(board_id):
|
||||
releases = []
|
||||
for board in board_info:
|
||||
if board_id in board["id"]:
|
||||
for board_releases in board["versions"]:
|
||||
release = {}
|
||||
release["version"] = board_releases["version"]
|
||||
for extension in board_releases["extensions"]:
|
||||
release[f'{extension}file'] = f'{DOWNLOAD_URL_PREFIX}/{board_id}/en_US/adafruit-circuitpython-{board_id}-en_US-{release["version"]}.{extension}'
|
||||
releases.append(release)
|
||||
break
|
||||
return releases
|
||||
|
||||
def get_bootloader(chipfamily, bootloader_id):
|
||||
if chipfamily in bootloaders and "version" in bootloaders[chipfamily]:
|
||||
bootloader_version = bootloaders[chipfamily]["version"]
|
||||
return f"{BOOTLOADER_URL_PREFIX}tinyuf2-{bootloader_id}-{bootloader_version}.zip"
|
||||
return None
|
||||
|
||||
def generate_boards(folder):
|
||||
boards = {}
|
||||
for filename in Path(folder).glob("*.md"):
|
||||
board = {}
|
||||
with open(filename, "rt") as f:
|
||||
metadata, _ = frontmatter.parse(f.read())
|
||||
downloads_display = metadata.get('downloads_display')
|
||||
if downloads_display is None or downloads_display:
|
||||
board_id = metadata.get('board_id') or ()
|
||||
if board_id == "unknown":
|
||||
continue
|
||||
board["name"] = metadata.get('name')
|
||||
board["chipfamily"] = metadata.get('family')
|
||||
if board["chipfamily"] not in INCLUDED_CHIP_FAMILIES:
|
||||
continue
|
||||
bootloader_id = metadata.get('bootloader_id')
|
||||
if board["chipfamily"] and bootloader_id:
|
||||
board["bootloader"] = get_bootloader(board["chipfamily"], bootloader_id)
|
||||
board["releases"] = get_releases(board_id)
|
||||
boards[board_id] = board
|
||||
return boards
|
||||
|
||||
boards = generate_boards("_board")
|
||||
|
||||
with open(OUTPUT_FILENAME, "wt") as f:
|
||||
json.dump(boards, f, indent=4)
|
||||
Loading…
Reference in a new issue