esp_psram: remove g_spiram_ok
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
// Copyright 2015-2018 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -25,7 +17,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern bool g_spiram_ok; // [refactor-todo] better way to communicate this from port layer to common startup code
|
||||
|
||||
// Port layer defines the entry point. It then transfer control to a `sys_startup_fn_t`, stored in this
|
||||
// array, one per core.
|
||||
|
||||
@@ -128,9 +128,6 @@ static volatile bool s_cpu_inited[SOC_CPU_CORES_NUM] = { false };
|
||||
static volatile bool s_resume_cores;
|
||||
#endif
|
||||
|
||||
// If CONFIG_SPIRAM_IGNORE_NOTFOUND is set and external RAM is not found or errors out on testing, this is set to false.
|
||||
bool g_spiram_ok = true;
|
||||
|
||||
static void core_intr_matrix_clear(void)
|
||||
{
|
||||
uint32_t core_id = cpu_hal_get_core_id();
|
||||
@@ -394,7 +391,6 @@ void IRAM_ATTR call_start_cpu0(void)
|
||||
|
||||
#if CONFIG_SPIRAM_IGNORE_NOTFOUND
|
||||
ESP_EARLY_LOGI(TAG, "Failed to init external RAM; continuing without it.");
|
||||
g_spiram_ok = false;
|
||||
#else
|
||||
ESP_EARLY_LOGE(TAG, "Failed to init external RAM!");
|
||||
abort();
|
||||
@@ -428,7 +424,7 @@ void IRAM_ATTR call_start_cpu0(void)
|
||||
#endif // SOC_CPU_CORES_NUM > 1
|
||||
|
||||
#if CONFIG_SPIRAM_MEMTEST
|
||||
if (g_spiram_ok) {
|
||||
if (esp_psram_is_initialized()) {
|
||||
bool ext_ram_ok = esp_psram_extram_test();
|
||||
if (!ext_ram_ok) {
|
||||
ESP_EARLY_LOGE(TAG, "External RAM failed memory test!");
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
#include "esp_rom_sys.h"
|
||||
|
||||
#if CONFIG_SPIRAM
|
||||
#include "esp_psram.h"
|
||||
#include "esp_private/esp_psram_extram.h"
|
||||
#endif
|
||||
/***********************************************/
|
||||
@@ -246,8 +247,8 @@ static void do_core_init(void)
|
||||
esp_timer_early_init();
|
||||
esp_newlib_init();
|
||||
|
||||
if (g_spiram_ok) {
|
||||
#if CONFIG_SPIRAM_BOOT_INIT && (CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC)
|
||||
if (esp_psram_is_initialized()) {
|
||||
esp_err_t r=esp_psram_extram_add_to_heap_allocator();
|
||||
if (r != ESP_OK) {
|
||||
ESP_EARLY_LOGE(TAG, "External RAM could not be added to heap!");
|
||||
@@ -255,9 +256,9 @@ static void do_core_init(void)
|
||||
}
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
heap_caps_malloc_extmem_enable(CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP_BROWNOUT_DET
|
||||
// [refactor-todo] leads to call chain rtc_is_register (driver) -> esp_intr_alloc (esp32/esp32s2) ->
|
||||
|
||||
Reference in New Issue
Block a user