mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
Prior to this commit, esp_psram/include/esp_private/mmu.h contains some APIs that is used for: - copy flash content to psram - necessary sync APIs used by flash_mmap.c, due to above feature This commit rename it to mmu_psram_flash.h, therefore mmu.h can be used for real mmu related APIs. This commit also moves above mention funcitons in `mmu.c` and `mmu_psram.c` to `mmu_psram_flash.c`, leaving `mmu.c` to be used for real mmu driver.
59 lines
2.4 KiB
CMake
59 lines
2.4 KiB
CMake
idf_build_get_property(target IDF_TARGET)
|
|
|
|
set(includes "include")
|
|
|
|
set(priv_requires efuse heap spi_flash)
|
|
if(${target} STREQUAL "esp32")
|
|
list(APPEND priv_requires bootloader_support)
|
|
# [refactor-todo]: requires "driver" for `spicommon_periph_claim`
|
|
list(APPEND priv_requires driver)
|
|
endif()
|
|
|
|
set(srcs)
|
|
|
|
if(CONFIG_SPIRAM)
|
|
list(APPEND srcs "esp_psram.c"
|
|
"mmu.c"
|
|
"mmu_psram_flash.c")
|
|
|
|
if(${target} STREQUAL "esp32")
|
|
list(APPEND srcs "esp32/esp_psram_extram_cache.c"
|
|
"esp32/esp_himem.c")
|
|
endif()
|
|
|
|
if(CONFIG_SPIRAM_MODE_QUAD)
|
|
list(APPEND srcs "${target}/esp_psram_impl_quad.c")
|
|
elseif(CONFIG_SPIRAM_MODE_OCT)
|
|
list(APPEND srcs "${target}/esp_psram_impl_octal.c")
|
|
endif()
|
|
endif()
|
|
|
|
idf_component_register(SRCS ${srcs}
|
|
INCLUDE_DIRS ${includes}
|
|
PRIV_REQUIRES ${priv_requires}
|
|
LDFRAGMENTS linker.lf)
|
|
|
|
if(CONFIG_IDF_TARGET_ESP32 AND CONFIG_SPIRAM_CACHE_WORKAROUND AND NOT BOOTLOADER_BUILD)
|
|
# Note: Adding as a PUBLIC compile option here causes this option to propagate to all
|
|
# components that depend on esp_psram.
|
|
#
|
|
# To handle some corner cases, the same flag is set in project_include.cmake
|
|
target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue)
|
|
# also, make sure we link with this option so correct toolchain libs are pulled in
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-issue)
|
|
# set strategy selected
|
|
# note that we don't need to set link options as the library linked is independent of this
|
|
if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST)
|
|
target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst)
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=dupldst)
|
|
endif()
|
|
if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW)
|
|
target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw)
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=memw)
|
|
endif()
|
|
if(CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS)
|
|
target_compile_options(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops)
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC -mfix-esp32-psram-cache-strategy=nops)
|
|
endif()
|
|
endif()
|