runners: jlink: Add support for big endian device

Sets the endianness of the JLink and the GDB Server based on if
`CONFIG_BIG_ENDIAN` is set.

Doc on JLink LE/BE option:
https://wiki.segger.com/J-Link_Commander#LE

Doc on GDB server -endian option:
https://wiki.segger.com/J-Link_GDB_Server#-endian

Signed-off-by: Sigmund Klåpbakken <sigmundklaa@outlook.com>
This commit is contained in:
Sigmund Klåpbakken 2024-05-15 12:41:09 +02:00 committed by Alberto Escolar
parent e98e4ed067
commit 6f215526d7

View file

@ -233,6 +233,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner):
rtos = self.thread_info_enabled and self.supports_thread_info
plugin_dir = os.fspath(Path(self.commander).parent / 'GDBServer' /
'RTOSPlugin_Zephyr')
big_endian = self.build_conf.getboolean('CONFIG_BIG_ENDIAN')
server_cmd = ([self.gdbserver] +
['-select',
@ -243,6 +244,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner):
'-speed', self.speed,
'-device', self.device,
'-silent',
'-endian', 'big' if big_endian else 'little',
'-singlerun'] +
(['-nogui'] if self.supports_nogui else []) +
(['-rtos', plugin_dir] if rtos else []) +
@ -290,6 +292,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner):
lines = [
'ExitOnError 1', # Treat any command-error as fatal
'r', # Reset and halt the target
'BE' if self.build_conf.getboolean('CONFIG_BIG_ENDIAN') else 'LE'
]
if self.erase: