diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 563419fcd..62fdff46d 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -165,6 +165,13 @@ config SPIRAM_CACHE_WORKAROUND 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. +config SPIRAM_CACHE_ALWAYS_MEMBARRIER + bool "Heavy-handed workaround for bug: Always do memory barrier" + default "n" + help + This will introduce a memory barrier before EVERY load/store. This will get rid of most coherency + issues, but at the cost of a lot of performance. Don't enable unless you know you need this! + config SPIRAM_CACHE_WORKAROUND_TEST bool "Debug: Test workaround by generating a lot of interrupts" default "n" diff --git a/make/project.mk b/make/project.mk index f5276aef5..fc5c976a3 100644 --- a/make/project.mk +++ b/make/project.mk @@ -244,6 +244,10 @@ ifeq ("$(CONFIG_SPIRAM_CACHE_WORKAROUND)", "y") COMMON_FLAGS+=-mfix-esp32-psram-cache-issue endif +ifeq ("$(CONFIG_SPIRAM_CACHE_ALWAYS_MEMBARRIER)", "y") +COMMON_FLAGS+=-malways-memw +endif + # Enable generation of debugging symbols # (we generate even in Release mode, as this has no impact on final binary size.) DEBUG_FLAGS ?= -ggdb