From f703acd34464b2ca3e27c16bd3540b55f54d5393 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Sun, 18 Sep 2016 12:10:01 +0800 Subject: [PATCH] Adding -fstrict-volatile-bitfields to the CFLAGS/CXXFLAGS. Without this, gcc tries to access bitfields using the smallest possible methods (eg l8i to grab an 8-bit field from a 32-bit). Our hardware does not like that. This flag tells gcc that if a bitfield is volatile, it should always use the type the field is defined at (uint32_t in our case) to size its access to the field. This fixes accessing the hardware through the xxx_struct.h headers. --- make/project.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/make/project.mk b/make/project.mk index b86470bf62..35dccaf248 100644 --- a/make/project.mk +++ b/make/project.mk @@ -158,13 +158,14 @@ LDFLAGS ?= -nostdlib \ # files, set CFLAGS += in your component's Makefile.projbuild # CPPFLAGS used by an compile pass that uses the C preprocessor -CPPFLAGS = -DESP_PLATFORM -Og -g3 -Wpointer-arith -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wall -ffunction-sections -fdata-sections -mlongcalls -nostdlib -MMD -MP +CPPFLAGS = -DESP_PLATFORM -Og -g3 -Wpointer-arith -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable \ + -Wno-error=unused-variable -Wall -ffunction-sections -fdata-sections -mlongcalls -nostdlib -MMD -MP # C flags use by C only -CFLAGS = $(CPPFLAGS) -std=gnu99 -g3 -fno-inline-functions +CFLAGS = $(CPPFLAGS) -std=gnu99 -g3 -fstrict-volatile-bitfields # CXXFLAGS uses by C++ only -CXXFLAGS = $(CPPFLAGS) -Og -std=gnu++11 -g3 -fno-exceptions +CXXFLAGS = $(CPPFLAGS) -Og -std=gnu++11 -g3 -fno-exceptions -fstrict-volatile-bitfields export CFLAGS CPPFLAGS CXXFLAGS