From 5336fb604f8a0266df807060855e47bf8123166a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 1 Feb 2024 13:34:49 +0100 Subject: [PATCH] Upstream changes --- .github/workflows/build_esptool.yml | 6 ++ .github/workflows/test_esptool.yml | 13 +++- .gitlab-ci.yml | 9 +-- .pre-commit-config.yaml | 13 ++-- .ruff.toml | 59 +++++++++++++++++++ CONTRIBUTING.rst | 14 ++--- .../advanced-topics/boot-mode-selection.rst | 2 +- docs/en/esptool/advanced-commands.rst | 2 +- docs/en/esptool/flash-modes.rst | 2 +- docs/en/esptool/flashing-firmware.rst | 12 ++-- docs/en/troubleshooting.rst | 2 +- espefuse/efuse/base_fields.py | 5 +- espefuse/efuse/esp32c2/fields.py | 5 +- espsecure/__init__.py | 6 +- esptool/bin_image.py | 2 +- esptool/cmds.py | 21 ++++--- esptool/loader.py | 24 ++++++-- .../stub_flasher/stub_flasher_32p4.json | 8 +-- flasher_stub/include/rom_functions.h | 4 +- flasher_stub/include/soc_support.h | 22 +++++-- flasher_stub/stub_io.c | 6 +- setup.cfg | 27 --------- setup.py | 5 +- test/test_esptool.py | 3 - 24 files changed, 176 insertions(+), 96 deletions(-) create mode 100644 .ruff.toml delete mode 100644 setup.cfg diff --git a/.github/workflows/build_esptool.yml b/.github/workflows/build_esptool.yml index 2b3e534a8..50146ac96 100644 --- a/.github/workflows/build_esptool.yml +++ b/.github/workflows/build_esptool.yml @@ -41,6 +41,12 @@ jobs: python -m pip install --upgrade pip pip install pyinstaller pip install --user -e . + - name: Build with PyInstaller + run: | + pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.STUBS_DIR }}*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}" esptool.py + pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.EFUSE_DIR }}*.yaml${{ matrix.SEPARATOR }}${{ env.EFUSE_DIR }}" espefuse.py + pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico espsecure.py + pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico esp_rfc2217_server.py - name: Build stub if: matrix.os == 'ubuntu-latest' run: | diff --git a/.github/workflows/test_esptool.yml b/.github/workflows/test_esptool.yml index 76401cc57..77e056fc3 100644 --- a/.github/workflows/test_esptool.yml +++ b/.github/workflows/test_esptool.yml @@ -62,4 +62,15 @@ jobs: ./ci/setup_ci_build_env.sh make -C flasher_stub V=1 cd flasher_stub && python ./compare_stubs.py - + + lint_esptool: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Lint and format with ruff + run: | + pip install --extra-index-url https://dl.espressif.com/pypi -e .[dev] + python -m ruff check + python -m ruff format diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2a193172b..0fe401bd1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,6 +41,7 @@ cache: - host_test dependencies: [] before_script: + - pip install --upgrade pip - pip install -e .[dev] --prefer-binary version_check: @@ -128,12 +129,12 @@ check_python_style: codequality: code_quality_report.json when: on_failure script: - # This step installs any 'dev' dependencies (ie flake8, Black) + # This step installs any 'dev' dependencies (ie ruff) # The runner should cache the downloads, so still quite fast. - pip install -e .[dev] --prefer-binary - - python -m flake8 --exit-zero --format gl-codeclimate --output-file code_quality_report.json - - python -m flake8 - - python -m black --check --diff . + - python -m ruff check --exit-zero --output-format=gitlab --output-file=code_quality_report.json + - python -m ruff check + - python -m ruff format .run_esptool: &run_esptool | esptool.py --help diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04f91d000..bc3f02815 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,10 @@ repos: - - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.14 hooks: - - id: flake8 - additional_dependencies: [flake8-import-order] - - repo: https://github.com/psf/black - rev: 23.11.0 - hooks: - - id: black + - id: ruff # Runs ruff linter (replaces flake8) + args: [--fix, --exit-non-zero-on-fix] # --fix for fixing errors + - id: ruff-format - repo: https://github.com/espressif/conventional-precommit-linter rev: v1.4.0 hooks: diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 000000000..1a1d17fda --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,59 @@ +# https://docs.astral.sh/ruff/settings/ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".eggs", + ".git", + "__pycache__" +] + +line-length = 88 + +select = ['E', 'F', 'W'] +ignore = ["E203"] + +# Assume Python 3.7 +target-version = "py37" + +[per-file-ignores] + + +# tests often manipulate sys.path before importing the main tools, so ignore import order violations +"test/*.py" = ["E402"] + +# multiple spaces after ',' and long lines - used for visual layout of eFuse data +"espefuse/efuse/*/mem_definition.py" = ["E241", "E501"] +"espefuse/efuse/*/operations.py" = ["E241", "E501", "F401"] +"espefuse/efuse/*/fields.py" = ["E241", "E501"] + +# ignore long lines - used for RS encoding pairs +"test/test_modules.py" = ["E501"] + +# don't check for unused imports in __init__.py files +"__init__.py" = ["F401"] + +# allow definition from star imports in docs config +"docs/conf_common.py" = ["F405"] + + + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + + +# ruff-format hook configuration +[format] +quote-style = "double" +indent-style = "space" +docstring-code-format = true + diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 6b9d5536e..e15518f9f 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -85,24 +85,22 @@ To use the tool, first install ``pre-commit``. Then enable the ``pre-commit`` an $ python -m pip install pre-commit $ pre-commit install -t pre-commit -t commit-msg -On the first commit ``pre-commit`` will install the hooks, subsequent checks will be significantly faster. If an error is found an appropriate error message will be displayed. If the error was with ``black`` then the tool will fix them for you automatically. Review the changes and re-stage for commit if you are happy with them. +On the first commit ``pre-commit`` will install the hooks, subsequent checks will be significantly faster. If an error is found an appropriate error message will be displayed. Review the changes and re-stage for commit if you are happy with them. Conventional Commits """""""""""""""""""" ``esptool.py`` complies with the `Conventional Commits standard `_. Every commit message is checked with `Conventional Precommit Linter `_, ensuring it adheres to the standard. -Flake8 -"""""" -``esptool.py`` complies with `flake8 `_ style guide enforcement. +Ruff +"""" -Black -""""" +``esptool.py`` is `PEP8 ` compliant and enforces this style guide. For compliancy checking, we use `ruff `. +``Ruff`` also auto-format files in the same style as previously used ``black``. -All files should be formatted using the `Black `_ auto-formatter. -``Black``, ``flake8``, and ``Conventional Precommit Linter`` tools will be automatically run by ``pre-commit`` if that is configured. To check your code manually before submitting, run ``python -m flake8`` and ``black .`` (the tools are installed as part of the development requirements shown at the beginning of this document). +``Ruff`` and ``Conventional Precommit Linter`` tools will be automatically run by ``pre-commit`` if that is configured. To check your code manually before submitting, run ``python -m ruff`` (this tool is installed as part of the development requirements shown at the beginning of this document). When you submit a Pull Request, the GitHub Actions automated build system will run automated checks using these tools. diff --git a/docs/en/advanced-topics/boot-mode-selection.rst b/docs/en/advanced-topics/boot-mode-selection.rst index 56468ada2..24ba24349 100644 --- a/docs/en/advanced-topics/boot-mode-selection.rst +++ b/docs/en/advanced-topics/boot-mode-selection.rst @@ -2,7 +2,7 @@ {IDF_TARGET_STRAP_BOOT_2_GPIO:default="GPIO8", esp32="GPIO2", esp32s2="GPIO46", esp32s3="GPIO46"} -{IDF_TARGET_BOOTLOADER_OFFSET:default="0",esp32="1000", esp32s2="1000"} +{IDF_TARGET_BOOTLOADER_OFFSET:default="0", esp32="1000", esp32s2="1000", esp32p4="2000"} .. _boot-mode: diff --git a/docs/en/esptool/advanced-commands.rst b/docs/en/esptool/advanced-commands.rst index bfc9d2c0c..d19309497 100644 --- a/docs/en/esptool/advanced-commands.rst +++ b/docs/en/esptool/advanced-commands.rst @@ -1,4 +1,4 @@ -{IDF_TARGET_BOOTLOADER_OFFSET:default="0x0", esp32="0x1000", esp32s2="0x1000"} +{IDF_TARGET_BOOTLOADER_OFFSET:default="0x0", esp32="0x1000", esp32s2="0x1000", esp32p4="0x2000"} .. _advanced-commands: diff --git a/docs/en/esptool/flash-modes.rst b/docs/en/esptool/flash-modes.rst index 37d3033b7..e7e10c406 100644 --- a/docs/en/esptool/flash-modes.rst +++ b/docs/en/esptool/flash-modes.rst @@ -1,4 +1,4 @@ -{IDF_TARGET_BOOTLOADER_OFFSET:default="0x0", esp32="0x1000", esp32s2="0x1000"} +{IDF_TARGET_BOOTLOADER_OFFSET:default="0x0", esp32="0x1000", esp32s2="0x1000", esp32p4="0x2000"} {IDF_TARGET_FLASH_FREQ_F:default="80", esp32c2="60", esp32h2="48"} diff --git a/docs/en/esptool/flashing-firmware.rst b/docs/en/esptool/flashing-firmware.rst index 83392ebc1..6c4276b05 100644 --- a/docs/en/esptool/flashing-firmware.rst +++ b/docs/en/esptool/flashing-firmware.rst @@ -1,3 +1,5 @@ +{IDF_TARGET_BOOTLOADER_OFFSET:default="0x0", esp32="0x1000", esp32s2="0x1000", esp32p4="0x2000"} + .. _flashing: Flashing Firmware @@ -42,10 +44,10 @@ It is also possible to assemble the command manually, please see the :ref:`espto ESP-IDF ^^^^^^^ -ESP-IDF outputs the full esptool command used for flashing after the build is finished:: +ESP-IDF outputs the full esptool command used for flashing after the build is finished, for example:: Project build complete. To flash, run this command: - python esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/hello_world.bin + python esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip {IDF_TARGET_PATH_NAME} write_flash --flash_mode dio --flash_size detect --flash_freq 40m {IDF_TARGET_BOOTLOADER_OFFSET} build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/hello_world.bin or run 'idf.py -p (PORT) flash' Arduino @@ -56,11 +58,11 @@ The full esptool command is hidden from the user by default. To expose it, open PlatformIO ^^^^^^^^^^ -To do a verbose upload and see the exact esptool invocation, run ``pio run -v -t upload`` in the terminal. In the generated output, there is the full esptool command, e.g.: +To do a verbose upload and see the exact esptool invocation, run ``pio run -v -t upload`` in the terminal. In the generated output, there is the full esptool command, you will see something like: :: - “.../.platformio/penv/bin/python2.7” “.../.platformio/packages/tool-esptoolpy/esptool.py” --chip esp32 --port “/dev/cu.usbserial001” --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 .../.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin 0x8000 .../project_folder/.pio/build/esp32doit-devkit-v1/partitions.bin 0xe000 .../.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/esp32doit-devkit-v1/firmware.bin + “.../.platformio/penv/bin/python2.7” “.../.platformio/packages/tool-esptoolpy/esptool.py” --chip {IDF_TARGET_PATH_NAME} --port “/dev/cu.usbserial001” --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect {IDF_TARGET_BOOTLOADER_OFFSET} .../.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin 0x8000 .../project_folder/.pio/build/esp32doit-devkit-v1/partitions.bin 0xe000 .../.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/esp32doit-devkit-v1/firmware.bin Flashing @@ -70,7 +72,7 @@ If you split the output, you’ll find the ``write_flash`` command with a list o Change ``PORT`` to the name of :ref:`actually used serial port ` and run the command. A successful flash looks like this:: - $ python esptool.py -p /dev/tty.usbserial-0001 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/hello_world.bin + $ python esptool.py -p /dev/tty.usbserial-0001 -b 460800 --before default_reset --after hard_reset --chip {IDF_TARGET_PATH_NAME} write_flash --flash_mode dio --flash_size detect --flash_freq 40m {IDF_TARGET_BOOTLOADER_OFFSET} build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/hello_world.bin esptool.py v3.2-dev Serial port /dev/tty.usbserial-0001 Connecting......... diff --git a/docs/en/troubleshooting.rst b/docs/en/troubleshooting.rst index 5d3e3dbf3..820bfa297 100644 --- a/docs/en/troubleshooting.rst +++ b/docs/en/troubleshooting.rst @@ -1,4 +1,4 @@ -{IDF_TARGET_BOOTLOADER_OFFSET:default="0x0", esp32="0x1000", esp32s2="0x1000"} +{IDF_TARGET_BOOTLOADER_OFFSET:default="0x0", esp32="0x1000", esp32s2="0x1000", esp32p4="0x2000"} .. _troubleshooting: diff --git a/espefuse/efuse/base_fields.py b/espefuse/efuse/base_fields.py index 8ad6616f9..13ce90b2c 100644 --- a/espefuse/efuse/base_fields.py +++ b/espefuse/efuse/base_fields.py @@ -58,8 +58,9 @@ def check_arg_value(efuse, new_value): elif efuse.efuse_type.startswith("bytes"): if new_value is None: raise esptool.FatalError( - "New value required for efuse '{}' " - "(given None)".format(efuse.name) + "New value required for efuse '{}' (given None)".format( + efuse.name + ) ) if len(new_value) * 8 != efuse.bitarray.len: raise esptool.FatalError( diff --git a/espefuse/efuse/esp32c2/fields.py b/espefuse/efuse/esp32c2/fields.py index cba599e63..bfbcae632 100644 --- a/espefuse/efuse/esp32c2/fields.py +++ b/espefuse/efuse/esp32c2/fields.py @@ -368,15 +368,14 @@ def print_field(e, new_value): class EfuseKeyPurposeField(EfuseField): + # fmt: off KEY_PURPOSES = [ - # fmt: off ("USER", 0, None), # User purposes (software-only use) ("XTS_AES_128_KEY", 1, None), # (whole 256bits) flash/PSRAM encryption ("XTS_AES_128_KEY_DERIVED_FROM_128_EFUSE_BITS", 2, None), # (lo 128bits) flash/PSRAM encryption ("SECURE_BOOT_DIGEST", 3, "DIGEST"), # (hi 128bits) Secure Boot key digest - # fmt: on - ] + ] # fmt: on KEY_PURPOSES_NAME = [name[0] for name in KEY_PURPOSES] DIGEST_KEY_PURPOSES = [name[0] for name in KEY_PURPOSES if name[2] == "DIGEST"] diff --git a/espsecure/__init__.py b/espsecure/__init__.py index b4b50d632..3d805492e 100755 --- a/espsecure/__init__.py +++ b/espsecure/__init__.py @@ -11,6 +11,7 @@ import tempfile import zlib from collections import namedtuple +from io import IOBase from cryptography import exceptions from cryptography.hazmat.backends import default_backend @@ -1802,8 +1803,11 @@ def main(custom_commandline=None): finally: for arg_name in vars(args): obj = getattr(args, arg_name) - if isinstance(obj, OutFileType): + if isinstance(obj, (OutFileType, IOBase)): obj.close() + elif isinstance(obj, list): + for f in [o for o in obj if isinstance(o, IOBase)]: + f.close() def _main(): diff --git a/esptool/bin_image.py b/esptool/bin_image.py index 114e1239d..76646cb41 100644 --- a/esptool/bin_image.py +++ b/esptool/bin_image.py @@ -1260,7 +1260,7 @@ def read_section_header(offs): nobits_secitons = [s for s in all_sections if s[1] == ELFFile.SEC_TYPE_NOBITS] # search for the string table section - if not (shstrndx * self.LEN_SEC_HEADER) in section_header_offsets: + if (shstrndx * self.LEN_SEC_HEADER) not in section_header_offsets: raise FatalError("ELF file has no STRTAB section at shstrndx %d" % shstrndx) _, sec_type, _, sec_size, sec_offs = read_section_header( shstrndx * self.LEN_SEC_HEADER diff --git a/esptool/cmds.py b/esptool/cmds.py index a12427112..09a97c4bd 100644 --- a/esptool/cmds.py +++ b/esptool/cmds.py @@ -815,9 +815,11 @@ def get_key_from_value(dict, val): print( "Checksum: {:#02x} ({})".format( image.checksum, - "valid" - if image.checksum == calc_checksum - else "invalid - calculated {:02x}".format(calc_checksum), + ( + "valid" + if image.checksum == calc_checksum + else "invalid - calculated {:02x}".format(calc_checksum) + ), ) ) try: @@ -892,8 +894,9 @@ def get_key_from_value(dict, val): ESP8266V2FirmwareImage.IMAGE_V2_MAGIC, ]: raise FatalError( - "This is not a valid image " - "(invalid magic number: {:#x})".format(magic) + "This is not a valid image " "(invalid magic number: {:#x})".format( + magic + ) ) if args.chip == "auto": @@ -940,9 +943,11 @@ def get_key_from_value(dict, val): print( "Checksum: {:02x} ({})".format( image.checksum, - "valid" - if image.checksum == calc_checksum - else "invalid - calculated {:02x}".format(calc_checksum), + ( + "valid" + if image.checksum == calc_checksum + else "invalid - calculated {:02x}".format(calc_checksum) + ), ) ) try: diff --git a/esptool/loader.py b/esptool/loader.py index 56aab58e4..3a03b0f5a 100644 --- a/esptool/loader.py +++ b/esptool/loader.py @@ -300,7 +300,17 @@ def __init__(self, port=DEFAULT_PORT, baud=ESP_ROM_BAUD, trace_enabled=False): if isinstance(port, str): try: - self._port = serial.serial_for_url(port, exclusive=True) + self._port = serial.serial_for_url( + port, exclusive=True, do_not_open=True + ) + if sys.platform == "win32": + # When opening a port on Windows, + # the RTS/DTR (active low) lines + # need to be set to False (pulled high) + # to avoid unwanted chip reset + self._port.rts = False + self._port.dtr = False + self._port.open() except serial.serialutil.SerialException as e: port_issues = [ [ # does not exist error @@ -1641,12 +1651,14 @@ def __str__(self): while len(s) > 0: line = s[:16] ascii_line = "".join( - c - if ( - c == " " - or (c in string.printable and c not in string.whitespace) + ( + c + if ( + c == " " + or (c in string.printable and c not in string.whitespace) + ) + else "." ) - else "." for c in line.decode("ascii", "replace") ) s = s[16:] diff --git a/esptool/targets/stub_flasher/stub_flasher_32p4.json b/esptool/targets/stub_flasher/stub_flasher_32p4.json index 274c62616..6f37e91b2 100644 --- a/esptool/targets/stub_flasher/stub_flasher_32p4.json +++ b/esptool/targets/stub_flasher/stub_flasher_32p4.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wYK8U9WCvFPrgrxT4QL8U/wC/FPngvxT9QI8U9AC/FPgAvxT8IK8U+ECPFP9grxT4QI8U/gCfFPJgrxT1YK8U+uCvFP8gnxTzgJ8U9oCfFP7gnxT0AO8U9WCvFPCA3xTwAO8U/EB/FPJA7xT8QH8U/EB/FPxAfxT8QH8U/EB/FPxAfxT8QH8U/EB/FPpAzxT8QH8U8mDfFPAA7xTw==", + "data_start": 1341533100, "bss_start": 1341456384 } \ No newline at end of file diff --git a/flasher_stub/include/rom_functions.h b/flasher_stub/include/rom_functions.h index ca0237220..5c7d5a8d8 100644 --- a/flasher_stub/include/rom_functions.h +++ b/flasher_stub/include/rom_functions.h @@ -18,11 +18,11 @@ int uart_rx_one_char(uint8_t *ch); uint8_t uart_rx_one_char_block(); int uart_tx_one_char(char ch); -#if ESP32C6 || ESP32H2 || ESP32C5BETA3 +#if ESP32C6 || ESP32H2 || ESP32C5BETA3 || ESP32P4 /* uart_tx_one_char doesn't send data to USB device serial, needs to be replaced */ int uart_tx_one_char2(char ch); #define uart_tx_one_char(ch) uart_tx_one_char2(ch) -#endif // ESP32C6 || ESP32H2 || ESP32C5BETA3 +#endif // ESP32C6 || ESP32H2 || ESP32C5BETA3 || ESP32P4 void uart_div_modify(uint32_t uart_no, uint32_t baud_div); diff --git a/flasher_stub/include/soc_support.h b/flasher_stub/include/soc_support.h index d77430765..38627368c 100644 --- a/flasher_stub/include/soc_support.h +++ b/flasher_stub/include/soc_support.h @@ -62,8 +62,8 @@ #endif // ESP32H2 #ifdef ESP32P4 -// TODO: Add support for USB modes when MP is available -// #define WITH_USB_JTAG_SERIAL 1 +#define WITH_USB_JTAG_SERIAL 1 +// TODO: Add support for USB OTG when MP is available // #define WITH_USB_OTG 1 #define IS_RISCV 1 #endif // ESP32P4 @@ -71,7 +71,8 @@ // Increase CPU freq to speed up read/write operations over USB // Disabled on the S3 due to stability issues, would require dbias adjustment. // https://github.com/espressif/esptool/issues/832, https://github.com/espressif/esptool/issues/808 -#define USE_MAX_CPU_FREQ ((WITH_USB_JTAG_SERIAL || WITH_USB_OTG) && !ESP32S3) +// Disabled for P4 because it is already running on high (360MHz) CPU frequency +#define USE_MAX_CPU_FREQ ((WITH_USB_JTAG_SERIAL || WITH_USB_OTG) && !ESP32S3 && !ESP32P4) // Later chips don't support ets_efuse_get_spiconfig. #define SUPPORT_CONFIG_SPI (ESP32 || ESP32S2 || ESP32S3 || ESP32S3BETA2 || ESP32C3 || ESP32H2BETA1 || ESP32H2BETA2 || ESP32C6BETA) @@ -199,6 +200,8 @@ #define SPI_BASE_REG 0x5008D000 /* SPI peripheral 1, used for SPI flash */ #define SPI0_BASE_REG 0x5008C000 /* SPI peripheral 0, inner state machine */ #define GPIO_BASE_REG 0x500E0000 +#define USB_DEVICE_BASE_REG 0x500D2000 +#define DR_REG_LP_WDT_BASE 0x50116000 #define DR_REG_IO_MUX_BASE 0x500E1000 #endif @@ -348,6 +351,17 @@ #define ETS_USB_INUM 17 /* arbitrary level 1 level interrupt */ #endif // ESP32H2 +#if ESP32P4 +#define UART_USB_OTG 5 +#define UART_USB_JTAG_SERIAL 6 + +#define DR_REG_INTERRUPT_MATRIX_BASE 0x500D6000 +#define INTERRUPT_CORE0_USB_INTR_MAP_REG (DR_REG_INTERRUPT_MATRIX_BASE + 0x58) /* USB-JTAG-Serial, CORE0_USB_DEVICE_INT_MAP_REG */ + +#define CLIC_EXT_INTR_NUM_OFFSET 16 /* For CLIC first 16 intrrupts are reserved as internal */ +#define ETS_USB_INUM 17 /* arbitrary level 1 level interrupt */ +#endif + #ifdef WITH_USB_JTAG_SERIAL #define USB_DEVICE_INT_ENA_REG (USB_DEVICE_BASE_REG + 0x010) #define USB_DEVICE_INT_CLR_REG (USB_DEVICE_BASE_REG + 0x014) @@ -389,7 +403,7 @@ #define RTC_CNTL_SWD_AUTO_FEED_EN (1 << 31) #endif -#if ESP32C6 || ESP32C5BETA3 +#if ESP32C6 || ESP32C5BETA3 || ESP32P4 #define RTC_CNTL_WDTCONFIG0_REG (DR_REG_LP_WDT_BASE + 0x0) // LP_WDT_RWDT_CONFIG0_REG #define RTC_CNTL_WDTWPROTECT_REG (DR_REG_LP_WDT_BASE + 0x0018) // LP_WDT_RWDT_WPROTECT_REG #define RTC_CNTL_SWD_CONF_REG (DR_REG_LP_WDT_BASE + 0x001C) // LP_WDT_SWD_CONFIG_REG diff --git a/flasher_stub/stub_io.c b/flasher_stub/stub_io.c index d0b08dd24..f86f67e7a 100644 --- a/flasher_stub/stub_io.c +++ b/flasher_stub/stub_io.c @@ -65,7 +65,11 @@ static void stub_configure_rx_uart(void) #if WITH_USB_JTAG_SERIAL if (stub_uses_usb_jtag_serial()) { #if IS_RISCV - WRITE_REG(INTERRUPT_CORE0_USB_INTR_MAP_REG, ETS_USB_INUM); // Route USB interrupt to CPU + #if ESP32P4 + WRITE_REG(INTERRUPT_CORE0_USB_INTR_MAP_REG, ETS_USB_INUM + CLIC_EXT_INTR_NUM_OFFSET); + #else + WRITE_REG(INTERRUPT_CORE0_USB_INTR_MAP_REG, ETS_USB_INUM); // Route USB interrupt to CPU + #endif esprv_intc_int_set_priority(ETS_USB_INUM, 1); #else WRITE_REG(INTERRUPT_CORE0_USB_DEVICE_INT_MAP_REG, ETS_USB_INUM); diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 67c9fa70a..000000000 --- a/setup.cfg +++ /dev/null @@ -1,27 +0,0 @@ -[flake8] -exclude = .git,__pycache__,.eggs,build -ignore = - # multiple spaces before operator - used for visual indent of constants in some files - E221, - -per-file-ignores = - # tests often manipulate sys.path before importing the main tools, so ignore import order violations - test/*.py: E402, - - # multiple spaces after ',' and long lines - used for visual layout of eFuse data - espefuse/efuse/*/mem_definition.py: E241, E501, - espefuse/efuse/*/operations.py: E241, E501, F401, - espefuse/efuse/*/fields.py: E241, E501, - - # ignore long lines - used for RS encoding pairs - test/test_modules.py: E501, - - # don't check for unused imports in __init__.py files - __init__.py: F401, - - # allow definition from star imports in docs config - docs/conf_common.py: F405, - -# Compatibility with Black -max-line-length = 88 -extend-ignore = E203, W503, diff --git a/setup.py b/setup.py index 2d59d5dae..a1c216825 100644 --- a/setup.py +++ b/setup.py @@ -108,12 +108,9 @@ def find_version(*file_paths): setup_requires=(["wheel"] if "bdist_wheel" in sys.argv else []), extras_require={ "dev": [ - "flake8>=3.2.0", - "flake8-import-order", - "flake8-gl-codeclimate", + "ruff>=0.1.14", "pyelftools", "coverage~=6.0", - "black", "pre-commit", "pytest", "pytest-rerunfailures", diff --git a/test/test_esptool.py b/test/test_esptool.py index 967972621..7b251ef9f 100755 --- a/test/test_esptool.py +++ b/test/test_esptool.py @@ -869,9 +869,6 @@ def test_short_flash_to_external_ROM(self): self.verify_readback(0, 1024, "images/one_kb.bin", spi_connection=self.conn) -@pytest.mark.skipif( - os.name == "nt", reason="Temporarily disabled on windows" -) # TODO: ESPTOOL-673 class TestStubReuse(EsptoolTestCase): def test_stub_reuse_with_synchronization(self): """Keep the flasher stub running and reuse it the next time."""