Skip to content

Commit e0c6302

Browse files
committed
Improve RGBMatrix reliability
The guard against running when flash is disabled isn't perfect and may lead to calling the row handler anyway. We were crashing due to mp_hal_delay_us being in flash. So, move it to RAM. Also move the panic handler to IRAM so we get nice output when this happens. Turn off JTAG by default so its pins can be used by code.py. Fixes #8987
1 parent d8bd26c commit e0c6302

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
[submodule "ports/espressif/esp-idf"]
144144
path = ports/espressif/esp-idf
145145
url = https://github.com/adafruit/esp-idf.git
146-
branch = circuitpython-v5.1.2
146+
branch = circuitpython-v5.1.3
147147
[submodule "ports/espressif/esp-protocols"]
148148
path = ports/espressif/esp-protocols
149149
url = https://github.com/espressif/esp-protocols.git

ports/espressif/esp-idf

Submodule esp-idf updated 981 files

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CONFIG_GPTIMER_ISR_IRAM_SAFE=y
3333
#
3434
CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384
3535
# CONFIG_ESP_TASK_WDT_INIT is not set
36+
CONFIG_ESP_PANIC_HANDLER_IRAM=y
3637
# CONFIG_ESP_DEBUG_OCDAWARE is not set
3738
# end of ESP System Settings
3839

ports/espressif/mphalport.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@
4444
#error Unknown CONFIG_IDF_TARGET_xxx
4545
#endif
4646

47-
void mp_hal_delay_us(mp_uint_t delay) {
47+
#include "esp_attr.h"
48+
49+
// This is used by ProtoMatter's interrupt so make sure it is available when
50+
// flash isn't.
51+
void IRAM_ATTR mp_hal_delay_us(mp_uint_t delay) {
4852
ets_delay_us(delay);
4953
}
5054

ports/espressif/supervisor/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ safe_mode_t port_init(void) {
270270
#endif
271271

272272
#ifndef ENABLE_JTAG
273-
#define ENABLE_JTAG (defined(DEBUG) && DEBUG)
273+
#define ENABLE_JTAG (0)
274274
#endif
275275

276276
#if ENABLE_JTAG

supervisor/shared/usb/usb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ void usb_background(void) {
171171
#if CIRCUITPY_USB_HOST
172172
tuh_task();
173173
#endif
174+
#else
175+
// Yield to the RTOS in case TinyUSB runs in a separate task.
176+
port_yield();
174177
#endif
175178
// No need to flush if there's no REPL.
176179
#if CIRCUITPY_USB_CDC

0 commit comments

Comments
 (0)