From 7b016b81da69800321d7087f10d2382147cd72a9 Mon Sep 17 00:00:00 2001 From: Almir Okato Date: Wed, 3 Jul 2024 18:46:04 +0200 Subject: [PATCH] esp32[s2|s3]: add volatile bitfields compilation flag This compilation flag was added in the same way as done for esp32 in order to avoid unexpected behaviors when accessing registers using struct bitfields. Signed-off-by: Almir Okato --- arch/xtensa/src/esp32s2/Make.defs | 4 ++++ arch/xtensa/src/esp32s3/Make.defs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/xtensa/src/esp32s2/Make.defs b/arch/xtensa/src/esp32s2/Make.defs index 091f950f6c595..3377ac2f26668 100644 --- a/arch/xtensa/src/esp32s2/Make.defs +++ b/arch/xtensa/src/esp32s2/Make.defs @@ -168,6 +168,10 @@ chip/$(ESP_HAL_3RDPARTY_REPO): CFLAGS += -Wno-undef -Wno-unused-variable +# Enable strict volatile bitfield access + +CFLAGS += -fstrict-volatile-bitfields + CHIP_SERIES = $(patsubst "%",%,$(CONFIG_ESPRESSIF_CHIP_SERIES)) include chip/hal.mk diff --git a/arch/xtensa/src/esp32s3/Make.defs b/arch/xtensa/src/esp32s3/Make.defs index 2e87e8af2f1f0..8b56fecfad762 100644 --- a/arch/xtensa/src/esp32s3/Make.defs +++ b/arch/xtensa/src/esp32s3/Make.defs @@ -230,6 +230,10 @@ chip/$(ESP_HAL_3RDPARTY_REPO): CFLAGS += -Wno-undef -Wno-unused-variable CFLAGS += ${DEFINE_PREFIX}_RETARGETABLE_LOCKING +# Enable strict volatile bitfield access + +CFLAGS += -fstrict-volatile-bitfields + AFLAGS += $(CFLAGS) # Files that require the HAL recipe