constants.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Copyright 2015-2021 Espressif Systems (Shanghai) CO LTD
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import os
  15. import re
  16. # Control-key characters
  17. CTRL_A = '\x01'
  18. CTRL_B = '\x02'
  19. CTRL_F = '\x06'
  20. CTRL_H = '\x08'
  21. CTRL_I = '\x09'
  22. CTRL_R = '\x12'
  23. CTRL_T = '\x14'
  24. CTRL_Y = '\x19'
  25. CTRL_P = '\x10'
  26. CTRL_X = '\x18'
  27. CTRL_L = '\x0c'
  28. CTRL_RBRACKET = '\x1d' # Ctrl+]
  29. # Command parsed from console inputs
  30. CMD_STOP = 1
  31. CMD_RESET = 2
  32. CMD_MAKE = 3
  33. CMD_APP_FLASH = 4
  34. CMD_OUTPUT_TOGGLE = 5
  35. CMD_TOGGLE_LOGGING = 6
  36. CMD_ENTER_BOOT = 7
  37. CMD_TOGGLE_TIMESTAMPS = 8
  38. # Tags for tuples in queues
  39. TAG_KEY = 0
  40. TAG_SERIAL = 1
  41. TAG_SERIAL_FLUSH = 2
  42. TAG_CMD = 3
  43. __version__ = '1.1'
  44. # paths to scripts
  45. PANIC_OUTPUT_DECODE_SCRIPT = os.path.join(os.path.dirname(__file__), '..', 'gdb_panic_server.py')
  46. COREDUMP_SCRIPT = os.path.join(os.path.dirname(__file__), '..', '..', 'components', 'espcoredump', 'espcoredump.py')
  47. # regex matches an potential PC value (0x4xxxxxxx)
  48. MATCH_PCADDR = re.compile(r'0x4[0-9a-f]{7}', re.IGNORECASE)
  49. DEFAULT_TOOLCHAIN_PREFIX = 'xtensa-esp32-elf-'
  50. DEFAULT_PRINT_FILTER = ''
  51. # panic handler related messages
  52. PANIC_START = r'Core \s*\d+ register dump:'
  53. PANIC_END = b'ELF file SHA256:'
  54. PANIC_STACK_DUMP = b'Stack memory:'
  55. # panic handler decoding states
  56. PANIC_IDLE = 0
  57. PANIC_READING = 1
  58. # panic handler decoding options
  59. PANIC_DECODE_DISABLE = 'disable'
  60. PANIC_DECODE_BACKTRACE = 'backtrace'