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 <filipe.cavalcanti@espressif.com>
This commit is contained in:
Filipe Cavalcanti
2026-04-09 13:35:32 -03:00
committed by Alan C. Assis
parent 723051d322
commit 3f16c4a06e
3 changed files with 52 additions and 14 deletions
@@ -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})
# ##############################################################################
+25 -7
View File
@@ -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(
+25 -7
View File
@@ -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(