* it allows inspecting the ESP32 state
*******************************************************************************/
-//ToDo: Clean up includes and sync to real rtos
#include "rom/ets_sys.h"
-
#include "soc/uart_reg.h"
#include "soc/io_mux_reg.h"
-
#include "esp_gdbstub.h"
+#include "driver/gpio.h"
//Length of buffer used to reserve GDB commands. Has to be at least able to fit the G command, which
//implies a minimum size of about 320 bytes.
#define ATTR_GDBFN
-static void ATTR_GDBFN keepWDTalive() {
- //ToDo for esp31/32
-}
-
-
//Receive a char from the uart. Uses polling and feeds the watchdog.
static int ATTR_GDBFN gdbRecvChar() {
int i;
- while (((READ_PERI_REG(UART_STATUS_REG(0))>>UART_RXFIFO_CNT_S)&UART_RXFIFO_CNT)==0) {
- keepWDTalive();
- }
+ while (((READ_PERI_REG(UART_STATUS_REG(0))>>UART_RXFIFO_CNT_S)&UART_RXFIFO_CNT)==0) ;
i=READ_PERI_REG(UART_FIFO_REG(0));
return i;
}
}
//Send a string as part of a packet
-static void ATTR_GDBFN gdbPacketStr(char *c) {
+static void ATTR_GDBFN gdbPacketStr(const char *c) {
while (*c!=0) {
gdbPacketChar(*c);
c++;
gdbPacketStart();
gdbPacketChar('T');
i=gdbRegFile.expstate&0x7f;
- if (i<sizeof(exceptionSignal)) return gdbPacketHex(exceptionSignal[i], 8); else gdbPacketHex(11, 8);
+ if (i<sizeof(exceptionSignal)) {
+ gdbPacketHex(exceptionSignal[i], 8);
+ } else {
+ gdbPacketHex(11, 8);
+ }
gdbPacketEnd();
}
sentchs[1]=gdbRecvChar();
ptr=&sentchs[0];
rchsum=gdbGetHexVal(&ptr, 8);
-// ets_printf("c %x r %x\n", chsum, rchsum);
if (rchsum!=chsum) {
gdbSendChar('-');
return ST_ERR;
-void gdbstubPanicHandler(XtExcFrame *frame) {
+void esp_gdbstub_panic_handler(XtExcFrame *frame) {
dumpHwToRegfile(frame);
//Make sure txd/rxd are enabled
- PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U);
+ gpio_pullup_dis(1);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_U0RXD);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_U0TXD);