Skip to content

Commit 8bd1a8e

Browse files
committed
Stop using our own memcpy. Enhance decode backtrace script.
1 parent 17adee5 commit 8bd1a8e

File tree

5 files changed

+63
-13
lines changed

5 files changed

+63
-13
lines changed

ports/espressif/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ LDFLAGS += \
290290
-Tesp32c6.rom.net80211.ld \
291291
-Tesp32c6.rom.libc.ld \
292292
-Tesp32c6.rom.newlib.ld \
293-
-Tesp32c6.rom.spiflash.ld \
294293
-Tesp32c6.rom.coexist.ld \
295294
-Tesp32c6.rom.heap.ld \
296295
-Tesp32c6.rom.systimer.ld \

ports/espressif/esp-idf-config/sdkconfig-debug.defaults

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
88
# end of Compiler options
99

10+
# Bootloader config
11+
#
12+
#
13+
# Log
14+
#
15+
#
16+
# Format
17+
#
18+
CONFIG_BOOTLOADER_LOG_COLORS=y
19+
# end of Format
20+
21+
# end of Log
22+
23+
# end of Bootloader config
24+
1025
#
1126
# Component config
1227
#
@@ -19,6 +34,17 @@ CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
1934
# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set
2035
# end of ESP System Settings
2136

37+
#
38+
# Log
39+
#
40+
#
41+
# Format
42+
#
43+
CONFIG_LOG_COLORS=y
44+
# end of Format
45+
46+
# end of Log
47+
2248
# end of Component config
2349

2450
# end of Espressif IoT Development Framework Configuration

ports/espressif/esp-idf-config/sdkconfig.defaults

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384
6565
CONFIG_FREERTOS_HZ=1000
6666
# end of Kernel
6767

68+
#
69+
# LibC
70+
#
71+
# end of LWIP
72+
CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS=y
73+
# end of LibC
74+
6875
#
6976
# LWIP
7077
#

ports/espressif/tools/decode_backtrace.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,39 @@
1212
board = sys.argv[1]
1313
print(board)
1414

15+
elfs = [
16+
f"build-{board}/firmware.elf",
17+
"/home/tannewt/Downloads/esp-rom-elfs-20241011/esp32c6_rev0_rom.elf",
18+
]
19+
1520
while True:
21+
print('"Backtrace:" or "Stack memory:". CTRL-D to finish multiline paste')
1622
addresses = input("? ")
1723
if addresses.startswith("Backtrace:"):
1824
addresses = addresses[len("Backtrace:") :]
25+
addresses = addresses.strip().split()
26+
addresses = [address.split(":")[0] for address in addresses]
1927
if addresses.startswith("Stack memory:"):
20-
addresses = addresses[len("Stack memory:") :]
21-
addresses = addresses.strip().split()
22-
addresses = [address.split(":")[0] for address in addresses]
28+
addresses = []
29+
extra_lines = sys.stdin.readlines()
30+
for line in extra_lines:
31+
if not line.strip():
32+
continue
33+
addresses.extend(line.split(":")[1].strip().split())
2334
for address in addresses:
24-
result = subprocess.run(
25-
["xtensa-esp32s2-elf-addr2line", "-aipfe", "build-{}/firmware.elf".format(board)]
26-
+ [address],
27-
capture_output=True,
28-
)
29-
stdout = result.stdout.decode("utf-8")
30-
if "?? ??" not in stdout:
31-
print(stdout.strip())
35+
if address == "0xa5a5a5a5":
36+
# Skip stack fill value.
37+
continue
38+
for elf in elfs:
39+
result = subprocess.run(
40+
["riscv32-esp-elf-addr2line", "-aipfe", elf, address],
41+
capture_output=True,
42+
)
43+
stdout = result.stdout.decode("utf-8")
44+
if not stdout:
45+
continue
46+
if "?? ??" not in stdout:
47+
print(stdout.strip())
48+
break
49+
50+
print("loop")

py/circuitpy_defns.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,6 @@ endif
992992

993993
# Sources used in all ports except unix.
994994
SRC_CIRCUITPY_COMMON = \
995-
shared/libc/string0.c \
996995
shared/readline/readline.c \
997996
lib/oofatfs/ff.c \
998997
lib/oofatfs/ffunicode.c \

0 commit comments

Comments
 (0)