xtensa.py 987 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (c) 2017 Linaro Limited.
  2. #
  3. # SPDX-License-Identifier: Apache-2.0
  4. '''Runner for debugging with xt-gdb.'''
  5. from os import path
  6. from runners.core import ZephyrBinaryRunner, RunnerCaps
  7. class XtensaBinaryRunner(ZephyrBinaryRunner):
  8. '''Runner front-end for xt-gdb.'''
  9. @classmethod
  10. def name(cls):
  11. return 'xtensa'
  12. @classmethod
  13. def capabilities(cls):
  14. return RunnerCaps(commands={'debug'})
  15. @classmethod
  16. def do_add_parser(cls, parser):
  17. parser.add_argument('--xcc-tools', required=True,
  18. help='path to XTensa tools')
  19. @classmethod
  20. def do_create(cls, cfg, args):
  21. # Override any GDB with the one provided by the XTensa tools.
  22. cfg.gdb = path.join(args.xcc_tools, 'bin', 'xt-gdb')
  23. return XtensaBinaryRunner(cfg)
  24. def do_run(self, command, **kwargs):
  25. gdb_cmd = [self.cfg.gdb, self.cfg.elf_file]
  26. self.require(gdb_cmd[0])
  27. self.check_call(gdb_cmd)