Add option for memory barriers everywhere

This commit is contained in:
Jeroen Domburg 2017-03-27 15:01:30 +08:00
parent 58e8763874
commit 4fd173c8c3
2 changed files with 11 additions and 0 deletions

View file

@ -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 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 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 config SPIRAM_CACHE_WORKAROUND_TEST
bool "Debug: Test workaround by generating a lot of interrupts" bool "Debug: Test workaround by generating a lot of interrupts"
default "n" default "n"

View file

@ -244,6 +244,10 @@ ifeq ("$(CONFIG_SPIRAM_CACHE_WORKAROUND)", "y")
COMMON_FLAGS+=-mfix-esp32-psram-cache-issue COMMON_FLAGS+=-mfix-esp32-psram-cache-issue
endif endif
ifeq ("$(CONFIG_SPIRAM_CACHE_ALWAYS_MEMBARRIER)", "y")
COMMON_FLAGS+=-malways-memw
endif
# Enable generation of debugging symbols # Enable generation of debugging symbols
# (we generate even in Release mode, as this has no impact on final binary size.) # (we generate even in Release mode, as this has no impact on final binary size.)
DEBUG_FLAGS ?= -ggdb DEBUG_FLAGS ?= -ggdb