Skip to content
Open
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
19 changes: 15 additions & 4 deletions pytest-embedded-idf/pytest_embedded_idf/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class IdfApp(App):
flash_args (dict[str, Any]): dict of flasher_args.json
flash_files (list[FlashFile]): list of (offset, file path, encrypted) of files need to be flashed in
flash_settings (dict[str, Any]): dict of flash settings
is_loadable_elf (bool): Chip RAM app (``APP_BUILD_TYPE_RAM`` / ``APP_BUILD_TYPE_ELF_RAM``); esptool
``load_ram`` path.
is_linux_elf (bool): Linux host ELF-only build (``APP_BUILD_TYPE_ELF_ONLY``), no flasher_args.json.
"""

XTENSA_TARGETS: ClassVar[list[str]] = ['esp32', 'esp32s2', 'esp32s3']
Expand Down Expand Up @@ -74,10 +77,13 @@ def __init__(
else:
self.is_loadable_elf = False

# Linux target: ELF-only output, no flasher_args.json.
self.is_linux_elf = bool(self.sdkconfig.get('APP_BUILD_TYPE_ELF_ONLY'))

self.bin_file = self._get_bin_file()
self.flash_args, self.flash_files, self.flash_settings = {}, [], {}

if not self.is_loadable_elf:
if not (self.is_loadable_elf or self.is_linux_elf):
self.flash_args, self.flash_files, self.flash_settings = self._parse_flash_args_json()

@property
Expand Down Expand Up @@ -153,10 +159,15 @@ def partition_table(self) -> dict[str, Any]:
if self._partition_table is not None:
return self._partition_table

partition_file = os.path.join(
self.binary_path,
self.flash_args.get('partition_table', self.flash_args.get('partition-table', {})).get('file', ''),
# see - vs _ in 'partition table' key name
partition_rel_path = self.flash_args.get('partition_table', self.flash_args.get('partition-table', {})).get(
'file', ''
)
if not partition_rel_path:
self._partition_table = {}
return self._partition_table

partition_file = os.path.join(self.binary_path, partition_rel_path)
process = subprocess.Popen(
[sys.executable, self.parttool_path, partition_file],
stdout=subprocess.PIPE,
Expand Down
5 changes: 5 additions & 0 deletions pytest-embedded-idf/pytest_embedded_idf/dut.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ def flash_via_jtag(self):
# >>> self.gdb.write('load')
return

if self.app.is_linux_elf:
# linux ELF file. OpenOCD is meaningless
logging.debug('Linux ELF-only build; skipping OpenOCD program_esp.')
return

for _f in self.app.flash_files:
if _f.encrypted:
raise ValueError("Encrypted files can't be flashed in via JTAG")
Expand Down
4 changes: 4 additions & 0 deletions pytest-embedded-idf/pytest_embedded_idf/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def _start(self):
else:
if self.app.is_loadable_elf:
self.load_ram()
elif self.app.is_linux_elf:
# Host Linux ELF (IDF_TARGET_LINUX); no flasher_args.json.
logging.info('Linux ELF-only build; skipping auto flash.')
super()._start()
else:
self.flash()

Expand Down
Loading