Skip to content

Commit 17aa9a2

Browse files
committed
esp32/Makefile: Separate ESP-specific inc dirs to avoid header clashes.
1 parent 45e4115 commit 17aa9a2

File tree

1 file changed

+40
-36
lines changed

1 file changed

+40
-36
lines changed

esp32/Makefile

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,45 +49,47 @@ INC += -I../lib/mp-readline
4949
INC += -I../lib/netutils
5050
INC += -I../lib/timeutils
5151
INC += -I$(BUILD)
52-
INC += -I$(ESPCOMP)/bootloader_support/include
53-
INC += -I$(ESPCOMP)/driver/include
54-
INC += -I$(ESPCOMP)/driver/include/driver
55-
INC += -I$(ESPCOMP)/nghttp/port/include
56-
INC += -I$(ESPCOMP)/nghttp/nghttp2/lib/includes
57-
INC += -I$(ESPCOMP)/esp32/include
58-
INC += -I$(ESPCOMP)/soc/include
59-
INC += -I$(ESPCOMP)/soc/esp32/include
60-
INC += -I$(ESPCOMP)/ethernet/include
61-
INC += -I$(ESPCOMP)/expat/include/expat
62-
INC += -I$(ESPCOMP)/expat/port/include
63-
INC += -I$(ESPCOMP)/heap/include
64-
INC += -I$(ESPCOMP)/json/include
65-
INC += -I$(ESPCOMP)/json/port/include
66-
INC += -I$(ESPCOMP)/log/include
67-
INC += -I$(ESPCOMP)/newlib/include
68-
INC += -I$(ESPCOMP)/nvs_flash/include
69-
INC += -I$(ESPCOMP)/freertos/include
70-
INC += -I$(ESPCOMP)/tcpip_adapter/include
71-
INC += -I$(ESPCOMP)/lwip/include/lwip
72-
INC += -I$(ESPCOMP)/lwip/include/lwip/port
73-
INC += -I$(ESPCOMP)/lwip/include/lwip/posix
74-
INC += -I$(ESPCOMP)/mbedtls/include
75-
INC += -I$(ESPCOMP)/mbedtls/port/include
76-
INC += -I$(ESPCOMP)/spi_flash/include
77-
INC += -I$(ESPCOMP)/vfs/include
78-
INC += -I$(ESPCOMP)/newlib/platform_include
79-
INC += -I$(ESPCOMP)/xtensa-debug-module/include
80-
INC += -I$(ESPCOMP)/wpa_supplicant/include
81-
INC += -I$(ESPCOMP)/wpa_supplicant/port/include
82-
INC += -I$(ESPCOMP)/ethernet/include
83-
INC += -I$(ESPCOMP)/app_trace/include
84-
85-
CFLAGS = -std=gnu99 -Os -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H -DESP_PLATFORM $(INC)
52+
53+
INC_ESPCOMP += -I$(ESPCOMP)/bootloader_support/include
54+
INC_ESPCOMP += -I$(ESPCOMP)/driver/include
55+
INC_ESPCOMP += -I$(ESPCOMP)/driver/include/driver
56+
INC_ESPCOMP += -I$(ESPCOMP)/nghttp/port/include
57+
INC_ESPCOMP += -I$(ESPCOMP)/nghttp/nghttp2/lib/includes
58+
INC_ESPCOMP += -I$(ESPCOMP)/esp32/include
59+
INC_ESPCOMP += -I$(ESPCOMP)/soc/include
60+
INC_ESPCOMP += -I$(ESPCOMP)/soc/esp32/include
61+
INC_ESPCOMP += -I$(ESPCOMP)/ethernet/include
62+
INC_ESPCOMP += -I$(ESPCOMP)/expat/include/expat
63+
INC_ESPCOMP += -I$(ESPCOMP)/expat/port/include
64+
INC_ESPCOMP += -I$(ESPCOMP)/heap/include
65+
INC_ESPCOMP += -I$(ESPCOMP)/json/include
66+
INC_ESPCOMP += -I$(ESPCOMP)/json/port/include
67+
INC_ESPCOMP += -I$(ESPCOMP)/log/include
68+
INC_ESPCOMP += -I$(ESPCOMP)/newlib/include
69+
INC_ESPCOMP += -I$(ESPCOMP)/nvs_flash/include
70+
INC_ESPCOMP += -I$(ESPCOMP)/freertos/include
71+
INC_ESPCOMP += -I$(ESPCOMP)/tcpip_adapter/include
72+
INC_ESPCOMP += -I$(ESPCOMP)/lwip/include/lwip
73+
INC_ESPCOMP += -I$(ESPCOMP)/lwip/include/lwip/port
74+
INC_ESPCOMP += -I$(ESPCOMP)/lwip/include/lwip/posix
75+
INC_ESPCOMP += -I$(ESPCOMP)/mbedtls/include
76+
INC_ESPCOMP += -I$(ESPCOMP)/mbedtls/port/include
77+
INC_ESPCOMP += -I$(ESPCOMP)/spi_flash/include
78+
INC_ESPCOMP += -I$(ESPCOMP)/vfs/include
79+
INC_ESPCOMP += -I$(ESPCOMP)/newlib/platform_include
80+
INC_ESPCOMP += -I$(ESPCOMP)/xtensa-debug-module/include
81+
INC_ESPCOMP += -I$(ESPCOMP)/wpa_supplicant/include
82+
INC_ESPCOMP += -I$(ESPCOMP)/wpa_supplicant/port/include
83+
INC_ESPCOMP += -I$(ESPCOMP)/ethernet/include
84+
INC_ESPCOMP += -I$(ESPCOMP)/app_trace/include
85+
86+
CFLAGS_BASE = -std=gnu99 -Os -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H -DESP_PLATFORM
87+
CFLAGS = $(CFLAGS_BASE) $(INC) $(INC_ESPCOMP)
8688
CFLAGS += -DIDF_VER=\"$(IDF_VER)\"
8789
CFLAGS += $(CFLAGS_MOD)
8890

8991
# this is what ESPIDF uses for c++ compilation
90-
CXXFLAGS = -std=gnu++11 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -DESP_PLATFORM $(INC)
92+
CXXFLAGS = -std=gnu++11 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wall -Werror -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -DESP_PLATFORM $(INC) $(INC_ESPCOMP)
9193

9294
LDFLAGS = -nostdlib -Map=$(@:.elf=.map) --cref
9395
LDFLAGS += --gc-sections -static -EL
@@ -274,12 +276,14 @@ ESPIDF_EXPAT_O = $(addprefix $(ESPCOMP)/expat/,\
274276

275277
# Assembler .S files need only basic flags, and in particular should not have
276278
# -Os because that generates subtly different code.
279+
# We also need custom CFLAGS for .c files because FreeRTOS has headers with
280+
# generic names (eg queue.h) which can clash with other files in the port.
277281
CFLAGS_ASM = -I$(ESPCOMP)/esp32/include -I$(ESPCOMP)/soc/esp32/include -I$(ESPCOMP)/freertos/include/freertos -I.
278282
$(BUILD)/$(ESPCOMP)/freertos/portasm.o: CFLAGS = $(CFLAGS_ASM)
279283
$(BUILD)/$(ESPCOMP)/freertos/xtensa_context.o: CFLAGS = $(CFLAGS_ASM)
280284
$(BUILD)/$(ESPCOMP)/freertos/xtensa_intr_asm.o: CFLAGS = $(CFLAGS_ASM)
281285
$(BUILD)/$(ESPCOMP)/freertos/xtensa_vectors.o: CFLAGS = $(CFLAGS_ASM)
282-
$(BUILD)/$(ESPCOMP)/freertos/%.o: CFLAGS += -I$(ESPCOMP)/freertos/include/freertos
286+
$(BUILD)/$(ESPCOMP)/freertos/%.o: CFLAGS = $(CFLAGS_BASE) -I. $(INC_ESPCOMP) -I$(ESPCOMP)/freertos/include/freertos
283287
ESPIDF_FREERTOS_O = $(addprefix $(ESPCOMP)/freertos/,\
284288
croutine.o \
285289
event_groups.o \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy