54
54
#include "peripherals/rmt.h"
55
55
#include "peripherals/pcnt.h"
56
56
#include "peripherals/timer.h"
57
+ #include "components/esp_rom/include/esp_rom_uart.h"
57
58
#include "components/heap/include/esp_heap_caps.h"
59
+ #include "components/xtensa/include/esp_debug_helpers.h"
58
60
#include "components/soc/soc/esp32s2/include/soc/cache_memory.h"
61
+ #include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h"
59
62
60
63
#define HEAP_SIZE (48 * 1024)
61
64
@@ -78,6 +81,11 @@ safe_mode_t port_init(void) {
78
81
args .name = "CircuitPython Tick" ;
79
82
esp_timer_create (& args , & _tick_timer );
80
83
84
+ #ifdef DEBUG
85
+ // Send the ROM output out of the UART. This includes early logs.
86
+ esp_rom_install_channel_putc (1 , esp_rom_uart_putc );
87
+ #endif
88
+
81
89
heap = NULL ;
82
90
never_reset_module_internal_pins ();
83
91
@@ -165,6 +173,7 @@ void reset_to_bootloader(void) {
165
173
}
166
174
167
175
void reset_cpu (void ) {
176
+ esp_backtrace_print (100 );
168
177
esp_restart ();
169
178
}
170
179
@@ -204,10 +213,11 @@ bool port_has_fixed_stack(void) {
204
213
205
214
// Place the word to save just after our BSS section that gets blanked.
206
215
void port_set_saved_word (uint32_t value ) {
216
+ REG_WRITE (RTC_CNTL_STORE0_REG , value );
207
217
}
208
218
209
219
uint32_t port_get_saved_word (void ) {
210
- return 0 ;
220
+ return REG_READ ( RTC_CNTL_STORE0_REG ) ;
211
221
}
212
222
213
223
uint64_t port_get_raw_ticks (uint8_t * subticks ) {
0 commit comments