Fix heap without PSRAM. Never set heap_size.
This commit is contained in:
parent
96cf60fbbd
commit
99f5011d74
@ -59,8 +59,6 @@ void tick_timer_cb(void* arg) {
|
||||
supervisor_tick();
|
||||
}
|
||||
|
||||
uint32_t* heap;
|
||||
|
||||
safe_mode_t port_init(void) {
|
||||
esp_timer_create_args_t args;
|
||||
args.callback = &tick_timer_cb;
|
||||
@ -69,7 +67,7 @@ safe_mode_t port_init(void) {
|
||||
args.name = "CircuitPython Tick";
|
||||
esp_timer_create(&args, &_tick_timer);
|
||||
|
||||
heap = malloc(HEAP_SIZE);
|
||||
heap = NULL;
|
||||
never_reset_module_internal_pins();
|
||||
|
||||
#ifdef CONFIG_SPIRAM
|
||||
@ -81,6 +79,10 @@ safe_mode_t port_init(void) {
|
||||
heap = malloc(HEAP_SIZE);
|
||||
heap_size = HEAP_SIZE / sizeof(uint32_t);
|
||||
}
|
||||
if (heap == NULL) {
|
||||
return NO_HEAP;
|
||||
}
|
||||
|
||||
return NO_SAFE_MODE;
|
||||
}
|
||||
|
||||
@ -142,13 +144,6 @@ supervisor_allocation* port_fixed_stack(void) {
|
||||
return &_fixed_stack;
|
||||
}
|
||||
|
||||
supervisor_allocation _fixed_heap;
|
||||
supervisor_allocation* port_fixed_heap(void) {
|
||||
_fixed_heap.ptr = port_heap_get_bottom();
|
||||
_fixed_heap.length = (port_heap_get_top() - port_heap_get_bottom()) * sizeof(uint32_t);
|
||||
return &_fixed_heap;
|
||||
}
|
||||
|
||||
// Place the word to save just after our BSS section that gets blanked.
|
||||
void port_set_saved_word(uint32_t value) {
|
||||
}
|
||||
|
@ -133,6 +133,10 @@ void print_safe_mode_message(safe_mode_t reason) {
|
||||
serial_write_compressed(translate("The CircuitPython heap was corrupted because the stack was too small.\nPlease increase the stack size if you know how, or if not:"));
|
||||
serial_write_compressed(FILE_AN_ISSUE);
|
||||
return;
|
||||
case NO_HEAP:
|
||||
serial_write_compressed(translate("CircuitPython was unable to allocate the heap.\n"));
|
||||
serial_write_compressed(FILE_AN_ISSUE);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ typedef enum {
|
||||
FLASH_WRITE_FAIL,
|
||||
MEM_MANAGE,
|
||||
WATCHDOG_RESET,
|
||||
NO_HEAP,
|
||||
} safe_mode_t;
|
||||
|
||||
safe_mode_t wait_for_safe_mode_reset(void);
|
||||
|
Loading…
Reference in New Issue
Block a user