Skip to content

Commit

Permalink
Fix 'corrupt stack?' warning in GDB backtrace (#1665)
Browse files Browse the repository at this point in the history
* Fix 'corrupt stack?' warning in GDB backtrace

One cause is missing symbols, so tell GDB about ESP8266 ROM symbols defined in `bootrom.elf` file.

See https://github.com/jcmvbkbc/esp-elf-rom for how the `bootrom.elf` file was created.
  • Loading branch information
mikee47 authored and slaff committed Apr 12, 2019
1 parent fee27ee commit af98dcd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sming/Makefile-rboot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ RBOOT_E2_SECTS ?= .text .data .rodata
RBOOT_E2_USER_ARGS ?= -quiet -bin -boot2
# GDB path
GDB ?= $(ESP_HOME)/xtensa-lx106-elf/bin/xtensa-lx106-elf-gdb
# File containing boot ROM debug symbols for GDB
BOOTROM_ELF := bootrom.elf

## COM port parameters
# Default COM port speed (generic)
Expand Down Expand Up @@ -540,7 +542,11 @@ endef

.PHONY: all checkdirs spiff_update spiff_clean clean kill_term terminal gdb

all: $(USER_LIBDIR)/lib$(LIBSMING).a checkdirs $(LIBMAIN_DST) $(RBOOT_BIN) $(RBOOT_ROM_0) $(RBOOT_ROM_1) $(SPIFF_BIN_OUT) $(FW_FILE_1) $(FW_FILE_2)
all: $(USER_LIBDIR)/lib$(LIBSMING).a checkdirs $(LIBMAIN_DST) $(RBOOT_BIN) $(RBOOT_ROM_0) $(RBOOT_ROM_1) $(SPIFF_BIN_OUT) $(FW_FILE_1) $(FW_FILE_2) $(BUILD_BASE)/$(BOOTROM_ELF)

# File contains boot rom symbols required by GDB, put it somewhere easy to find
$(BUILD_BASE)/$(BOOTROM_ELF):
cp $(SMING_HOME)/gdb/$(BOOTROM_ELF) $(BUILD_BASE)

$(RBOOT_BIN):
$(MAKE) -C $(THIRD_PARTY_DIR)/rboot RBOOT_GPIO_ENABLED=$(RBOOT_GPIO_ENABLED) RBOOT_SILENT=$(RBOOT_SILENT)
Expand Down
Binary file added Sming/gdb/bootrom.elf
Binary file not shown.
4 changes: 4 additions & 0 deletions Sming/gdb/gdbcmds
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ mem 0x60000000 0x60001fff rw
# The target object file so GDB knows where to get symbol information
file out/build/app_0.out

# GDB needs to know about ROM functions in order to create a full stack trace
# See https://github.com/jcmvbkbc/esp-elf-rom
add-symbol-file out/build/bootrom.elf 0x40000000 -readnow

# Change the following to your serial port and baud
#set serial baud 115200
#target remote /dev/ttyUSB0
Expand Down

0 comments on commit af98dcd

Please sign in to comment.