constants.py 2.5 KB

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