esp32, esp32s2: move reset reason source to esp_system

This commit is contained in:
Renz Bagaporo 2020-03-04 17:12:06 +08:00
parent 84e80a3e50
commit 890510aecd
10 changed files with 11 additions and 36 deletions

View file

@ -24,7 +24,6 @@ else()
"intr_alloc.c"
"pm_esp32.c"
"pm_trace.c"
"reset_reason.c"
"sleep_modes.c"
"spiram.c"
"spiram_psram.c"

View file

@ -21,7 +21,6 @@ else()
"intr_alloc.c"
"pm_esp32s2.c"
"pm_trace.c"
"reset_reason.c"
"sleep_modes.c"
"spiram.c"
"spiram_psram.c"

View file

@ -78,5 +78,7 @@ void esp_cache_err_int_init(void)
int IRAM_ATTR esp_cache_err_get_cpuid(void)
{
// TODO: The description for this seem to indicate that when cache is not in error
// state, return -1.
return PRO_CPU_NUM;
}

View file

@ -1,4 +1,4 @@
idf_component_register(SRCS "panic.c" "reset_reason.c" "system_api.c"
idf_component_register(SRCS "panic.c" "system_api.c"
INCLUDE_DIRS include
PRIV_INCLUDE_DIRS private_include
PRIV_REQUIRES spi_flash app_update

View file

@ -1 +1,2 @@
target_sources(${COMPONENT_LIB} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/dport_panic_highint_hdl.S")
target_sources(${COMPONENT_LIB} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/dport_panic_highint_hdl.S"
"${CMAKE_CURRENT_LIST_DIR}/reset_reason.c")

View file

@ -1 +1,2 @@
target_sources(${COMPONENT_LIB} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/dport_panic_highint_hdl.S")
target_sources(${COMPONENT_LIB} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/dport_panic_highint_hdl.S"
"${CMAKE_CURRENT_LIST_DIR}/reset_reason.c")

View file

@ -517,6 +517,7 @@ static __attribute__((noreturn)) void esp_digital_reset(void)
#if CONFIG_IDF_TARGET_ESP32
esp_cpu_unstall(PRO_CPU_NUM);
#endif
// reset the digital part
SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_SYS_RST);
while (true) {
@ -527,7 +528,9 @@ static __attribute__((noreturn)) void esp_digital_reset(void)
void __attribute__((noreturn)) panic_restart(void)
{
// If resetting because of a cache error, reset the digital part
if (esp_cache_err_get_cpuid() != -1) {
// Make sure that the reset reason is not a generic panic reason as well on ESP32S2,
// as esp_cache_err_get_cpuid always returns PRO_CPU_NUM
if (esp_cache_err_get_cpuid() != -1 && esp_reset_reason_get_hint() != ESP_RST_PANIC) {
esp_digital_reset();
} else {
esp_restart_noos();

View file

@ -1,30 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "esp_private/system_internal.h"
/* These two weak stubs for esp_reset_reason_{get,set}_hint are used when
* the application does not call esp_reset_reason() function, and
* reset_reason.c is not linked into the output file.
*/
void __attribute__((weak)) esp_reset_reason_set_hint(esp_reset_reason_t hint)
{
}
esp_reset_reason_t __attribute__((weak)) esp_reset_reason_get_hint(void)
{
return ESP_RST_UNKNOWN;
}