esp-idf/components/esp_system/system_init_fn.txt
Ivan Grokhotkov 3254f8deae
esp_system: usb_console: fix restart when Wi-Fi is working
Previously, reset over USB CDC was done by calling esp_restart from
an interrupt handler. This works only until some restart hook function
is registered using esp_register_shutdown_handler, and the hook
function tries to do something that isn’t allowed in an interrupt
handler. One such case is with Wi-Fi. When Wi-Fi driver is installed,
it registers esp_wifi_stop as a shutdown handler function. However
esp_wifi_stop cannot be called from an ISR, and hence we shouldn’t
call esp_restart from an ISR either.

This commit modifies USB CDC driver to call esp_restart by posting it
to esp_timer task.

Closes https://github.com/espressif/esp-idf/issues/7404
2022-07-28 17:15:03 +02:00

33 lines
1.7 KiB
Plaintext

# This file documents the expected order of execution of ESP_SYSTEM_INIT_FN functions.
#
# When adding new ESP_SYSTEM_INIT_FN functions or changing init priorities of existing functions,
# keep this file up to date. This is checked in CI.
# When adding new functions or changing the priorities, please read the comments and see if
# they need to be updated to be consistent with the changes you are making.
#
# Entries are ordered by the order of execution (i.e. from low priority values to high ones).
# Each line has the following format:
# prio: function_name in path/to/source_file on affinity_expression
# Where:
# prio: priority value (higher value means function is executed later)
# affinity_expression: bit map of cores the function is executed on
# esp_timer has to be initialized early, since it is used by several other components
100: esp_timer_startup_init in components/esp_timer/src/esp_timer.c on BIT(0)
# esp_sleep doesn't have init dependencies
105: esp_sleep_startup_init in components/esp_hw_support/sleep_modes.c on BIT(0)
# app_trace has to be initialized before systemview
115: esp_apptrace_init in components/app_trace/app_trace.c on ESP_SYSTEM_INIT_ALL_CORES
120: sysview_init in components/app_trace/sys_view/esp/SEGGER_RTT_esp.c on BIT(0)
# the rest of the components which are initialized from startup.c
# [refactor-todo]: move init calls into respective components
200: init_components0 in components/esp_system/startup.c on BIT(0)
# usb_console needs to create an esp_timer at startup.
# This can be done only after esp_timer initialization, which is now in init_components0.
220: esp_usb_console_init_restart_timer in components/esp_system/port/soc/esp32s2/usb_console.c on BIT(0)