GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — esptool/docs/target_capabilities.py at master · espressif/esptool

Expand file tree

/

target_capabilities.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
51 lines (40 loc) · 1.79 KB
/

target_capabilities.py

Copy path

File metadata and controls

51 lines (40 loc) · 1.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
#
# SPDX-License-Identifier: GPL-2.0-or-later
"""Derive Sphinx tags and substitutions from esptool ROM loader classes."""
from esptool.loader import ESPLoader
DOC_CAPABILITY_TAGS = (
"USB_OTG_SUPPORTED",
"USB_SERIAL_JTAG_SUPPORTED",
"WATCHDOG_RESET_SUPPORTED",
"SECURITY_INFO_SUPPORTED",
"CUSTOM_SPI_FLASH_PINS_SUPPORTED",
"FLASH_32BIT_ADDR_SUPPORTED",
)
def get_doc_tags(chip_class: type[ESPLoader]) -> list[str]:
"""Return Sphinx tags enabled for the given ROM loader class."""
return [tag for tag in DOC_CAPABILITY_TAGS if getattr(chip_class, tag, False)]
def get_doc_substitutions(chip_class: type[ESPLoader]) -> dict[str, str]:
"""Return ``{IDF_TARGET_*}`` substitution values derived from a ROM class."""
subs = {
"BOOTLOADER_OFFSET": f"0x{chip_class.BOOTLOADER_FLASH_OFFSET:x}",
}
flash_frequency = getattr(chip_class, "FLASH_FREQUENCY", None)
if not flash_frequency:
return subs
mhz = {freq: int(freq.rstrip("m")) for freq in flash_frequency}
subs["FLASH_FREQ"] = ", ".join(f"``{freq}``" for freq in flash_frequency)
subs["FLASH_FREQ_F"] = str(max(mhz.values()))
# ESP32-C6 maps both 80m and 40m to encoding 0; the lower one is the default.
subs["FLASH_FREQ_0"] = str(
min(mhz[freq] for freq, enc in flash_frequency.items() if enc == 0x0)
)
by_enc: dict[int, list[str]] = {}
for freq, enc in flash_frequency.items():
by_enc.setdefault(enc, []).append(f"{mhz[freq]}MHz")
encodings = []
for enc, values in sorted(by_enc.items()):
enc_str = str(enc) if enc < 10 else hex(enc)
encodings.append(f"``{enc_str}`` = {' or '.join(values)}")
subs["FLASH_FREQ_ENCODING"] = ", ".join(encodings)
return subs
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.