debug: gdbstub: Move to DTS for uart device
Move from using Kconfig GDBSTUB_SERIAL_BACKEND_NAME to a devicetree
chosen property ("zephyr,gdbstub-uart"). This is similar to a number
of other functions like "zephyr,shell-uart" or "zephyr,bt-uart".
Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
This commit is contained in:
parent
6812441099
commit
e172b1dbda
7 changed files with 21 additions and 15 deletions
2
doc/build/dts/api/api.rst
vendored
2
doc/build/dts/api/api.rst
vendored
|
|
@ -410,6 +410,8 @@ device.
|
|||
* - zephyr,flash-controller
|
||||
- The node corresponding to the flash controller device for
|
||||
the ``zephyr,flash`` node
|
||||
* - zephyr,gdbstub-uart
|
||||
- Sets UART device used by the :ref:`gdbstub` subsystem
|
||||
* - zephyr,ipc
|
||||
- Used by the OpenAMP subsystem to specify the inter-process communication
|
||||
(IPC) device
|
||||
|
|
|
|||
|
|
@ -48,10 +48,9 @@ the :kconfig:option:`CONFIG_GDBSTUB_SERIAL_BACKEND` option.
|
|||
|
||||
Since serial backend utilizes UART devices to send and receive GDB commands,
|
||||
|
||||
* If there are spare UART devices on the board, set
|
||||
:kconfig:option:`CONFIG_GDBSTUB_SERIAL_BACKEND_NAME` to the spare UART device
|
||||
so that :c:func:`printk` and log messages are not being printed to
|
||||
the same UART device used for GDB.
|
||||
* If there are spare UART devices on the board, set ``zephyr,gdbstub-uart``
|
||||
property of the chosen node to the spare UART device so that :c:func:`printk`
|
||||
and log messages are not being printed to the same UART device used for GDB.
|
||||
|
||||
* For boards with only one UART device, :c:func:`printk` and logging
|
||||
must be disabled if they are also using the same UART device for output.
|
||||
|
|
|
|||
7
samples/subsys/debug/gdbstub/boards/qemu_x86.overlay
Normal file
7
samples/subsys/debug/gdbstub/boards/qemu_x86.overlay
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,gdbstub-uart = &uart1;
|
||||
};
|
||||
};
|
||||
7
samples/subsys/debug/gdbstub/boards/qemu_x86_64.overlay
Normal file
7
samples/subsys/debug/gdbstub/boards/qemu_x86_64.overlay
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,gdbstub-uart = &uart1;
|
||||
};
|
||||
};
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
CONFIG_GDBSTUB=y
|
||||
CONFIG_GDBSTUB_SERIAL_BACKEND_NAME="UART_1"
|
||||
CONFIG_NO_OPTIMIZATIONS=y
|
||||
CONFIG_USERSPACE=y
|
||||
CONFIG_KOBJECT_TEXT_AREA=4096
|
||||
|
|
|
|||
|
|
@ -369,13 +369,6 @@ config GDBSTUB_SERIAL_BACKEND
|
|||
|
||||
endchoice
|
||||
|
||||
config GDBSTUB_SERIAL_BACKEND_NAME
|
||||
string "Serial Name"
|
||||
depends on GDBSTUB_SERIAL_BACKEND
|
||||
default "UART_0"
|
||||
help
|
||||
Use serial as backend for GDB
|
||||
|
||||
config GDBSTUB_BUF_SZ
|
||||
int "GDB backend send/receive buffer size (in bytes)"
|
||||
default 256
|
||||
|
|
|
|||
|
|
@ -22,10 +22,9 @@ int z_gdb_backend_init(void)
|
|||
};
|
||||
|
||||
if (uart_dev == NULL) {
|
||||
uart_dev = device_get_binding(
|
||||
CONFIG_GDBSTUB_SERIAL_BACKEND_NAME);
|
||||
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_gdbstub_uart));
|
||||
|
||||
__ASSERT(uart_dev != NULL, "Could not get uart device");
|
||||
__ASSERT(device_is_ready(uart_dev), "uart device is not ready");
|
||||
|
||||
ret = uart_configure(uart_dev, &uart_cfg);
|
||||
__ASSERT(ret == 0, "Could not configure uart device");
|
||||
|
|
|
|||
Loading…
Reference in a new issue