esp32/main: Allow a board to override the MicroPython task stack size.

This allows the MicroPython task stack size to be overridden by the
mpconfigboard.h settings.

Signed-off-by: dotnfc <dotnfc@163.com>
pull/12426/head
dotnfc 2023-09-12 17:15:27 +08:00 zatwierdzone przez Damien George
rodzic 6662d84faa
commit d7f63f994f
2 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -66,7 +66,6 @@
// MicroPython runs as a task under FreeRTOS
#define MP_TASK_PRIORITY (ESP_TASK_PRIO_MIN + 1)
#define MP_TASK_STACK_SIZE (16 * 1024)
// Set the margin for detecting stack overflow, depending on the CPU architecture.
#if CONFIG_IDF_TARGET_ESP32C3
@ -87,7 +86,7 @@ int vprintf_null(const char *format, va_list ap) {
void mp_task(void *pvParameter) {
volatile uint32_t sp = (uint32_t)esp_cpu_get_sp();
#if MICROPY_PY_THREAD
mp_thread_init(pxTaskGetStackStart(NULL), MP_TASK_STACK_SIZE / sizeof(uintptr_t));
mp_thread_init(pxTaskGetStackStart(NULL), MICROPY_TASK_STACK_SIZE / sizeof(uintptr_t));
#endif
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
usb_serial_jtag_init();
@ -109,7 +108,7 @@ void mp_task(void *pvParameter) {
soft_reset:
// initialise the stack pointer for the main thread
mp_stack_set_top((void *)sp);
mp_stack_set_limit(MP_TASK_STACK_SIZE - MP_TASK_STACK_LIMIT_MARGIN);
mp_stack_set_limit(MICROPY_TASK_STACK_SIZE - MP_TASK_STACK_LIMIT_MARGIN);
gc_init(mp_task_heap, mp_task_heap + MP_TASK_HEAP_SIZE);
mp_init();
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib));
@ -206,7 +205,7 @@ void app_main(void) {
MICROPY_BOARD_STARTUP();
// Create and transfer control to the MicroPython task.
xTaskCreatePinnedToCore(mp_task, "mp_task", MP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, MP_TASK_PRIORITY, &mp_main_task_handle, MP_TASK_COREID);
xTaskCreatePinnedToCore(mp_task, "mp_task", MICROPY_TASK_STACK_SIZE / sizeof(StackType_t), NULL, MP_TASK_PRIORITY, &mp_main_task_handle, MP_TASK_COREID);
}
void nlr_jump_fail(void *val) {

Wyświetl plik

@ -152,6 +152,11 @@
#define MICROPY_FATFS_MAX_SS (4096)
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
// task size
#ifndef MICROPY_TASK_STACK_SIZE
#define MICROPY_TASK_STACK_SIZE (16 * 1024)
#endif
#define MP_STATE_PORT MP_STATE_VM
// type definitions for the specific machine