From 979b7faeeea8fbb1b94f71acc96cc68279592418 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Thu, 30 May 2024 23:44:04 +0800 Subject: [PATCH] subsys/debug: relocate gdbstub stuff into its folder Move the gdbstub files into the gdbstub folder, and relocated its Kconfig as well. Signed-off-by: Yong Cong Sin --- subsys/debug/CMakeLists.txt | 9 +--- subsys/debug/Kconfig | 44 +------------------ subsys/debug/gdbstub/CMakeLists.txt | 11 +++++ subsys/debug/gdbstub/Kconfig | 45 ++++++++++++++++++++ subsys/debug/{ => gdbstub}/gdbstub.c | 0 subsys/debug/{ => gdbstub}/gdbstub_backend.h | 0 6 files changed, 59 insertions(+), 50 deletions(-) create mode 100644 subsys/debug/gdbstub/CMakeLists.txt create mode 100644 subsys/debug/gdbstub/Kconfig rename subsys/debug/{ => gdbstub}/gdbstub.c (100%) rename subsys/debug/{ => gdbstub}/gdbstub_backend.h (100%) diff --git a/subsys/debug/CMakeLists.txt b/subsys/debug/CMakeLists.txt index 200e3bcb3866267..2e855563b0d9104 100644 --- a/subsys/debug/CMakeLists.txt +++ b/subsys/debug/CMakeLists.txt @@ -20,14 +20,9 @@ add_subdirectory_ifdef( coredump ) -zephyr_sources_ifdef( +add_subdirectory_ifdef( CONFIG_GDBSTUB - gdbstub.c - ) - -zephyr_sources_ifdef( - CONFIG_GDBSTUB_SERIAL_BACKEND - gdbstub/gdbstub_backend_serial.c + gdbstub ) zephyr_sources_ifdef( diff --git a/subsys/debug/Kconfig b/subsys/debug/Kconfig index cd9303262eb99dd..e7948c59deecca1 100644 --- a/subsys/debug/Kconfig +++ b/subsys/debug/Kconfig @@ -420,51 +420,9 @@ config DEBUG_THREAD_INFO for debugger RTOS plugins to determine the state of running threads. rsource "coredump/Kconfig" +rsource "gdbstub/Kconfig" endmenu -config GDBSTUB - bool "GDB remote serial protocol support [EXPERIMENTAL]" - depends on ARCH_HAS_GDBSTUB - select UART_USE_RUNTIME_CONFIGURE - select EXPERIMENTAL - help - This option enable support the target using GDB, or any other - application that supports GDB protocol. - -if GDBSTUB - -choice - prompt "GDB backend" - -config GDBSTUB_SERIAL_BACKEND - bool "Use serial backend" - depends on SERIAL - help - Use serial as backend for GDB - -config GDBSTUB_CUSTOM_BACKEND - bool "Use a custom backend" - help - Use a custom backend for GDB - -endchoice - -config GDBSTUB_BUF_SZ - int "GDB backend send/receive buffer size (in bytes)" - default 256 - help - This specifies the size (in bytes) of the send/receive buffer - for GDB backend. This needs to be big enough to hold one - full GDB packet at a time. - -config GDBSTUB_TRACE - bool "GDB backend extra logging" - help - Enable extra debug logging for the GDB backend, including - breakpoint interrupts and remote commands it receives. - -endif - config SEGGER_DEBUGMON bool "Use Segger's J-Link debug monitor implementation" depends on CORTEX_M_DEBUG_MONITOR_HOOK diff --git a/subsys/debug/gdbstub/CMakeLists.txt b/subsys/debug/gdbstub/CMakeLists.txt new file mode 100644 index 000000000000000..b15f306f2bb4c56 --- /dev/null +++ b/subsys/debug/gdbstub/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2020 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources( + gdbstub.c + ) + +zephyr_sources_ifdef( + CONFIG_GDBSTUB_SERIAL_BACKEND + gdbstub/gdbstub_backend_serial.c + ) diff --git a/subsys/debug/gdbstub/Kconfig b/subsys/debug/gdbstub/Kconfig new file mode 100644 index 000000000000000..358643a589b8e9a --- /dev/null +++ b/subsys/debug/gdbstub/Kconfig @@ -0,0 +1,45 @@ +# Copyright (c) 2020 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +menuconfig GDBSTUB + bool "GDB remote serial protocol support [EXPERIMENTAL]" + depends on ARCH_HAS_GDBSTUB + select UART_USE_RUNTIME_CONFIGURE + select EXPERIMENTAL + help + This option enable support the target using GDB, or any other + application that supports GDB protocol. + +if GDBSTUB + +choice + prompt "GDB backend" + +config GDBSTUB_SERIAL_BACKEND + bool "Use serial backend" + depends on SERIAL + help + Use serial as backend for GDB + +config GDBSTUB_CUSTOM_BACKEND + bool "Use a custom backend" + help + Use a custom backend for GDB + +endchoice + +config GDBSTUB_BUF_SZ + int "GDB backend send/receive buffer size (in bytes)" + default 256 + help + This specifies the size (in bytes) of the send/receive buffer + for GDB backend. This needs to be big enough to hold one + full GDB packet at a time. + +config GDBSTUB_TRACE + bool "GDB backend extra logging" + help + Enable extra debug logging for the GDB backend, including + breakpoint interrupts and remote commands it receives. + +endif # GDBSTUB diff --git a/subsys/debug/gdbstub.c b/subsys/debug/gdbstub/gdbstub.c similarity index 100% rename from subsys/debug/gdbstub.c rename to subsys/debug/gdbstub/gdbstub.c diff --git a/subsys/debug/gdbstub_backend.h b/subsys/debug/gdbstub/gdbstub_backend.h similarity index 100% rename from subsys/debug/gdbstub_backend.h rename to subsys/debug/gdbstub/gdbstub_backend.h