esp32/main: Check if main GC heap allocation failed.
If the heap allocation fails we will crash if we continue, so at least we can show a clear error message so one can figure out memory allocation was the problem (instead of just seeing some arbitrary null pointer error later). Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This commit is contained in:
parent
35f3f0a87d
commit
a0efe2d368
1 changed files with 4 additions and 0 deletions
|
|
@ -116,6 +116,10 @@ void mp_task(void *pvParameter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *mp_task_heap = MP_PLAT_ALLOC_HEAP(MICROPY_GC_INITIAL_HEAP_SIZE);
|
void *mp_task_heap = MP_PLAT_ALLOC_HEAP(MICROPY_GC_INITIAL_HEAP_SIZE);
|
||||||
|
if (mp_task_heap == NULL) {
|
||||||
|
printf("mp_task_heap allocation failed!\n");
|
||||||
|
esp_restart();
|
||||||
|
}
|
||||||
|
|
||||||
soft_reset:
|
soft_reset:
|
||||||
// initialise the stack pointer for the main thread
|
// initialise the stack pointer for the main thread
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue