Skip to content

Commit

Permalink
ci: Add ESP32-P4 target and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radimkarnis committed Jan 22, 2024
1 parent 858ba56 commit bec1865
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ target_esp32h2_jtag_serial:
script:
- coverage run --parallel-mode -m pytest ${CI_PROJECT_DIR}/test/test_esptool.py --port /dev/serial_ports/ESP32H2_JTAG_SERIAL --preload-port /dev/serial_ports/ESP32H2_PRELOAD --chip esp32h2 --baud 115200

# ESP32P4
target_esp32p4:
extends: .target_esptool_test
tags:
- esptool_esp32p4_target
script:
- coverage run --parallel-mode -m pytest ${CI_PROJECT_DIR}/test/test_esptool.py --port /dev/serial_ports/ESP32P4 --chip esp32p4 --baud 115200

.windows_test:
stage: test
variables:
Expand Down
12 changes: 5 additions & 7 deletions test/test_esptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def run_esptool_process(cmd):
preload
and arg_preload_port
and arg_chip
in ["esp32c3", "esp32s3", "esp32c6", "esp32h2"] # With USB-JTAG/Serial
in ["esp32c3", "esp32s3", "esp32c6", "esp32h2", "esp32p4"] # With U-JS
):
port_index = base_cmd.index("--port") + 1
base_cmd[port_index] = arg_preload_port # Set the port to the preload one
Expand Down Expand Up @@ -1012,9 +1012,7 @@ class TestKeepImageSettings(EsptoolTestCase):
def setup_class(self):
super(TestKeepImageSettings, self).setup_class()
self.BL_IMAGE = f"images/bootloader_{arg_chip}.bin"
self.flash_offset = (
0x1000 if arg_chip in ("esp32", "esp32s2") else 0
) # bootloader offset
self.flash_offset = esptool.CHIP_DEFS[arg_chip].BOOTLOADER_FLASH_OFFSET
with open(self.BL_IMAGE, "rb") as f:
self.header = f.read(8)

Expand Down Expand Up @@ -1085,7 +1083,7 @@ def test_explicit_set_size_freq_mode(self):


@pytest.mark.skipif(
arg_chip in ["esp32s2", "esp32s3"],
arg_chip in ["esp32s2", "esp32s3", "esp32p4"],
reason="Not supported on targets with USB-CDC.",
)
class TestLoadRAM(EsptoolTestCase):
Expand Down Expand Up @@ -1169,7 +1167,7 @@ class TestBootloaderHeaderRewriteCases(EsptoolTestCase):
)
@pytest.mark.quick_test
def test_flash_header_rewrite(self):
bl_offset = 0x1000 if arg_chip in ("esp32", "esp32s2") else 0
bl_offset = esptool.CHIP_DEFS[arg_chip].BOOTLOADER_FLASH_OFFSET
bl_image = f"images/bootloader_{arg_chip}.bin"

output = self.run_esptool(
Expand All @@ -1187,7 +1185,7 @@ def test_flash_header_rewrite(self):
def test_flash_header_no_magic_no_rewrite(self):
# first image doesn't start with magic byte, second image does
# but neither are valid bootloader binary images for either chip
bl_offset = 0x1000 if arg_chip in ("esp32", "esp32s2") else 0
bl_offset = esptool.CHIP_DEFS[arg_chip].BOOTLOADER_FLASH_OFFSET
for image in ["images/one_kb.bin", "images/one_kb_all_ef.bin"]:
output = self.run_esptool(
f"write_flash -fm dout -ff 20m {bl_offset:#x} {image}"
Expand Down

0 comments on commit bec1865

Please sign in to comment.