Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GDB and exception handling improvements (#1655)
Makefile changes: * Remove esp-gdbstub as third-party module * Remove all GDB stuff from `Makefile` - gdbstub is compiled into application, not framework * gdbstub can be used with release or debug builds. * Add support in all makefiles for assembly code (both .s and .S files) * Remove all COM port settings from `Makefile` - application code does all this now * Bring `Makefile-project.mk`inline with `Makefile-rboot.mk` (compiler warnings, etc.) * Add new 'gdb' phony target to make it easier to start debugger with correct port, baud rate and other settings HardwareSerial * Fix so that end() and systemDebugOutput() don't screw up initialisation of other serial port(s) * Put callback handling code into static methods - saves IRAM and simplifies code * Revise interrupt callback to prevent task queue flooding, e.g. on receive overflow * Add `getStatus()` method to report serial errors HardwareTimer * Make HardwareTimer mode selectable (maskable or NMI) user_main.cpp * Don't change serial port baud rates - do that in gdb_init() instead which is compiled into application system/crash_handler.c * Remove stack dumping code and all serial port access - moved into gdb_hooks.cpp * Include text for exception code in report system/SerialBuffer.h * Move non-trivial code into .cpp module * Add `getReadData()` and `skipRead()` methods for efficient block reading esp_systemapi.h * Remove uart prototypes - driver must be used instead * Ensure wdt functions are available uart.h, uart.cpp * Add UART2 and provide generic notification callback handling * Add UART_OPT_CALLBACK_RAW option * Save some IRAM by moving uart_get_uart, uart_set_callback, uart_peek_last_char, uart_rx_available and moving uart_detach into flash * Use inline functions in preference to macros * Default debug port should be undefined, not UART0 * Use bit manipulation macros to simplify/clarify code * Disable interrupts in `uart_tx_free()` and `uart_rx_available()` to ensure result is accurate * Fix incorrect RX FIFO size reading, causes problems in FIFO overflow situation * Add `uart_get_status()` to support reporting of errors and Rx BREAK condition * Add mode parameter to uart_flush() so tx/rx can be flushed independently, e.g. if a receive overrun occurs. * Add `uart_set_break()` function gdbstub, exception handling and stack dumping * appspecific/gdb/ code is always compiled into application, contains system exception handler and stack dumper * gdb/ code is only compiled when ENABLE_GDB=1 * gdbstub revised for readability and checking * uart handling code in separate module (gdbuart.cpp) * Add build option to support both patched and unpatched GDB versions * Extend GDBSTUB_CTRLC_BREAK to prevent accidental breaking * Add gdb_enable() function * Include options for stack dumping, with defaults to provide consistent behaviour (i.e. OFF in release builds, ON in debug builds) * Add debugging code to stub which can be optionally enabled to see realtime behaviour * Implement register read/write (p & P) and binary write (X) commands * Provide API for GDB system functions LiveDebug sample * Revise to highlight possible debugging issues with hardware timer, and illustrate other timer types which are 'debug safe' * Add serial read callback to demonstrate UART2 function * Implement simple interactive debug console using GDB syscall support * Add error checking/reporting to serial receive callback Basic_Serial sample * Add error checking/reporting to serial receive callback
- Loading branch information