Skip to content

Commit 90ac60f

Browse files
committed
fix(arduino): Remove bootloader offset
1 parent f777348 commit 90ac60f

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

pytest-embedded-arduino/pytest_embedded_arduino/app.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class ArduinoApp(App):
1414
fqbn (str): Fully Qualified Board Name.
1515
target (str) : ESPxx chip.
1616
flash_settings (dict[str, str]): Flash settings for the target.
17-
bootloader_offset (int): Bootloader offset.
1817
binary_file (str): Merged binary file path.
1918
elf_file (str): ELF file path.
2019
"""
@@ -34,15 +33,13 @@ def __init__(
3433
self.fqbn = self._get_fqbn(self.binary_path)
3534
self.target = self.fqbn.split(':')[2]
3635
self.flash_settings = self._get_flash_settings()
37-
self.bootloader_offset = self._get_bootloader_offset()
3836
self.binary_file = os.path.realpath(os.path.join(self.binary_path, self.sketch + '.ino.merged.bin'))
3937
self.elf_file = os.path.realpath(os.path.join(self.binary_path, self.sketch + '.ino.elf'))
4038

4139
logging.debug(f'Sketch name: {self.sketch}')
4240
logging.debug(f'FQBN: {self.fqbn}')
4341
logging.debug(f'Target: {self.target}')
4442
logging.debug(f'Flash settings: {self.flash_settings}')
45-
logging.debug(f'Bootloader offset: {self.bootloader_offset}')
4643
logging.debug(f'Binary file: {self.binary_file}')
4744
logging.debug(f'ELF file: {self.elf_file}')
4845

@@ -72,17 +69,6 @@ def _get_fqbn(self, build_path: str) -> str:
7269
fqbn = options['fqbn']
7370
return fqbn
7471

75-
def _get_bootloader_offset(self) -> int:
76-
"""Get bootloader offset from flash_args file."""
77-
flash_args_file = os.path.realpath(os.path.join(self.binary_path, 'flash_args'))
78-
with open(flash_args_file) as f:
79-
bootloader_offset = int(f.readlines()[1].split(' ')[0].strip(), 16)
80-
81-
if bootloader_offset is None:
82-
raise ValueError(f'Bootloader offset not found in {flash_args_file}')
83-
84-
return bootloader_offset
85-
8672
def _get_flash_settings(self) -> dict[str, str]:
8773
"""Get flash settings from flash_args file."""
8874
flash_args_file = os.path.realpath(os.path.join(self.binary_path, 'flash_args'))

pytest-embedded-arduino/pytest_embedded_arduino/serial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def flash(self) -> None:
5454
'--chip',
5555
self.app.target,
5656
'write-flash',
57-
hex(self.app.bootloader_offset),
57+
'0x0', # Merged binary is flashed at offset 0
5858
self.app.binary_file,
5959
*flash_settings,
6060
],

0 commit comments

Comments
 (0)