@@ -59,76 +59,81 @@ include $(TOP)/supervisor/supervisor.mk
59
59
# Include make rules and variables common across CircuitPython builds.
60
60
include $(TOP ) /py/circuitpy_defns.mk
61
61
62
- ifeq ($(IDF_TARGET ) ,esp32s2)
63
- IDF_TARGET_ARCH = xtensa
64
- CROSS_COMPILE = xtensa-$(IDF_TARGET ) -elf-
65
- else ifeq ($(IDF_TARGET),esp32c3)
62
+ ifeq ($(IDF_TARGET ) ,esp32c3)
66
63
IDF_TARGET_ARCH = riscv
67
64
CROSS_COMPILE = riscv32-esp-elf-
65
+ else
66
+ IDF_TARGET_ARCH = xtensa
67
+ CROSS_COMPILE = xtensa-$(IDF_TARGET ) -elf-
68
68
endif
69
69
70
70
# ######################################
71
71
# CFLAGS
72
72
# ######################################
73
73
74
- INC += -I.\
75
- -I./boards \
76
- -I./boards/$(BOARD ) \
77
- -I./peripherals \
78
- -I../.. \
79
- -I../../lib/mp-readline \
80
- -I../../lib/tinyusb/src \
81
- -I../../supervisor/shared/usb \
82
- -I$(BUILD ) \
83
- -I$(BUILD ) /genhdr \
84
- -I$(BUILD ) /esp-idf/config \
85
- -isystem esp-idf \
86
- -isystem esp-idf/components/app_update/include \
87
- -isystem esp-idf/components/bootloader_support/include \
88
- -isystem esp-idf/components/driver/include \
89
- -isystem esp-idf/components/driver/$(IDF_TARGET ) /include \
90
- -isystem esp-idf/components/$(IDF_TARGET ) /include \
91
- -isystem esp-idf/components/esp_adc_cal/include \
92
- -isystem esp-idf/components/esp_common/include \
93
- -isystem esp-idf/components/esp_event/include \
94
- -isystem esp-idf/components/esp_hw_support/include \
95
- -isystem esp-idf/components/esp_netif/include \
96
- -isystem esp-idf/components/esp_pm/include \
97
- -isystem esp-idf/components/esp_ringbuf/include \
98
- -isystem esp-idf/components/esp_rom/include \
99
- -isystem esp-idf/components/esp_system/include \
100
- -isystem esp-idf/components/esp_timer/include \
101
- -isystem esp-idf/components/esp_wifi/include \
102
- -isystem esp-idf/components/freertos/include \
103
- -isystem esp-idf/components/freertos/include/freertos \
104
- -isystem esp-idf/components/freertos/port/$(IDF_TARGET_ARCH ) /include \
105
- -isystem esp-idf/components/hal/include \
106
- -isystem esp-idf/components/hal/$(IDF_TARGET ) /include \
107
- -isystem esp-idf/components/hal/platform_port/include \
108
- -isystem esp-idf/components/heap/include \
109
- -isystem esp-idf/components/log/include \
110
- -isystem esp-idf/components/lwip/include \
111
- -isystem esp-idf/components/lwip/lwip/src/include \
112
- -isystem esp-idf/components/lwip/port/esp32/include \
113
- -isystem esp-idf/components/mbedtls/esp_crt_bundle/include \
114
- -isystem esp-idf/components/mbedtls/mbedtls/include \
115
- -isystem esp-idf/components/mbedtls/port/include \
116
- -isystem esp-idf/components/newlib/platform_include \
117
- -isystem esp-idf/components/nvs_flash/include \
118
- -isystem esp-idf/components/soc/include \
119
- -isystem esp-idf/components/soc/$(IDF_TARGET ) /include \
120
- -isystem esp-idf/components/spi_flash/include \
121
- -isystem esp-idf/components/$(IDF_TARGET_ARCH ) /include \
122
- -isystem esp-idf/components/$(IDF_TARGET_ARCH ) /$(IDF_TARGET ) /include
74
+ INC += \
75
+ -I.\
76
+ -I./boards \
77
+ -I./boards/$(BOARD ) \
78
+ -I./peripherals \
79
+ -I../.. \
80
+ -I../../lib/mp-readline \
81
+ -I../../lib/tinyusb/src \
82
+ -I../../supervisor/shared/usb \
83
+ -I$(BUILD ) \
84
+ -I$(BUILD ) /genhdr \
85
+ -I$(BUILD ) /esp-idf/config \
86
+ -isystem esp-idf \
87
+ -isystem esp-idf/components/app_update/include \
88
+ -isystem esp-idf/components/bootloader_support/include \
89
+ -isystem esp-idf/components/driver/include \
90
+ -isystem esp-idf/components/driver/$(IDF_TARGET ) /include \
91
+ -isystem esp-idf/components/$(IDF_TARGET ) /include \
92
+ -isystem esp-idf/components/esp_adc_cal/include \
93
+ -isystem esp-idf/components/esp_common/include \
94
+ -isystem esp-idf/components/esp_event/include \
95
+ -isystem esp-idf/components/esp_hw_support/include \
96
+ -isystem esp-idf/components/esp_hw_support/include/soc \
97
+ -isystem esp-idf/components/esp_netif/include \
98
+ -isystem esp-idf/components/esp_pm/include \
99
+ -isystem esp-idf/components/esp_ringbuf/include \
100
+ -isystem esp-idf/components/esp_rom/include \
101
+ -isystem esp-idf/components/esp_system/include \
102
+ -isystem esp-idf/components/esp_timer/include \
103
+ -isystem esp-idf/components/esp_wifi/include \
104
+ -isystem esp-idf/components/freertos/include \
105
+ -isystem esp-idf/components/freertos/include/freertos \
106
+ -isystem esp-idf/components/freertos/include/esp_additions \
107
+ -isystem esp-idf/components/freertos/include/esp_additions/freertos \
108
+ -isystem esp-idf/components/freertos/port/$(IDF_TARGET_ARCH ) /include \
109
+ -isystem esp-idf/components/hal/include \
110
+ -isystem esp-idf/components/hal/$(IDF_TARGET ) /include \
111
+ -isystem esp-idf/components/hal/platform_port/include \
112
+ -isystem esp-idf/components/heap/include \
113
+ -isystem esp-idf/components/log/include \
114
+ -isystem esp-idf/components/lwip/include \
115
+ -isystem esp-idf/components/lwip/lwip/src/include \
116
+ -isystem esp-idf/components/lwip/port/esp32/include \
117
+ -isystem esp-idf/components/mbedtls/esp_crt_bundle/include \
118
+ -isystem esp-idf/components/mbedtls/mbedtls/include \
119
+ -isystem esp-idf/components/mbedtls/port/include \
120
+ -isystem esp-idf/components/newlib/platform_include \
121
+ -isystem esp-idf/components/nvs_flash/include \
122
+ -isystem esp-idf/components/soc/include \
123
+ -isystem esp-idf/components/soc/$(IDF_TARGET ) /include \
124
+ -isystem esp-idf/components/spi_flash/include \
125
+ -isystem esp-idf/components/$(IDF_TARGET_ARCH ) /include \
126
+ -isystem esp-idf/components/$(IDF_TARGET_ARCH ) /$(IDF_TARGET ) /include
123
127
124
128
# See https://github.com/espressif/esp-idf/issues/6906
125
129
ifeq ($(IDF_TARGET ) ,esp32c3)
126
130
CFLAGS += -include "esp32c3_fix.h"
127
131
endif
128
132
129
- CFLAGS += -DHAVE_CONFIG_H \
130
- -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" \
131
- -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX
133
+ CFLAGS += \
134
+ -DHAVE_CONFIG_H \
135
+ -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" \
136
+ -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX
132
137
133
138
# Make our canary value match FreeRTOS's
134
139
# This define is in FreeRTOS as tskSTACK_FILL_BYTE 0xa5U which we expand out to a full word.
@@ -158,33 +163,38 @@ endif
158
163
159
164
LDFLAGS = $(CFLAGS ) -Wl,-nostdlib -Wl,-Map=$@ .map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
160
165
161
- LDFLAGS += -L$(BUILD ) /esp-idf/esp-idf/$(IDF_TARGET ) \
162
- -L$(BUILD ) /esp-idf/esp-idf/$(IDF_TARGET ) /ld \
163
- -Lesp-idf/components/$(IDF_TARGET ) /ld \
164
- -Lesp-idf/components/esp_rom/$(IDF_TARGET ) /ld \
165
- -T$(IDF_TARGET ) _out.ld \
166
- -T$(IDF_TARGET ) .project.ld \
167
- -T$(IDF_TARGET ) .peripherals.ld \
168
- -T$(IDF_TARGET ) .rom.ld \
169
- -T$(IDF_TARGET ) .rom.api.ld \
170
- -T$(IDF_TARGET ) .rom.libgcc.ld \
171
- -T$(IDF_TARGET ) .rom.newlib-nano.ld
166
+ LDFLAGS += \
167
+ -L$(BUILD ) /esp-idf/esp-idf/esp_system/ld \
168
+ -Lesp-idf/components/esp_rom/$(IDF_TARGET ) /ld \
169
+ -Lesp-idf/components/soc/$(IDF_TARGET ) /ld \
170
+ -Tmemory.ld \
171
+ -Tsections.ld \
172
+ -T$(IDF_TARGET ) .peripherals.ld \
173
+ -T$(IDF_TARGET ) .rom.ld \
174
+ -T$(IDF_TARGET ) .rom.api.ld \
175
+ -T$(IDF_TARGET ) .rom.libgcc.ld \
176
+ -T$(IDF_TARGET ) .rom.newlib-nano.ld \
177
+ -Wl,-Bstatic \
178
+ -Wl,--no-warn-mismatch \
179
+ -Wl,--build-id=none \
180
+ -fno-rtti
172
181
173
182
ifeq ($(IDF_TARGET ) ,esp32c3)
174
- LDFLAGS += -Tesp32c3.rom.newlib.ld \
175
- -Tesp32c3.rom.version.ld \
176
- -Tesp32c3.rom.eco3.ld
177
- else
178
- LDFLAGS += -T$(IDF_TARGET ) .rom.newlib-data.ld \
179
- -T$(IDF_TARGET ) .rom.newlib-funcs.ld \
180
- -T$(IDF_TARGET ) .rom.spiflash.ld
183
+ LDFLAGS += \
184
+ -Tesp32c3.rom.newlib.ld \
185
+ -Tesp32c3.rom.version.ld \
186
+ -Tesp32c3.rom.eco3.ld
187
+ else ifeq ($(IDF_TARGET),esp32s2)
188
+ LDFLAGS += \
189
+ -T$(IDF_TARGET ) .rom.newlib-data.ld \
190
+ -T$(IDF_TARGET ) .rom.newlib-funcs.ld \
191
+ -T$(IDF_TARGET ) .rom.spiflash.ld
192
+ else ifeq ($(IDF_TARGET),esp32s3)
193
+ LDFLAGS += \
194
+ -Tesp32s3.rom.newlib.ld \
195
+ -Tesp32s3.rom.version.ld
181
196
endif
182
197
183
- LDFLAGS += -Wl,-Bstatic \
184
- -Wl,--no-warn-mismatch \
185
- -Wl,--build-id=none \
186
- -fno-rtti
187
-
188
198
LIBS := -lgcc -lc -lstdc++
189
199
190
200
# Use toolchain libm if we're not using our own.
@@ -226,10 +236,13 @@ SRC_C += \
226
236
227
237
ifneq ($(IDF_TARGET ) ,esp32c3)
228
238
SRC_C += \
229
- cam.c \
230
- i2s_lcd_esp32s2_driver.c \
231
239
peripherals/pcnt.c \
232
240
peripherals/touch.c
241
+ ifeq ($(IDF_TARGET ) ,esp32s2)
242
+ SRC_C += \
243
+ cam.c \
244
+ i2s_lcd_esp32s2_driver.c
245
+ endif
233
246
endif
234
247
235
248
$(BUILD ) /i2s_lcd_esp32s2_driver.o : CFLAGS += -Wno-sign-compare
@@ -238,16 +251,15 @@ ifneq ($(CIRCUITPY_USB),0)
238
251
SRC_C += lib/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c
239
252
endif
240
253
241
- SRC_S =
242
-
243
- SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL ) ) \
244
- $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS ) ) \
245
- $(addprefix common-hal/, $(SRC_COMMON_HAL ) )
246
-
247
- SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE ) ) \
248
- $(addprefix shared-module/, $(SRC_SHARED_MODULE ) ) \
249
- $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL ) )
254
+ SRC_COMMON_HAL_EXPANDED = \
255
+ $(addprefix shared-bindings/, $(SRC_COMMON_HAL ) ) \
256
+ $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS ) ) \
257
+ $(addprefix common-hal/, $(SRC_COMMON_HAL ) )
250
258
259
+ SRC_SHARED_MODULE_EXPANDED = \
260
+ $(addprefix shared-bindings/, $(SRC_SHARED_MODULE ) ) \
261
+ $(addprefix shared-module/, $(SRC_SHARED_MODULE ) ) \
262
+ $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL ) )
251
263
252
264
ifneq ($(FROZEN_MPY_DIR ) ,)
253
265
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR ) -type f -name '* .py')
@@ -261,7 +273,6 @@ ifeq ($(INTERNAL_LIBM),1)
261
273
OBJ += $(addprefix $(BUILD ) /, $(SRC_LIBM:.c=.o ) )
262
274
endif
263
275
OBJ += $(addprefix $(BUILD ) /, $(SRC_CIRCUITPY_COMMON:.c=.o ) )
264
- OBJ += $(addprefix $(BUILD ) /, $(SRC_S:.S=.o ) )
265
276
OBJ += $(addprefix $(BUILD ) /, $(SRC_MOD:.c=.o ) )
266
277
267
278
$(BUILD ) /$(FATFS_DIR ) /ff.o : COPT += -Os
@@ -271,8 +282,6 @@ $(BUILD)/lib/protomatter/src/core.o: CFLAGS += -DESP32
271
282
272
283
# List of sources for qstr extraction
273
284
SRC_QSTR += $(SRC_C ) $(SRC_SUPERVISOR ) $(SRC_MOD ) $(SRC_COMMON_HAL_EXPANDED ) $(SRC_SHARED_MODULE_EXPANDED )
274
- # Sources that only hold QSTRs after pre-processing.
275
- SRC_QSTR_PREPROCESSOR +=
276
285
277
286
# IDF build commands
278
287
IDF_PATH = $(realpath ./esp-idf)
@@ -315,40 +324,36 @@ menuconfig: $(BUILD)/esp-idf/config
315
324
# qstr builds include headers so we need to make sure they are up to date
316
325
$(HEADER_BUILD ) /qstr.split : | $(BUILD ) /esp-idf/config/sdkconfig.h
317
326
318
- ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET ) $(IDF_TARGET_ARCH ) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_netif esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
327
+ BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a
328
+ BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET ) /libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET ) /, $(BINARY_WIFI_BLOBS ) )
319
329
330
+ ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH ) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
320
331
ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK ) , $(BUILD ) /esp-idf/esp-idf/$(component ) /lib$(component ) .a)
321
- ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENTS_LINK ) , $(BUILD ) /esp-idf/esp-idf/$(component ) /lib$(component ) .a)
322
332
323
333
MBEDTLS_COMPONENTS_LINK = crypto tls x509
324
334
MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK ) , $(BUILD ) /esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component ) .a)
325
335
326
- BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libphy.a
327
- ifneq ($(IDF_TARGET ) ,esp32c3)
328
- BINARY_WIFI_BLOBS += librtc.a
329
- endif
330
- BINARY_BLOBS = $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET ) /, $(BINARY_WIFI_BLOBS ) )
331
-
332
336
ifeq ($(IDF_TARGET_ARCH ) ,xtensa)
333
337
BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET ) /libxt_hal.a
334
338
ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET ) /libxt_hal.a
335
339
endif
336
340
337
- ifeq ($(IDF_TARGET ) , esp32c3)
338
- ESPTOOL_BAUDRATE = 230400
339
- BOOTLOADER_OFFSET = 0x0000
341
+ ifeq ($(IDF_TARGET ) ,esp32c3)
342
+ BOOTLOADER_OFFSET = 0x0
343
+ else ifeq ($(IDF_TARGET),esp32s3)
344
+ BOOTLOADER_OFFSET = 0x0
340
345
else
341
- ESPTOOL_BAUDRATE = 460800
342
346
BOOTLOADER_OFFSET = 0x1000
343
347
endif
348
+
344
349
PARTITION_TABLE_OFFSET = 0x8000
345
350
FIRMWARE_OFFSET = 0x10000
346
351
347
352
ESP_AUTOGEN_LD = $(BUILD ) /esp-idf/esp-idf/$(IDF_TARGET ) /$(IDF_TARGET ) _out.ld $(BUILD ) /esp-idf/esp-idf/$(IDF_TARGET ) /ld/$(IDF_TARGET ) .project.ld
348
353
349
354
FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE ) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE )
350
355
351
- ESPTOOL_FLAGS ?= -b $( ESPTOOL_BAUDRATE ) - -before=default_reset --after=no_reset
356
+ ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset
352
357
353
358
ifeq ($(IDF_TARGET ) ,esp32c3)
354
359
all : $(BUILD ) /firmware.bin
@@ -360,17 +365,18 @@ endif
360
365
esp-idf-stamp : $(BUILD ) /esp-idf/config/sdkconfig.h
361
366
$(Q ) ninja -C $(BUILD ) /esp-idf \
362
367
bootloader/bootloader.bin \
368
+ esp-idf/esp_system/__ldgen_output_sections.ld \
363
369
esp-idf/app_update/libapp_update.a \
364
370
esp-idf/bootloader_support/libbootloader_support.a \
365
371
esp-idf/driver/libdriver.a \
366
372
esp-idf/efuse/libefuse.a \
367
- esp-idf/$(IDF_TARGET ) /lib$(IDF_TARGET ) .a \
368
- esp-idf/$(IDF_TARGET ) /ld/$(IDF_TARGET ) .project.ld \
369
373
esp-idf/esp_adc_cal/libesp_adc_cal.a \
370
374
esp-idf/esp_common/libesp_common.a \
371
375
esp-idf/esp_event/libesp_event.a \
372
376
esp-idf/esp_hw_support/libesp_hw_support.a \
377
+ esp-idf/esp_ipc/libesp_ipc.a \
373
378
esp-idf/esp_netif/libesp_netif.a \
379
+ esp-idf/esp_phy/libesp_phy.a \
374
380
esp-idf/esp_pm/libesp_pm.a \
375
381
esp-idf/esp_ringbuf/libesp_ringbuf.a \
376
382
esp-idf/esp_rom/libesp_rom.a \
0 commit comments