You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2026/04/14 20:44:18 UTC
(nuttx) 04/04: arch/risc-v: custom compilation options on some cache sources
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 3f16c4a06eeaccdba6e45f295462d0e91ffdfc17
Author: Filipe Cavalcanti <fi...@espressif.com>
AuthorDate: Thu Apr 9 13:35:32 2026 -0300
arch/risc-v: custom compilation options on some cache sources
This change sets three new compilation flags for avoiding cache miss
when using optimized builds and cache is manipulated.
Signed-off-by: Filipe Cavalcanti <fi...@espressif.com>
---
arch/risc-v/src/common/espressif/CMakeLists.txt | 2 ++
arch/risc-v/src/esp32c3/hal_esp32c3.cmake | 32 +++++++++++++++++++------
arch/risc-v/src/esp32c6/hal_esp32c6.cmake | 32 +++++++++++++++++++------
3 files changed, 52 insertions(+), 14 deletions(-)
diff --git a/arch/risc-v/src/common/espressif/CMakeLists.txt b/arch/risc-v/src/common/espressif/CMakeLists.txt
index 3bbb0be67fa..749c7c4deb6 100644
--- a/arch/risc-v/src/common/espressif/CMakeLists.txt
+++ b/arch/risc-v/src/common/espressif/CMakeLists.txt
@@ -364,6 +364,8 @@ if(CONFIG_ESPRESSIF_EFUSE)
list(APPEND _esp_startup_u_opts "SHELL:-u esp_efuse_startup_include_func")
endif()
+list(APPEND _esp_startup_u_opts "SHELL:-u esp_flash_spi_init_include_func")
+
target_link_options(nuttx PRIVATE ${_esp_startup_u_opts})
# ##############################################################################
diff --git a/arch/risc-v/src/esp32c3/hal_esp32c3.cmake b/arch/risc-v/src/esp32c3/hal_esp32c3.cmake
index e18e6b90899..ff897a59fe3 100644
--- a/arch/risc-v/src/esp32c3/hal_esp32c3.cmake
+++ b/arch/risc-v/src/esp32c3/hal_esp32c3.cmake
@@ -422,8 +422,6 @@ list(
list(
APPEND
HAL_SRCS
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_noos.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_app.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_generic.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_boya.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_gd.c
@@ -432,14 +430,34 @@ list(
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_mxic_opi.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_mxic.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_th.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_api.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_ops.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_drivers.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/memspi_host_driver.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_spi_init.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_brownout_hook.c)
+
+# Cache (relates to SPI Flash)
+
+set(CACHE_SRCS)
+list(
+ APPEND
+ CACHE_SRCS
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/cache_utils.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_mmap.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_brownout_hook.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/cache_utils.c)
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_ops.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_api.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_spi_init.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_app.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_noos.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_wrap.c)
+
+list(APPEND HAL_SRCS ${CACHE_SRCS})
+
+# Avoid cache miss by unexpected inlineing when built by -Os
+set_source_files_properties(
+ ${CACHE_SRCS} DIRECTORY ../../../../
+ PROPERTIES
+ COMPILE_FLAGS
+ "-fno-inline-functions -fno-inline-small-functions -fno-inline-functions-called-once"
+)
# SOC sources (paths from hal_esp32c3.mk: esp_hal_* periph and soc)
list(
diff --git a/arch/risc-v/src/esp32c6/hal_esp32c6.cmake b/arch/risc-v/src/esp32c6/hal_esp32c6.cmake
index 320afe919c7..32dd2cdc926 100644
--- a/arch/risc-v/src/esp32c6/hal_esp32c6.cmake
+++ b/arch/risc-v/src/esp32c6/hal_esp32c6.cmake
@@ -463,19 +463,37 @@ list(
list(
APPEND
HAL_SRCS
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_noos.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_app.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_generic.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_gd.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_winbond.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_api.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_ops.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_chip_drivers.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/memspi_host_driver.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_spi_init.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_brownout_hook.c)
+
+# Cache (relates to SPI Flash)
+
+set(CACHE_SRCS)
+list(
+ APPEND
+ CACHE_SRCS
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/cache_utils.c
${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_mmap.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_brownout_hook.c
- ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/cache_utils.c)
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/flash_ops.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_api.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/esp_flash_spi_init.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_app.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_os_func_noos.c
+ ${ESP_HAL_3RDPARTY_REPO}/components/spi_flash/spi_flash_wrap.c)
+
+list(APPEND HAL_SRCS ${CACHE_SRCS})
+
+# Avoid cache miss by unexpected inlineing when built by -Os
+set_source_files_properties(
+ ${CACHE_SRCS} DIRECTORY ../../../../
+ PROPERTIES
+ COMPILE_FLAGS
+ "-fno-inline-functions -fno-inline-small-functions -fno-inline-functions-called-once"
+)
# ULP lp_core
list(