Skip to content

Commit c1f7f80

Browse files
authored
Merge pull request #7972 from tannewt/improve_c3
Minor C3 debug tweaks
2 parents 718f9fc + 10b2e6b commit c1f7f80

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

ports/espressif/Makefile

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,25 @@ CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5
120120

121121
#Debugging/Optimization
122122
ifeq ($(DEBUG), 1)
123-
CFLAGS += -DDEBUG -ggdb
124-
OPTIMIZATION_FLAGS ?= -Og
125-
# You may want to enable these flags to make setting breakpoints easier.
126-
# CFLAGS += -fno-inline -fno-ipa-sra
123+
CFLAGS += -ggdb
124+
ifeq ($(IDF_TARGET_ARCH),riscv)
125+
OPTIMIZATION_FLAGS ?= -Os
126+
CFLAGS += -DNDEBUG
127+
else
128+
OPTIMIZATION_FLAGS ?= -Og
129+
CFLAGS += -DDEBUG
130+
endif
131+
# You may want to enable these flags to make setting breakpoints easier.
132+
# CFLAGS += -fno-inline -fno-ipa-sra
127133
else
128-
CFLAGS += -DNDEBUG -ggdb3
129-
# RISC-V is larger than xtensa
130-
# Use -Os for RISC-V when it overflows
131-
ifeq ($(IDF_TARGET_ARCH),riscv)
132-
OPTIMIZATION_FLAGS ?= -Os
133-
else
134-
OPTIMIZATION_FLAGS ?= -O2
135-
endif
134+
CFLAGS += -DNDEBUG -ggdb3
135+
# RISC-V is larger than xtensa
136+
# Use -Os for RISC-V when it overflows
137+
ifeq ($(IDF_TARGET_ARCH),riscv)
138+
OPTIMIZATION_FLAGS ?= -Os
139+
else
140+
OPTIMIZATION_FLAGS ?= -O2
141+
endif
136142
endif
137143

138144
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk

ports/espressif/common-hal/microcontroller/Pin.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ static const uint64_t pin_mask_reset_forbidden =
6262
GPIO_SEL_18 | // USB D-
6363
GPIO_SEL_19 | // USB D+
6464
#endif
65+
#if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) && CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0
66+
// Never reset debug UART/console pins.
67+
GPIO_SEL_20 |
68+
GPIO_SEL_21 |
69+
#endif
6570
#endif // ESP32C3
6671

6772
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)

0 commit comments

Comments
 (0)