mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-03 16:41:44 +01:00
cmake: Fix psram workaround compiler flag application
Previously, this compiler flag was not being applied regardless of CONFIG_SPIRAM_CACHE_WORKAROUND setting. Explanation: add_compile_options() only applies to source files added after the function is run, or in subdirectories added after the function is run. In this case, no new source files were being added after this function was run.
This commit is contained in:
committed by
Angus Gratton
parent
a241f95407
commit
56694fb4b6
@@ -91,7 +91,10 @@ else()
|
||||
)
|
||||
|
||||
if(CONFIG_SPIRAM_CACHE_WORKAROUND)
|
||||
add_compile_options(-mfix-esp32-psram-cache-issue)
|
||||
# Note: Adding as a PUBLIC compile option here causes this option to propagate to all components that depend on esp32.
|
||||
#
|
||||
# To handle some corner cases, the same flag is set in project_include.cmake
|
||||
target_compile_options(esp32 PUBLIC -mfix-esp32-psram-cache-issue)
|
||||
else()
|
||||
target_linker_script(esp32 "ld/esp32.rom.spiram_incompatible_fns.ld")
|
||||
endif()
|
||||
|
||||
@@ -124,7 +124,8 @@ config SPIRAM_CACHE_WORKAROUND
|
||||
help
|
||||
Revision 1 of the ESP32 has a bug that can cause a write to PSRAM not to take place in some situations
|
||||
when the cache line needs to be fetched from external RAM and an interrupt occurs. This enables a
|
||||
fix in the compiler that makes sure the specific code that is vulnerable to this will not be emitted.
|
||||
fix in the compiler (-mfix-esp32-psram-cache-issue) that makes sure the specific code that is vulnerable
|
||||
to this will not be emitted.
|
||||
|
||||
This will also not use any bits of newlib that are located in ROM, opting for a version that is compiled
|
||||
with the workaround and located in flash instead.
|
||||
|
||||
8
components/esp32/project_include.cmake
Normal file
8
components/esp32/project_include.cmake
Normal file
@@ -0,0 +1,8 @@
|
||||
if(CONFIG_SPIRAM_CACHE_WORKAROUND)
|
||||
# We do this here as well as in CMakeLists.txt, because targets that
|
||||
# are not part of the ESP-IDF build system (for cases where a generic
|
||||
# non-IDF CMakeLists.txt file is imported into a component) don't depend
|
||||
# on the esp32 component so don't get the extra flag. This handles that case.
|
||||
add_compile_options(-mfix-esp32-psram-cache-issue)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user