forked from espressif/esp-idf
Merge branch 'feature/newlib_in_flash' into 'master'
feat(newlib): added option for placing functions in flash if flash-auto-suspend Closes IDF-11958 See merge request espressif/esp-idf!37767
This commit is contained in:
@@ -11,6 +11,10 @@ menu "LibC"
|
||||
depends on !IDF_TOOLCHAIN_CLANG && IDF_EXPERIMENTAL_FEATURES
|
||||
endchoice
|
||||
|
||||
config LIBC_MISC_IN_IRAM
|
||||
bool "Place misc libc functions (abort/assert/stdatomics) in IRAM" if SPI_FLASH_AUTO_SUSPEND
|
||||
default y
|
||||
|
||||
config LIBC_LOCKS_PLACE_IN_IRAM
|
||||
bool "Place lock API in IRAM"
|
||||
default y
|
||||
|
@@ -1,6 +1,7 @@
|
||||
[mapping:newlib]
|
||||
archive: libnewlib.a
|
||||
entries:
|
||||
if LIBC_MISC_IN_IRAM = y:
|
||||
if HEAP_PLACE_FUNCTION_INTO_FLASH = n:
|
||||
heap (noflash)
|
||||
abort (noflash)
|
||||
|
@@ -0,0 +1,15 @@
|
||||
# Options that will enable common IRAM usage reduction option. These options should be safe to use with most setups
|
||||
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||
CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH=y
|
||||
CONFIG_LIBC_LOCKS_PLACE_IN_IRAM=n
|
||||
CONFIG_HAL_ASSERTION_SILENT=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||
|
||||
# Options that will enable IRAM reduction option that are not necessarily safe for all use-cases
|
||||
CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y
|
||||
|
||||
# Options that will enable IRAM reduction option that are only usable together with flash auto-suspend
|
||||
CONFIG_SPI_FLASH_AUTO_SUSPEND=y
|
||||
CONFIG_LIBC_MISC_IN_IRAM=n
|
@@ -30,6 +30,15 @@ tools/test_apps/system/eh_frame:
|
||||
|
||||
tools/test_apps/system/esp_intr_dump:
|
||||
|
||||
tools/test_apps/system/flash_auto_suspend_iram_reduction:
|
||||
disable:
|
||||
- if: IDF_TARGET == "esp32" or IDF_TARGET == "esp32s2
|
||||
reason: Targets do not support auto-suspend
|
||||
disable_test:
|
||||
- if: IDF_TARGET != "esp32c3"
|
||||
temporary: true
|
||||
reason: lack of runners
|
||||
|
||||
tools/test_apps/system/g0_components:
|
||||
enable:
|
||||
- if: INCLUDE_DEFAULT == 1 or IDF_TARGET in ["esp32c5", "esp32c61", "esp32h21", "esp32h4"] # preview targets
|
||||
|
@@ -0,0 +1,9 @@
|
||||
# The following five lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
list(PREPEND SDKCONFIG_DEFAULTS "$ENV{IDF_PATH}/tools/test_apps/configs/sdkconfig.flash_auto_suspend_iram_reduction")
|
||||
|
||||
project(flash_auto_suspend_iram_reduction)
|
@@ -0,0 +1,2 @@
|
||||
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- |
|
@@ -0,0 +1,2 @@
|
||||
idf_component_register(SRCS "flash_auto_suspend_iram_reduction.c"
|
||||
INCLUDE_DIRS ".")
|
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
printf("Hello World!\n");
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.flash_suspend
|
||||
@idf_parametrize('config', ['defaults'], indirect=['config'])
|
||||
@idf_parametrize('target', ['esp32c3'], indirect=['target'])
|
||||
def test_flash_auto_suspend_minimize_iram_usage(dut: Dut) -> None:
|
||||
dut.expect_exact('Hello World!', timeout=30)
|
@@ -0,0 +1,2 @@
|
||||
# Now the runners are massively using xmc-c chips, to be removed when xmc-d goes massive production.
|
||||
CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND=y
|
Reference in New Issue
Block a user