mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Code cleanup. Bugfix after rebase with master. Formating.
This commit is contained in:
parent
f8197c2446
commit
00a7ecb5a3
@ -1,15 +1,20 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
|
||||
set(esp_gdbstub_srcs "src/gdbstub.c"
|
||||
"src/packet.c"
|
||||
"esp_common/gdbstub_common.c"
|
||||
"${target}/gdbstub_${target}.c"
|
||||
"xtensa/gdbstub-entry.S"
|
||||
"xtensa/gdbstub_xtensa.c")
|
||||
|
||||
idf_component_register(SRCS "${esp_gdbstub_srcs}"
|
||||
idf_component_register(SRCS "src/gdbstub.c" "src/packet.c"
|
||||
INCLUDE_DIRS "include"
|
||||
PRIV_INCLUDE_DIRS "private_include" "${target}" "xtensa"
|
||||
PRIV_INCLUDE_DIRS "private_include"
|
||||
LDFRAGMENTS "linker.lf"
|
||||
REQUIRES "freertos"
|
||||
PRIV_REQUIRES "soc" "xtensa" "esp_rom")
|
||||
PRIV_REQUIRES "soc" "esp_rom")
|
||||
|
||||
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||
target_include_directories(${COMPONENT_LIB} PUBLIC "xtensa" "${target}")
|
||||
target_sources(${COMPONENT_LIB} PRIVATE "xtensa/gdbstub_xtensa.c"
|
||||
"xtensa/gdbstub-entry.S"
|
||||
"esp_common/gdbstub_common.c")
|
||||
|
||||
elseif(CONFIG_IDF_TARGET_ARCH_RISCV)
|
||||
target_include_directories(${COMPONENT_LIB} PUBLIC "riscv" "${target}")
|
||||
target_sources(${COMPONENT_LIB} PRIVATE "riscv/gdbstub_riscv.c"
|
||||
"${target}/gdbstub_${target}.c")
|
||||
endif()
|
||||
|
@ -1,4 +1,4 @@
|
||||
COMPONENT_ADD_INCLUDEDIRS := include
|
||||
COMPONENT_PRIV_INCLUDEDIRS := private_include esp32 xtensa
|
||||
COMPONENT_SRCDIRS := src esp32 xtensa
|
||||
COMPONENT_SRCDIRS := src esp32 xtensa esp_common
|
||||
COMPONENT_ADD_LDFRAGMENTS += linker.lf
|
||||
|
@ -1,18 +0,0 @@
|
||||
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "soc/uart_periph.h"
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "esp_gdbstub_common.h"
|
||||
#include "sdkconfig.h"
|
@ -1,18 +0,0 @@
|
||||
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "soc/uart_periph.h"
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "esp_gdbstub_common.h"
|
||||
#include "sdkconfig.h"
|
@ -1,19 +0,0 @@
|
||||
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/uart_periph.h"
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "esp_gdbstub_common.h"
|
||||
|
@ -29,12 +29,16 @@ void esp_gdbstub_target_init(void)
|
||||
case 0:
|
||||
gdb_uart = &UART0;
|
||||
break;
|
||||
#if SOC_UART_NUM > 1
|
||||
case 1:
|
||||
gdb_uart = &UART1;
|
||||
break;
|
||||
#endif
|
||||
#if SOC_UART_NUM > 2
|
||||
case 2:
|
||||
gdb_uart = &UART2;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
gdb_uart = &UART0;
|
||||
break;
|
||||
@ -126,4 +130,4 @@ int esp_gdbstub_writemem(unsigned int addr, unsigned char data)
|
||||
asm volatile("ISYNC\nISYNC\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -58,3 +58,8 @@ int esp_gdbstub_get_signal(const esp_gdbstub_frame_t *frame)
|
||||
{
|
||||
return 5; // SIGTRAP, see IDF-2490
|
||||
}
|
||||
|
||||
void _xt_gdbstub_int(void * frame)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "hal/wdt_hal.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
//#include "esp_task_wdt.h"
|
||||
|
||||
|
||||
#ifdef CONFIG_ESP_GDBSTUB_SUPPORT_TASKS
|
||||
@ -43,11 +42,11 @@ static esp_gdbstub_scratch_t s_scratch;
|
||||
static esp_gdbstub_gdb_regfile_t *gdb_local_regfile = &s_scratch.regfile;
|
||||
|
||||
/**
|
||||
* @breef panic handler
|
||||
* @brief panic handler
|
||||
*/
|
||||
void esp_gdbstub_panic_handler(void *in_frame)
|
||||
{
|
||||
esp_gdbstub_frame_t* frame = (esp_gdbstub_frame_t*)in_frame;
|
||||
esp_gdbstub_frame_t *frame = (esp_gdbstub_frame_t *)in_frame;
|
||||
#ifndef CONFIG_ESP_GDBSTUB_SUPPORT_TASKS
|
||||
esp_gdbstub_frame_to_regfile(frame, &s_scratch.regfile);
|
||||
#else
|
||||
@ -186,7 +185,7 @@ static inline void enable_all_wdts(void)
|
||||
* @param curr_regs - actual registers frame
|
||||
*
|
||||
*/
|
||||
void gdbstub_handle_uart_int(XtExcFrame *regs_frame)
|
||||
void gdbstub_handle_uart_int(esp_gdbstub_frame_t *regs_frame)
|
||||
{
|
||||
// Disable all enabled WDT on enter
|
||||
disable_all_wdts();
|
||||
@ -234,7 +233,7 @@ intr_handle_t intr_handle_;
|
||||
extern void _xt_gdbstub_int(void * );
|
||||
|
||||
#ifdef CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
/** @breef Init gdbstub
|
||||
/** @brief Init gdbstub
|
||||
* Init uart interrupt for gdbstub
|
||||
* */
|
||||
void esp_gdbstub_init(void)
|
||||
@ -395,18 +394,6 @@ static bool get_task_handle(size_t index, TaskHandle_t *handle)
|
||||
return true;
|
||||
}
|
||||
|
||||
static eTaskState get_task_state(size_t index)
|
||||
{
|
||||
return eSuspended;
|
||||
// return s_scratch.tasks[index].eCurrentState;
|
||||
}
|
||||
|
||||
static int get_task_cpu_id(size_t index)
|
||||
{
|
||||
return 0;
|
||||
// return s_scratch.tasks[index].xCoreID;
|
||||
}
|
||||
|
||||
/** Get the index of the task running on the current CPU, and save the result */
|
||||
static void find_paniced_task_index(void)
|
||||
{
|
||||
@ -531,29 +518,8 @@ static void handle_qThreadExtraInfo_command(const unsigned char *cmd, int len)
|
||||
esp_gdbstub_send_str_as_hex((const char *)pcTaskGetTaskName(handle));
|
||||
esp_gdbstub_send_hex(' ', 8);
|
||||
|
||||
eTaskState state = get_task_state(task_index);
|
||||
switch (state) {
|
||||
case eRunning:
|
||||
esp_gdbstub_send_str_as_hex("State: Running ");
|
||||
esp_gdbstub_send_str_as_hex("@CPU");
|
||||
esp_gdbstub_send_hex(get_task_cpu_id(task_index) + '0', 8);
|
||||
break;
|
||||
case eReady:
|
||||
esp_gdbstub_send_str_as_hex("State: Ready");
|
||||
break;
|
||||
case eBlocked:
|
||||
esp_gdbstub_send_str_as_hex("State: Blocked");
|
||||
break;
|
||||
case eSuspended:
|
||||
esp_gdbstub_send_str_as_hex("State: Suspended");
|
||||
break;
|
||||
case eDeleted:
|
||||
esp_gdbstub_send_str_as_hex("State: Deleted");
|
||||
break;
|
||||
default:
|
||||
esp_gdbstub_send_str_as_hex("State: Invalid");
|
||||
break;
|
||||
}
|
||||
// Current version report only Suspended state
|
||||
esp_gdbstub_send_str_as_hex("State: Suspended");
|
||||
|
||||
esp_gdbstub_send_end();
|
||||
}
|
||||
@ -605,4 +571,3 @@ static int handle_task_commands(unsigned char *cmd, int len)
|
||||
}
|
||||
|
||||
#endif // CONFIG_ESP_GDBSTUB_SUPPORT_TASKS
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include "freertos/xtensa_context.h"
|
||||
#include "gdbstub_target_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -41,4 +41,3 @@ _xt_gdbstub_int:
|
||||
mov a6,sp
|
||||
call0 gdbstub_handle_uart_int
|
||||
ret
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "esp_private/panic_internal.h"
|
||||
#include "port/panic_funcs.h"
|
||||
#include "esp_rom_sys.h"
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
@ -58,6 +59,10 @@
|
||||
#include "esp_gdbstub.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||
#include "hal/usb_serial_jtag_ll.h"
|
||||
#endif
|
||||
|
||||
bool g_panic_abort = false;
|
||||
static char *s_panic_abort_details = NULL;
|
||||
|
||||
@ -68,13 +73,13 @@ static wdt_hal_context_t wdt1_context = {.inst = WDT_MWDT1, .mwdt_dev = &TIMERG1
|
||||
#if !CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT
|
||||
|
||||
#if CONFIG_ESP_CONSOLE_UART
|
||||
static uart_hal_context_t s_panic_uart = { .dev = CONFIG_ESP_CONSOLE_UART_NUM == 0 ? &UART0 : &UART1 };
|
||||
static uart_hal_context_t s_panic_uart = { .dev = CONFIG_ESP_CONSOLE_UART_NUM == 0 ? &UART0 :&UART1 };
|
||||
|
||||
void panic_print_char(const char c)
|
||||
{
|
||||
uint32_t sz = 0;
|
||||
while(!uart_hal_get_txfifo_len(&s_panic_uart));
|
||||
uart_hal_write_txfifo(&s_panic_uart, (uint8_t*) &c, 1, &sz);
|
||||
while (!uart_hal_get_txfifo_len(&s_panic_uart));
|
||||
uart_hal_write_txfifo(&s_panic_uart, (uint8_t *) &c, 1, &sz);
|
||||
}
|
||||
#endif // CONFIG_ESP_CONSOLE_UART
|
||||
|
||||
@ -87,6 +92,27 @@ void panic_print_char(const char c)
|
||||
}
|
||||
#endif // CONFIG_ESP_CONSOLE_USB_CDC
|
||||
|
||||
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||
//Timeout; if there's no host listening, the txfifo won't ever
|
||||
//be writable after the first packet.
|
||||
|
||||
#define USBSERIAL_TIMEOUT_MAX_US 50000
|
||||
static int s_usbserial_timeout = 0;
|
||||
|
||||
void panic_print_char(const char c)
|
||||
{
|
||||
while (!usb_serial_jtag_ll_txfifo_writable() && s_usbserial_timeout < (USBSERIAL_TIMEOUT_MAX_US / 100)) {
|
||||
esp_rom_delay_us(100);
|
||||
s_usbserial_timeout++;
|
||||
}
|
||||
if (usb_serial_jtag_ll_txfifo_writable()) {
|
||||
usb_serial_jtag_ll_write_txfifo((const uint8_t *)&c, 1);
|
||||
s_usbserial_timeout = 0;
|
||||
}
|
||||
}
|
||||
#endif //CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||
|
||||
|
||||
#if CONFIG_ESP_CONSOLE_NONE
|
||||
void panic_print_char(const char c)
|
||||
{
|
||||
@ -96,7 +122,7 @@ void panic_print_char(const char c)
|
||||
|
||||
void panic_print_str(const char *str)
|
||||
{
|
||||
for(int i = 0; str[i] != 0; i++) {
|
||||
for (int i = 0; str[i] != 0; i++) {
|
||||
panic_print_char(str[i]);
|
||||
}
|
||||
}
|
||||
@ -145,7 +171,7 @@ static void reconfigure_all_wdts(void)
|
||||
//Reconfigure TWDT (Timer Group 0)
|
||||
wdt_hal_init(&wdt0_context, WDT_MWDT0, MWDT0_TICK_PRESCALER, false); //Prescaler: wdt counts in ticks of TG0_WDT_TICK_US
|
||||
wdt_hal_write_protect_disable(&wdt0_context);
|
||||
wdt_hal_config_stage(&wdt0_context, 0, 1000*1000/MWDT0_TICKS_PER_US, WDT_STAGE_ACTION_RESET_SYSTEM); //1 second before reset
|
||||
wdt_hal_config_stage(&wdt0_context, 0, 1000 * 1000 / MWDT0_TICKS_PER_US, WDT_STAGE_ACTION_RESET_SYSTEM); //1 second before reset
|
||||
wdt_hal_enable(&wdt0_context);
|
||||
wdt_hal_write_protect_enable(&wdt0_context);
|
||||
|
||||
@ -190,29 +216,29 @@ void esp_panic_handler(panic_info_t *info)
|
||||
info->exception = PANIC_EXCEPTION_ABORT;
|
||||
}
|
||||
|
||||
/*
|
||||
* For any supported chip, the panic handler prints the contents of panic_info_t in the following format:
|
||||
*
|
||||
*
|
||||
* Guru Meditation Error: Core <core> (<exception>). <description>
|
||||
* <details>
|
||||
*
|
||||
* <state>
|
||||
*
|
||||
* <elf_info>
|
||||
*
|
||||
*
|
||||
* ----------------------------------------------------------------------------------------
|
||||
* core - core where exception was triggered
|
||||
* exception - what kind of exception occured
|
||||
* description - a short description regarding the exception that occured
|
||||
* details - more details about the exception
|
||||
* state - processor state like register contents, and backtrace
|
||||
* elf_info - details about the image currently running
|
||||
*
|
||||
* NULL fields in panic_info_t are not printed.
|
||||
*
|
||||
* */
|
||||
/*
|
||||
* For any supported chip, the panic handler prints the contents of panic_info_t in the following format:
|
||||
*
|
||||
*
|
||||
* Guru Meditation Error: Core <core> (<exception>). <description>
|
||||
* <details>
|
||||
*
|
||||
* <state>
|
||||
*
|
||||
* <elf_info>
|
||||
*
|
||||
*
|
||||
* ----------------------------------------------------------------------------------------
|
||||
* core - core where exception was triggered
|
||||
* exception - what kind of exception occured
|
||||
* description - a short description regarding the exception that occured
|
||||
* details - more details about the exception
|
||||
* state - processor state like register contents, and backtrace
|
||||
* elf_info - details about the image currently running
|
||||
*
|
||||
* NULL fields in panic_info_t are not printed.
|
||||
*
|
||||
* */
|
||||
if (info->reason) {
|
||||
panic_print_str("Guru Meditation Error: Core ");
|
||||
panic_print_dec(info->core);
|
||||
@ -296,7 +322,7 @@ void esp_panic_handler(panic_info_t *info)
|
||||
wdt_hal_disable(&rtc_wdt_ctx);
|
||||
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
|
||||
panic_print_str("Entering gdb stub now.\r\n");
|
||||
esp_gdbstub_panic_handler(info->frame);
|
||||
esp_gdbstub_panic_handler((void *)info->frame);
|
||||
#else
|
||||
#if CONFIG_ESP_COREDUMP_ENABLE
|
||||
static bool s_dumping_core;
|
||||
@ -321,8 +347,7 @@ void esp_panic_handler(panic_info_t *info)
|
||||
#if CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT || CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT
|
||||
|
||||
if (esp_reset_reason_get_hint() == ESP_RST_UNKNOWN) {
|
||||
switch (info->exception)
|
||||
{
|
||||
switch (info->exception) {
|
||||
case PANIC_EXCEPTION_IWDT:
|
||||
esp_reset_reason_set_hint(ESP_RST_INT_WDT);
|
||||
break;
|
||||
@ -348,10 +373,10 @@ void esp_panic_handler(panic_info_t *info)
|
||||
}
|
||||
|
||||
|
||||
void __attribute__((noreturn)) panic_abort(const char *details)
|
||||
void __attribute__((noreturn, no_sanitize_undefined)) panic_abort(const char *details)
|
||||
{
|
||||
g_panic_abort = true;
|
||||
s_panic_abort_details = (char*) details;
|
||||
s_panic_abort_details = (char *) details;
|
||||
|
||||
#if CONFIG_APPTRACE_ENABLE
|
||||
#if CONFIG_SYSVIEW_ENABLE
|
||||
@ -363,7 +388,7 @@ void __attribute__((noreturn)) panic_abort(const char *details)
|
||||
#endif
|
||||
|
||||
*((int *) 0) = 0; // NOLINT(clang-analyzer-core.NullDereference) should be an invalid operation on targets
|
||||
while(1);
|
||||
while (1);
|
||||
}
|
||||
|
||||
/* Weak versions of reset reason hint functions.
|
||||
|
@ -61,6 +61,10 @@ volatile unsigned port_xSchedulerRunning[portNUM_PROCESSORS] = {0};
|
||||
|
||||
static void main_task(void* args);
|
||||
|
||||
#ifdef CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
void esp_gdbstub_init(void);
|
||||
#endif // CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
|
||||
extern void app_main(void);
|
||||
|
||||
void esp_startup_start_app_common(void)
|
||||
@ -79,6 +83,10 @@ void esp_startup_start_app_common(void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
esp_gdbstub_init();
|
||||
#endif // CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
|
||||
portBASE_TYPE res = xTaskCreatePinnedToCore(&main_task, "main",
|
||||
ESP_TASK_MAIN_STACK, NULL,
|
||||
ESP_TASK_MAIN_PRIO, NULL, ESP_TASK_MAIN_CORE);
|
||||
|
@ -10,7 +10,6 @@ This tool can be launched from an IDF project by running ``idf.py monitor``.
|
||||
|
||||
For the legacy GNU Make system, run ``make monitor``.
|
||||
|
||||
|
||||
Keyboard Shortcuts
|
||||
==================
|
||||
|
||||
@ -59,9 +58,9 @@ For easy interaction with IDF Monitor, use the keyboard shortcuts given in the t
|
||||
* - * Ctrl+X (or X)
|
||||
- Exit the program
|
||||
-
|
||||
* - Ctrl+]
|
||||
* - Ctrl+C
|
||||
- Interrupt running application
|
||||
- Pauses IDF monitor and run GDB_ project debugger to debug the application at runtime.
|
||||
- Pauses IDF monitor and run GDB_ project debugger to debug the application at runtime. This requires :ref:CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME option to be enabled.
|
||||
|
||||
Any keys pressed, other than ``Ctrl-]`` and ``Ctrl-T``, will be sent through the serial port.
|
||||
|
||||
@ -187,6 +186,7 @@ To decode each address, IDF Monitor runs the following command in the background
|
||||
Launching GDB with GDBStub
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
By default, if esp-idf crashes, the panic handler prints relevant registers and the stack dump (similar to the ones above) over the serial port. Then it resets the board.
|
||||
|
||||
Furthermore, the application can be configured to run GDBStub in the background and handle the Ctrl+C event from the monitor.
|
||||
|
@ -1,2 +1,2 @@
|
||||
idf_component_register(SRCS "hello_world_main.c"
|
||||
INCLUDE_DIRS "")
|
||||
INCLUDE_DIRS "")
|
||||
|
@ -3,4 +3,4 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(gdbstub)
|
||||
project(gdbstub)
|
||||
|
@ -6,4 +6,3 @@
|
||||
PROJECT_NAME := gdbstub
|
||||
|
||||
include $(IDF_PATH)/make/project.mk
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
idf_component_register(SRCS "gdbstub_main.c"
|
||||
INCLUDE_DIRS "")
|
||||
INCLUDE_DIRS "")
|
||||
|
@ -2,4 +2,3 @@
|
||||
# "main" pseudo-component makefile.
|
||||
#
|
||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||
|
||||
|
@ -19,4 +19,4 @@ CONFIG_FREERTOS_UNICORE=y
|
||||
# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set
|
||||
CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME=y
|
||||
CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y
|
||||
# end of ESP System Settings
|
||||
# end of ESP System Settings
|
||||
|
@ -33,15 +33,13 @@ import json
|
||||
import locale
|
||||
import os
|
||||
import os.path
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
from collections import Counter, OrderedDict
|
||||
from importlib import import_module
|
||||
from pkgutil import iter_modules
|
||||
|
||||
import signal
|
||||
|
||||
|
||||
# pyc files remain in the filesystem when switching between branches which might raise errors for incompatible
|
||||
# idf.py extensions. Therefore, pyc file generation is turned off:
|
||||
sys.dont_write_bytecode = True
|
||||
@ -726,7 +724,7 @@ def init_cli(verbose_output=None):
|
||||
return CLI(help=cli_help, verbose_output=verbose_output, all_actions=all_actions)
|
||||
|
||||
|
||||
def signal_handler(signal, frame):
|
||||
def signal_handler(_signal, _frame):
|
||||
# The Ctrl+C processed by other threads inside
|
||||
pass
|
||||
|
||||
|
@ -202,10 +202,10 @@ class Monitor(object):
|
||||
elif event_tag == TAG_SERIAL_FLUSH:
|
||||
self.handle_serial_input(data, finalize_line=True)
|
||||
else:
|
||||
raise RuntimeError("Bad event data %r" % ((event_tag,data),))
|
||||
raise RuntimeError('Bad event data %r' % ((event_tag,data),))
|
||||
except KeyboardInterrupt:
|
||||
try:
|
||||
yellow_print("To exit from IDF monitor please use \"Ctrl+]\"")
|
||||
yellow_print('To exit from IDF monitor please use \"Ctrl+]\"')
|
||||
self.serial.write(codecs.encode('\x03'))
|
||||
except serial.SerialException:
|
||||
pass # this shouldn't happen, but sometimes port has closed in serial thread
|
||||
@ -232,9 +232,9 @@ class Monitor(object):
|
||||
# Remove "+" after Continue command
|
||||
if self.start_cmd_sent is True:
|
||||
self.start_cmd_sent = False
|
||||
pos = data.find(b"+")
|
||||
pos = data.find(b'+')
|
||||
if pos != -1:
|
||||
data = data[1:]
|
||||
data = data[(pos + 1):]
|
||||
|
||||
sp = data.split(b'\n')
|
||||
if self._last_line_part != b'':
|
||||
@ -520,21 +520,20 @@ class Monitor(object):
|
||||
self.elf_file]
|
||||
|
||||
# Here we handling GDB as a process
|
||||
if True:
|
||||
# Open GDB process
|
||||
try:
|
||||
process = subprocess.Popen(cmd, cwd=".")
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
# Open GDB process
|
||||
try:
|
||||
process = subprocess.Popen(cmd, cwd='.')
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
# We ignore Ctrl+C interrupt form external process abd wait responce util GDB will be finished.
|
||||
while True:
|
||||
try:
|
||||
process.wait()
|
||||
break
|
||||
except KeyboardInterrupt:
|
||||
pass # We ignore the Ctrl+C
|
||||
self.gdb_exit = True
|
||||
# We ignore Ctrl+C interrupt form external process abd wait responce util GDB will be finished.
|
||||
while True:
|
||||
try:
|
||||
process.wait()
|
||||
break
|
||||
except KeyboardInterrupt:
|
||||
pass # We ignore the Ctrl+C
|
||||
self.gdb_exit = True
|
||||
|
||||
except OSError as e:
|
||||
red_print('%s: %s' % (' '.join(cmd), e))
|
||||
|
@ -50,18 +50,16 @@ class SerialReader(StoppableThread):
|
||||
self.serial.baudrate = self.baud
|
||||
# We can come to this thread at startup or from external application line GDB.
|
||||
# If we come from GDB we would like to continue to run without reset.
|
||||
if self.gdb_exit is False:
|
||||
if self.gdb_exit:
|
||||
self.serial.rts = False
|
||||
self.serial.dtr = True
|
||||
else: # if we exit from GDB, we don't need to reset the target
|
||||
# This sequence of DTR/RTS and open/close set the serial port to
|
||||
# condition when GDB not make reset of the target by switching DTR/RTS.
|
||||
self.serial.rts = True # IO0=LOW
|
||||
self.serial.dtr = self.serial.dtr # usbser.sys workaround
|
||||
self.serial.open()
|
||||
self.serial.close()
|
||||
self.serial.rts = False # IO0=HIGH
|
||||
self.serial.dtr = False
|
||||
else: # if we exit from GDB, we don't need to reset the target
|
||||
self.serial.rts = False
|
||||
self.serial.dtr = True
|
||||
|
||||
# Current state not reset the target!
|
||||
self.gdb_exit = False
|
||||
|
@ -16,9 +16,6 @@
|
||||
#include <shlwapi.h>
|
||||
#include <strsafe.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define LINESIZE 1024
|
||||
|
||||
@ -46,17 +43,6 @@ BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
|
||||
{
|
||||
switch (fdwCtrlType) {
|
||||
// Handle the CTRL-C signal.
|
||||
case CTRL_C_EVENT:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, LPTSTR argv[])
|
||||
{
|
||||
/* Print the version of this wrapper tool, but only if invoked as "idf.exe".
|
||||
|
Loading…
Reference in New Issue
Block a user