mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 06:34:34 +02:00
esp_psram: remove g_spiram_ok
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "soc/dport_reg.h"
|
#include "soc/dport_reg.h"
|
||||||
|
#include "esp_attr.h"
|
||||||
#include "esp_psram.h"
|
#include "esp_psram.h"
|
||||||
#include "esp_private/esp_psram_extram.h"
|
#include "esp_private/esp_psram_extram.h"
|
||||||
|
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS || CONFIG_SPIRAM_RODATA
|
#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS || CONFIG_SPIRAM_RODATA
|
||||||
|
//page_size - 1, where page_size on s2 and s3 is always 0x10000. To be refactored by MMU driver
|
||||||
|
#define INVALID_PHY_PAGE 0xffff
|
||||||
const static char *TAG = "mmu_psram";
|
const static char *TAG = "mmu_psram";
|
||||||
//TODO IDF-4387
|
//TODO IDF-4387
|
||||||
static uint32_t page0_mapped = 0;
|
static uint32_t page0_mapped = 0;
|
||||||
|
@@ -1,16 +1,8 @@
|
|||||||
// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// 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.
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -25,7 +17,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
// Port layer defines the entry point. It then transfer control to a `sys_startup_fn_t`, stored in this
|
||||||
// array, one per core.
|
// 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;
|
static volatile bool s_resume_cores;
|
||||||
#endif
|
#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)
|
static void core_intr_matrix_clear(void)
|
||||||
{
|
{
|
||||||
uint32_t core_id = cpu_hal_get_core_id();
|
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
|
#if CONFIG_SPIRAM_IGNORE_NOTFOUND
|
||||||
ESP_EARLY_LOGI(TAG, "Failed to init external RAM; continuing without it.");
|
ESP_EARLY_LOGI(TAG, "Failed to init external RAM; continuing without it.");
|
||||||
g_spiram_ok = false;
|
|
||||||
#else
|
#else
|
||||||
ESP_EARLY_LOGE(TAG, "Failed to init external RAM!");
|
ESP_EARLY_LOGE(TAG, "Failed to init external RAM!");
|
||||||
abort();
|
abort();
|
||||||
@@ -428,7 +424,7 @@ void IRAM_ATTR call_start_cpu0(void)
|
|||||||
#endif // SOC_CPU_CORES_NUM > 1
|
#endif // SOC_CPU_CORES_NUM > 1
|
||||||
|
|
||||||
#if CONFIG_SPIRAM_MEMTEST
|
#if CONFIG_SPIRAM_MEMTEST
|
||||||
if (g_spiram_ok) {
|
if (esp_psram_is_initialized()) {
|
||||||
bool ext_ram_ok = esp_psram_extram_test();
|
bool ext_ram_ok = esp_psram_extram_test();
|
||||||
if (!ext_ram_ok) {
|
if (!ext_ram_ok) {
|
||||||
ESP_EARLY_LOGE(TAG, "External RAM failed memory test!");
|
ESP_EARLY_LOGE(TAG, "External RAM failed memory test!");
|
||||||
|
@@ -72,6 +72,7 @@
|
|||||||
#include "esp_rom_sys.h"
|
#include "esp_rom_sys.h"
|
||||||
|
|
||||||
#if CONFIG_SPIRAM
|
#if CONFIG_SPIRAM
|
||||||
|
#include "esp_psram.h"
|
||||||
#include "esp_private/esp_psram_extram.h"
|
#include "esp_private/esp_psram_extram.h"
|
||||||
#endif
|
#endif
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
@@ -246,8 +247,8 @@ static void do_core_init(void)
|
|||||||
esp_timer_early_init();
|
esp_timer_early_init();
|
||||||
esp_newlib_init();
|
esp_newlib_init();
|
||||||
|
|
||||||
if (g_spiram_ok) {
|
|
||||||
#if CONFIG_SPIRAM_BOOT_INIT && (CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC)
|
#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();
|
esp_err_t r=esp_psram_extram_add_to_heap_allocator();
|
||||||
if (r != ESP_OK) {
|
if (r != ESP_OK) {
|
||||||
ESP_EARLY_LOGE(TAG, "External RAM could not be added to heap!");
|
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
|
#if CONFIG_SPIRAM_USE_MALLOC
|
||||||
heap_caps_malloc_extmem_enable(CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL);
|
heap_caps_malloc_extmem_enable(CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_ESP_BROWNOUT_DET
|
#if CONFIG_ESP_BROWNOUT_DET
|
||||||
// [refactor-todo] leads to call chain rtc_is_register (driver) -> esp_intr_alloc (esp32/esp32s2) ->
|
// [refactor-todo] leads to call chain rtc_is_register (driver) -> esp_intr_alloc (esp32/esp32s2) ->
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
#include "xtensa/config/core.h"
|
#include "xtensa/config/core.h"
|
||||||
#include "xtensa/config/core-isa.h"
|
#include "xtensa/config/core-isa.h"
|
||||||
#include "xtensa/xtruntime.h"
|
#include "xtensa/xtruntime.h"
|
||||||
#include "esp_private/startup_internal.h" /* Required by g_spiram_ok. [refactor-todo] for g_spiram_ok */
|
|
||||||
#include "esp_private/esp_int_wdt.h"
|
#include "esp_private/esp_int_wdt.h"
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
@@ -29,7 +28,9 @@
|
|||||||
#include "esp_heap_caps_init.h"
|
#include "esp_heap_caps_init.h"
|
||||||
#include "esp_freertos_hooks.h"
|
#include "esp_freertos_hooks.h"
|
||||||
#if CONFIG_SPIRAM
|
#if CONFIG_SPIRAM
|
||||||
#include "esp_private/esp_psram_extram.h" /* Required by esp_psram_extram_reserve_dma_pool() */
|
/* Required by esp_psram_extram_reserve_dma_pool() */
|
||||||
|
#include "esp_psram.h"
|
||||||
|
#include "esp_private/esp_psram_extram.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_APPTRACE_ENABLE
|
#ifdef CONFIG_APPTRACE_ENABLE
|
||||||
#include "esp_app_trace.h"
|
#include "esp_app_trace.h"
|
||||||
@@ -182,7 +183,7 @@ static void main_task(void* args)
|
|||||||
|
|
||||||
// Now we have startup stack RAM available for heap, enable any DMA pool memory
|
// Now we have startup stack RAM available for heap, enable any DMA pool memory
|
||||||
#if CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL
|
#if CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL
|
||||||
if (g_spiram_ok) {
|
if (esp_psram_is_initialized()) {
|
||||||
esp_err_t r = esp_psram_extram_reserve_dma_pool(CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL);
|
esp_err_t r = esp_psram_extram_reserve_dma_pool(CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL);
|
||||||
if (r != ESP_OK) {
|
if (r != ESP_OK) {
|
||||||
ESP_EARLY_LOGE(TAG, "Could not reserve internal/DMA pool (error 0x%x)", r);
|
ESP_EARLY_LOGE(TAG, "Could not reserve internal/DMA pool (error 0x%x)", r);
|
||||||
|
@@ -14,13 +14,13 @@
|
|||||||
#include "esp_task_wdt.h"
|
#include "esp_task_wdt.h"
|
||||||
#include "esp_task.h"
|
#include "esp_task.h"
|
||||||
#include "esp_private/crosscore_int.h"
|
#include "esp_private/crosscore_int.h"
|
||||||
#include "esp_private/startup_internal.h" /* Required by g_spiram_ok. [refactor-todo] for g_spiram_ok */
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_memory_utils.h"
|
#include "esp_memory_utils.h"
|
||||||
#include "esp_freertos_hooks.h"
|
#include "esp_freertos_hooks.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#if CONFIG_SPIRAM
|
#if CONFIG_SPIRAM
|
||||||
|
#include "esp_psram.h"
|
||||||
#include "esp_private/esp_psram_extram.h"
|
#include "esp_private/esp_psram_extram.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ static void main_task(void* args)
|
|||||||
|
|
||||||
// Now we have startup stack RAM available for heap, enable any DMA pool memory
|
// Now we have startup stack RAM available for heap, enable any DMA pool memory
|
||||||
#if CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL
|
#if CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL
|
||||||
if (g_spiram_ok) {
|
if (esp_psram_is_initialized()) {
|
||||||
esp_err_t r = esp_psram_extram_reserve_dma_pool(CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL);
|
esp_err_t r = esp_psram_extram_reserve_dma_pool(CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL);
|
||||||
if (r != ESP_OK) {
|
if (r != ESP_OK) {
|
||||||
ESP_EARLY_LOGE(TAG, "Could not reserve internal/DMA pool (error 0x%x)", r);
|
ESP_EARLY_LOGE(TAG, "Could not reserve internal/DMA pool (error 0x%x)", r);
|
||||||
|
@@ -666,7 +666,6 @@ components/esp_system/include/esp_freertos_hooks.h
|
|||||||
components/esp_system/include/esp_int_wdt.h
|
components/esp_system/include/esp_int_wdt.h
|
||||||
components/esp_system/include/esp_private/dbg_stubs.h
|
components/esp_system/include/esp_private/dbg_stubs.h
|
||||||
components/esp_system/include/esp_private/panic_internal.h
|
components/esp_system/include/esp_private/panic_internal.h
|
||||||
components/esp_system/include/esp_private/startup_internal.h
|
|
||||||
components/esp_system/include/esp_private/system_internal.h
|
components/esp_system/include/esp_private/system_internal.h
|
||||||
components/esp_system/include/esp_private/usb_console.h
|
components/esp_system/include/esp_private/usb_console.h
|
||||||
components/esp_system/include/esp_task.h
|
components/esp_system/include/esp_task.h
|
||||||
|
Reference in New Issue
Block a user