constants.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: Apache-2.0
  3. import os
  4. import re
  5. # Control-key characters
  6. CTRL_A = '\x01'
  7. CTRL_B = '\x02'
  8. CTRL_C = '\x03'
  9. CTRL_F = '\x06'
  10. CTRL_H = '\x08'
  11. CTRL_I = '\x09'
  12. CTRL_R = '\x12'
  13. CTRL_T = '\x14'
  14. CTRL_Y = '\x19'
  15. CTRL_P = '\x10'
  16. CTRL_X = '\x18'
  17. CTRL_L = '\x0c'
  18. CTRL_RBRACKET = '\x1d' # Ctrl+]
  19. # Command parsed from console inputs
  20. CMD_STOP = 1
  21. CMD_RESET = 2
  22. CMD_MAKE = 3
  23. CMD_APP_FLASH = 4
  24. CMD_OUTPUT_TOGGLE = 5
  25. CMD_TOGGLE_LOGGING = 6
  26. CMD_ENTER_BOOT = 7
  27. CMD_TOGGLE_TIMESTAMPS = 8
  28. # Tags for tuples in queues
  29. TAG_KEY = 0
  30. TAG_SERIAL = 1
  31. TAG_SERIAL_FLUSH = 2
  32. TAG_CMD = 3
  33. __version__ = '1.1'
  34. # paths to scripts
  35. PANIC_OUTPUT_DECODE_SCRIPT = os.path.join(os.path.dirname(__file__), '..', 'gdb_panic_server.py')
  36. COREDUMP_SCRIPT = os.path.join(os.path.dirname(__file__), '..', '..', 'components', 'espcoredump', 'espcoredump.py')
  37. # regex matches an potential PC value (0x4xxxxxxx)
  38. MATCH_PCADDR = re.compile(r'0x4[0-9a-f]{7}', re.IGNORECASE)
  39. DEFAULT_TOOLCHAIN_PREFIX = 'xtensa-esp32-elf-'
  40. DEFAULT_PRINT_FILTER = ''
  41. # panic handler related messages
  42. PANIC_START = r'Core \s*\d+ register dump:'
  43. PANIC_END = b'ELF file SHA256:'
  44. PANIC_STACK_DUMP = b'Stack memory:'
  45. # panic handler decoding states
  46. PANIC_IDLE = 0
  47. PANIC_READING = 1
  48. # panic handler decoding options
  49. PANIC_DECODE_DISABLE = 'disable'
  50. PANIC_DECODE_BACKTRACE = 'backtrace'
  51. EVENT_QUEUE_TIMEOUT = 0.03 # timeout before raising queue.Empty exception in case of empty event queue
  52. ESPPORT_ENVIRON = str('ESPPORT')
  53. MAKEFLAGS_ENVIRON = 'MAKEFLAGS'
  54. GDB_UART_CONTINUE_COMMAND = '+$c#63'
  55. GDB_EXIT_TIMEOUT = 0.3 # time delay between exit and writing GDB_UART_CONTINUE_COMMAND
  56. # workaround for data sent without EOL
  57. # if no data received during the time, last line is considered finished
  58. LAST_LINE_THREAD_INTERVAL = 0.1
  59. MINIMAL_EN_LOW_DELAY = 0.005
  60. RECONNECT_DELAY = 0.5 # timeout between reconnect tries
  61. CHECK_ALIVE_FLAG_TIMEOUT = 0.25 # timeout for checking alive flags (currently used by serial reader)