diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index 4beb14a885a0..c47288ce9744 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -203,6 +203,16 @@ endif ifneq (,$(filter esp_spi_ram,$(USEMODULE))) INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_psram/include + ifeq (esp32,$(CPU_FAM)) + # Workaround for the SPI RAM cache bug of ESP32 revisions < 3 + # (CONFIG_SPIRAM_CACHE_WORKAROUND): The compiler avoids the vulnerable + # instruction sequences, and the linker uses the multilib variants of + # libc and libgcc that are compiled with this workaround. + PSRAM_WORKAROUND_FLAGS = -mfix-esp32-psram-cache-issue + PSRAM_WORKAROUND_FLAGS += -mfix-esp32-psram-cache-strategy=memw + CFLAGS += $(PSRAM_WORKAROUND_FLAGS) + LINKFLAGS += $(PSRAM_WORKAROUND_FLAGS) + endif endif ifneq (,$(filter esp_idf_lcd,$(USEMODULE)))