constants.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. # regex matches an potential PC value (0x4xxxxxxx)
  37. MATCH_PCADDR = re.compile(r'0x4[0-9a-f]{7}', re.IGNORECASE)
  38. DEFAULT_TOOLCHAIN_PREFIX = 'xtensa-esp32-elf-'
  39. DEFAULT_PRINT_FILTER = ''
  40. # panic handler related messages
  41. PANIC_START = r'Core \s*\d+ register dump:'
  42. PANIC_END = b'ELF file SHA256:'
  43. PANIC_STACK_DUMP = b'Stack memory:'
  44. # panic handler decoding states
  45. PANIC_IDLE = 0
  46. PANIC_READING = 1
  47. # panic handler decoding options
  48. PANIC_DECODE_DISABLE = 'disable'
  49. PANIC_DECODE_BACKTRACE = 'backtrace'
  50. EVENT_QUEUE_TIMEOUT = 0.03 # timeout before raising queue.Empty exception in case of empty event queue
  51. ESPPORT_ENVIRON = str('ESPPORT')
  52. MAKEFLAGS_ENVIRON = 'MAKEFLAGS'
  53. GDB_UART_CONTINUE_COMMAND = '+$c#63'
  54. GDB_EXIT_TIMEOUT = 0.3 # time delay between exit and writing GDB_UART_CONTINUE_COMMAND
  55. # workaround for data sent without EOL
  56. # if no data received during the time, last line is considered finished
  57. LAST_LINE_THREAD_INTERVAL = 0.1
  58. MINIMAL_EN_LOW_DELAY = 0.005
  59. RECONNECT_DELAY = 0.5 # timeout between reconnect tries
  60. CHECK_ALIVE_FLAG_TIMEOUT = 0.25 # timeout for checking alive flags (currently used by serial reader)