8000 Merge pull request #9526 from tannewt/funhouse_startup · codetiger/circuitpython@830294e · GitHub
[go: up one dir, main page]

Skip to content

Commit 830294e

Browse files
authored
Merge pull request adafruit#9526 from tannewt/funhouse_startup
Update to IDF 5.3
2 parents 422eb7e + 5bd92c9 commit 830294e

File tree

56 files changed

+206
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+206
-186
lines changed

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
[submodule "ports/espressif/esp-idf"]
144144
path = ports/espressif/esp-idf
145145
url = https://github.com/adafruit/esp-idf.git
146-
branch = circuitpython-v5.2.2
146+
branch = circuitpython-v5.3
147147
[submodule "ports/espressif/esp-protocols"]
148148
path = ports/espressif/esp-protocols
149149
url = https://github.com/espressif/esp-protocols.git
@@ -354,8 +354,8 @@
354354
url = https://github.com/adafruit/certificates
355355
[submodule "lib/tlsf"]
356356
path = lib/tlsf
357-
url = https://github.com/adafruit/tlsf.git
358-
branch = circuitpython
357+
url = https://github.com/espressif/tlsf.git
358+
branch = idf
359359
[submodule "frozen/CircuitPython_AXP313A"]
360360
path = frozen/CircuitPython_AXP313A
361361
url = https://github.com/bill88t/CircuitPython_AXP313A

ports/broadcom/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ endif
122122

123123
all: $(BUILD)/firmware.kernel$(SUFFIX).img $(BUILD)/firmware.disk.img.zip
124124

125+
$(BUILD)/lib/tlsf/tlsf.o: CFLAGS += -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
126+
125127
%.o: %.c
126128
$(CC) $(CFLAGS) -c $< -o $@
127129

ports/espressif/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.16)
55
set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf)
66

77
# The component list here determines what options we get in menuconfig and what the ninja file can build.
8-
set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp-camera esp_lcd)
8+
set(COMPONENTS bt driver esp_driver_dac esp_driver_gpio esp_driver_gptimer esp_driver_i2s esp_driver_ledc esp_driver_pcnt esp_driver_rmt esp_driver_spi esp_driver_tsens esp_driver_uart esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp-camera esp_lcd vfs esp_vfs_console)
99
set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns" "esp-camera")
1010

1111
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

ports/espressif/Makefile

Lines changed: 126 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,7 @@ INC += \
6262
-isystem esp-idf/components/bt/host/nimble/nimble/porting/nimble/include \
6363
-isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \
6464
-isystem esp-idf/components/bt/host/nimble/port/include \
65-
-isystem esp-idf/components/driver/include \
66-
-isystem esp-idf/components/driver/deprecated \
67-
-isystem esp-idf/components/driver/dac/include \
68-
-isystem esp-idf/components/driver/gpio/include \
69-
-isystem esp-idf/components/driver/gptimer/include \
7065
-isystem esp-idf/components/driver/i2c/include \
71-
-isystem esp-idf/components/driver/i2s/include \
72-
-isystem esp-idf/components/driver/$(IDF_TARGET)/include \
73-
-isystem esp-idf/components/driver/ledc/include \
74-
-isystem esp-idf/components/driver/pcnt/include \
75-
-isystem esp-idf/components/driver/rmt/include \
76-
-isystem esp-idf/components/driver/spi/include \
77-
-isystem esp-idf/components/driver/temperature_sensor/include \
7866
-isystem esp-idf/components/driver/touch_sensor/include \
7967
-isystem esp-idf/components/driver/touch_sensor/$(IDF_TARGET)/include \
8068
-isystem esp-idf/components/driver/twai/include \
@@ -86,7 +74,21 @@ INC += \
8674
-isystem esp-idf/components/esp_app_format/include \
8775
-isystem esp-idf/components/esp_bootloader_format/include \
8876
-isystem esp-idf/components/esp_common/include \
77+
-isystem esp-idf/components/esp_driver_deprecated \
78+
-isystem esp-idf/components/esp_driver_dac/include \
79+
-isystem esp-idf/components/esp_driver_gpio/include \
80+
-isystem esp-idf/components/esp_driver_gptimer/include \
81+
-isystem esp-idf/components/esp_driver_i2c/include \
82+
-isystem esp-idf/components/esp_driver_i2s/include \
83+
-isystem esp-idf/components/esp_driver_$(IDF_TARGET)/include \
84+
-isystem esp-idf/components/esp_driver_ledc/include \
85+
-isystem esp-idf/components/esp_driver_pcnt/include \
86+
-isystem esp-idf/components/esp_driver_rmt/include \
87+
-isystem esp-idf/components/esp_driver_spi/include \
88+
-isystem esp-idf/components/esp_driver_tsens/include \
89+
-isystem esp-idf/components/esp_driver_uart/include \
8990
-isystem esp-idf/components/esp_event/include \
91+
-isystem esp-idf/components/esp_hw_support/dma/include \
9092
-isystem esp-idf/components/esp_hw_support/include \
9193
-isystem esp-idf/components/esp_hw_support/include/soc \
9294
-isystem esp-idf/components/esp_netif/include \
@@ -98,6 +100,7 @@ INC += \
98100
-isystem esp-idf/components/esp_system/include \
99101
-isystem esp-idf/components/esp_timer/include \
100102
-isystem esp-idf/components/esp_wifi/include \
103+
-isystem esp-idf/components/esp_wifi/include/local \
101104
-isystem esp-idf/components/freertos/config/include \
102105
-isystem esp-idf/components/freertos/config/include/freertos \
103106
-isystem esp-idf/components/freertos/config/$(IDF_TARGET_ARCH)/include \
@@ -146,6 +149,29 @@ CFLAGS += \
146149
# This define is in FreeRTOS as tskSTACK_FILL_BYTE 0xa5U which we expand out to a full word.
147150
CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5
148151

152+
# IDF 5.3 uses a new ESP_SYSTEM_INIT_FN macro to "register" functions to run on
153+
# init. They work by placing function pointers into a linker section that ends
154+
# up as a function pointer array. To ensure the linker includes these functions,
155+
# one must provide `-u` arguments to state the symbols are missing. This would
156+
# normally happen implicitly by another function calling to these.
157+
REGISTRATION_FUNCTIONS = \
158+
-u newlib_include_pthread_impl \
159+
-u ld_include_highint_hdl \
160+
-u __cxx_fatal_exception \
161+
-u esp_app_desc \
162+
-u esp_timer_init_include_func \
163+
-u uart_vfs_include_dev_init \
164+
-u esp_vfs_include_console_register \
165+
-u __ubsan_include \
166+
-u esp_system_include_startup_funcs \
167+
-u esp_efuse_startup_include_func \
168+
-u newlib_include_heap_impl \
169+
-u newlib_include_syscalls_impl \
170+
-u newlib_include_pthread_impl \
171+
-u newlib_include_assert_impl \
172+
-u newlib_include_getentropy_impl \
173+
-u newlib_include_init_funcs
174+
149175
#Debugging/Optimization
150176
ifeq ($(DEBUG), 1)
151177
CFLAGS += -ggdb
@@ -178,6 +204,8 @@ CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_D
178204
ifneq ($(IDF_TARGET),esp32c6)
179205
CFLAGS += --specs=nano.specs
180206
LDFLAGS += -T$(IDF_TARGET).rom.newlib-nano.ld
207+
else
208+
LDFLAGS += -T$(IDF_TARGET).rom.newlib-normal.ld
181209
endif
182210

183211
ifeq ($(IDF_TARGET_ARCH),xtensa)
@@ -187,11 +215,14 @@ ifeq ($(IDF_TARGET_ARCH),xtensa)
187215
CFLAGS += -mlongcalls -isystem esp-idf/components/xtensa/deprecated_include/ -Wno-error=cpp
188216
else ifeq ($(IDF_TARGET_ARCH),riscv)
189217
CFLAGS += -march=rv32imac_zicsr_zifencei
218+
LDFLAGS += \
219+
-Lesp-idf/components/riscv/ld \
220+
-Trom.api.ld
190221
endif
191222

192223
$(BUILD)/lib/tlsf/tlsf.o: CFLAGS += -Wno-cast-align
193224

194-
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
225+
LDFLAGS += $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
195226

196227
LDFLAGS += \
197228
-L$(BUILD)/esp-idf/esp-idf/esp_system/ld \
@@ -210,20 +241,37 @@ LDFLAGS += \
210241

211242
ifeq ($(IDF_TARGET),esp32)
212243
LDFLAGS += \
213-
-T$(IDF_TARGET).rom.newlib-data.ld \
214-
-T$(IDF_TARGET).rom.newlib-funcs.ld \
215-
-T$(IDF_TARGET).rom.spiflash.ld
244+
-Tesp32.rom.newlib-data.ld \
245+
-Tesp32.rom.newlib-funcs.ld \
246+
-Tesp32.rom.newlib-time.ld \
247+
-Tesp32.rom.spiflash_legacy.ld
248+
249+
CHIP_COMPONENTS = \
250+
esp_driver_dac
251+
216252
else ifeq ($(IDF_TARGET),esp32c2)
217253
LDFLAGS += \
218254
-Tesp32c2.rom.heap.ld \
219255
-Tesp32c2.rom.newlib.ld \
220-
-Tesp32c2.rom.version.ld
256+
-Tesp32c2.rom.version.ld \
257+
-Tesp32c2.rom.systimer.ld \
258+
-Tesp32c2.rom.wdt.ld
259+
221260
CFLAGS += -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ
261+
262+
CHIP_COMPONENTS = \
263+
esp_driver_tsens
264+
222265
else ifeq ($(IDF_TARGET),esp32c3)
223266
LDFLAGS += \
224267
-Tesp32c3.rom.newlib.ld \
268+
-Tesp32c3.rom.newlib-time.ld \
225269
-Tesp32c3.rom.version.ld \
226270
-Tesp32c3.rom.eco3.ld
271+
272+
CHIP_COMPONENTS = \
273+
esp_driver_tsens
274+
227275
else ifeq ($(IDF_TARGET),esp32c6)
228276
LDFLAGS += \
229277
-Tesp32c6.rom.phy.ld \
@@ -234,21 +282,43 @@ LDFLAGS += \
234282
-Tesp32c6.rom.heap.ld \
235283
-Tesp32c6.rom.systimer.ld \
236284
-Tesp32c6.rom.wdt.ld
285+
286+
287+
CHIP_COMPONENTS = \
288+
esp_driver_tsens
289+
237290
else ifeq ($(IDF_TARGET),esp32h2)
238291
LDFLAGS += \
239292
-Tesp32h2.rom.heap.ld \
240293
-Tesp32h2.rom.newlib.ld \
241294
-Tesp32h2.rom.systimer.ld \
242295
-Tesp32h2.rom.wdt.ld
296+
297+
CHIP_COMPONENTS = \
298+
esp_driver_tsens
299+
243300
else ifeq ($(IDF_TARGET),esp32s2)
244301
LDFLAGS += \
245-
-T$(IDF_TARGET).rom.newlib-data.ld \
246-
-T$(IDF_TARGET).rom.newlib-funcs.ld \
247-
-T$(IDF_TARGET).rom.spiflash.ld
302+
-Tesp32s2.rom.newlib-data.ld \
303+
-Tesp32s2.rom.newlib-funcs.ld \
304+
-Tesp32s2.rom.newlib-time.ld \
305+
-Tesp32s2.rom.spiflash_legacy.ld
306+
307+
CHIP_COMPONENTS = \
308+
esp_driver_dac \
309+
esp_driver_tsens
310+
248311
else ifeq ($(IDF_TARGET),esp32s3)
249312
LDFLAGS += \
250313
-Tesp32s3.rom.newlib.ld \
251-
-Tesp32s3.rom.version.ld
314+
-Tesp32s3.rom.newlib-time.ld \
315+
-Tesp32s3.rom.version.ld \
316+
-Tesp32s3.rom.systimer.ld \
317+
-Tesp32s3.rom.wdt.ld
318+
319+
CHIP_COMPONENTS = \
320+
esp_driver_tsens
321+
252322
endif
253323

254324
LIBS := -lgcc -lc -lstdc++
@@ -322,13 +392,19 @@ ifneq ($(CIRCUITPY_USB_DEVICE),0)
322392
SRC_C += lib/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c
323393
endif
324394

395+
ifneq ($(CIRCUITPY_AUDIOBUSIO),0)
396+
CHIP_COMPONENTS += esp_driver_i2s
397+
endif
398+
325399
ifneq ($(CIRCUITPY_BLEIO),0)
326400
SRC_C += common-hal/_bleio/ble_events.c
327401
endif
328402

329403
ifneq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),0)
330-
CFLAGS += -isystem esp-idf/components/esp_lcd/include
331-
CFLAGS += -isystem esp-idf/components/esp_lcd/interface
404+
CFLAGS += \
405+
-isystem esp-idf/components/esp_lcd/include \
406+
-isystem esp-idf/components/esp_lcd/interface \
407+
-isystem esp-idf/components/esp_lcd/rgb/include
332408
endif
333409

334410
ifneq ($(CIRCUITPY_ESPCAMERA),0)
@@ -361,6 +437,30 @@ SRC_ULP := \
361437
SRC_C += $(SRC_ULP)
362438
endif
363439

440+
ifneq ($(CIRCUITPY_NEOPIXEL_WRITE),0)
441+
CHIP_COMPONENTS += esp_driver_rmt
442+
endif
443+
444+
ifneq ($(CIRCUITPY_PARALLELDISPLAYBUS),0)
445+
CHIP_COMPONENTS += esp_driver_i2s
446+
endif
447+
448+
ifneq ($(CIRCUITPY_PULSEIO),0)
449+
CHIP_COMPONENTS += esp_driver_rmt
450+
endif
451+
452+
ifneq ($(CIRCUITPY_COUNTIO),0)
453+
CHIP_COMPONENTS += esp_driver_pcnt
454+
endif
455+
456+
ifneq ($(CIRCUITPY_ROTARYIO),0)
457+
CHIP_COMPONENTS += esp_driver_pcnt
458+
endif
459+
460+
ifneq ($(CIRCUITPY_FREQUENCYIO),0)
461+
CHIP_COMPONENTS += esp_driver_pcnt
462+
endif
463+
364464
SRC_COMMON_HAL_EXPANDED = \
365465
$(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
366466
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
@@ -490,7 +590,7 @@ ifeq ($(IDF_TARGET),esp32)
490590
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a
491591
endif
492592

493-
ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_mm esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer freertos hal heap log newlib nvs_flash pthread soc spi_flash vfs
593+
ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) $(CHIP_COMPONENTS) app_update bootloader_support driver esp_driver_gpio esp_driver_gptimer esp_driver_ledc esp_driver_spi esp_driver_uart efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_mm esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer freertos hal heap log newlib nvs_flash pthread soc spi_flash vfs esp_vfs_console
494594
ifneq ($(CIRCUITPY_WIFI),0)
495595
ESP_IDF_COMPONENTS_LINK += esp_coex esp_netif esp-tls esp_wifi lwip mbedtls mdns wpa_supplicant
496596
endif
@@ -507,7 +607,7 @@ ifneq ($(CIRCUITPY_BLEIO),0)
507607
ifeq ($(BLE_IMPL),esp32)
508608
# BLE will hang the ESP32 and trigger an interrupt watchdog without this undefined symbol at
509609
# link because a weak version of the interrupt that BLE uses will be linked incorrectly.
510-
LDFLAGS += -u ld_include_hli_vectors_bt
610+
REGISTRATION_FUNCTIONS += -u ld_include_hli_vectors_bt
511611
BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a
512612
endif
513613

@@ -619,7 +719,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
619719

620720
$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(IDF_CMAKE_TARGETS)
621721
$(STEPECHO) "LINK $@"
622-
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--print-memory-usage -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(LIBS) -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -u __cxx_fatal_exception -u esp_app_desc
722+
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--print-memory-usage -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(LIBS) -Wl,--end-group $(REGISTRATION_FUNCTIONS)
623723

624724
$(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py
625725
$(STEPECHO) "Create $@"

ports/espressif/boards/adafruit_feather_esp32_v2/board.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include "supervisor/board.h"
88
#include "mpconfigboard.h"
99
#include "shared-bindings/microcontroller/Pin.h"
10-
#include "components/driver/gpio/include/driver/gpio.h"
11-
#include "components/hal/include/hal/gpio_hal.h"
10+
#include "driver/gpio.h"
1211
#include "common-hal/microcontroller/Pin.h"
1312

1413
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {

ports/espressif/boards/adafruit_feather_esp32c6_4mbflash_nopsram/board.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#include "supervisor/board.h"
88
#include "mpconfigboard.h"
99
#include "shared-bindings/microcontroller/Pin.h"
10-
#include "components/driver/gpio/include/driver/gpio.h"
11-
#include "components/hal/include/hal/gpio_hal.h"
12-
#include "common-hal/microcontroller/Pin.h"
10+
#include "driver/gpio.h"
1311

1412
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
1513
if (pin_number == 20) {

ports/espressif/boards/adafruit_feather_esp32s2/board.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#include "supervisor/board.h"
88
#include "mpconfigboard.h"
99
#include "shared-bindings/microcontroller/Pin.h"
10-
#include "components/driver/gpio/include/driver/gpio.h"
11-
#include "components/hal/include/hal/gpio_hal.h"
12-
#include "common-hal/microcontroller/Pin.h"
10+
#include "driver/gpio.h"
1311

1412
void board_init(void) {
1513
reset_board();

ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#include "supervisor/board.h"
88
#include "mpconfigboard.h"
99
#include "shared-bindings/microcontroller/Pin.h"
10-
#include "components/driver/gpio/include/driver/gpio.h"
11-
#include "components/hal/include/hal/gpio_hal.h"
12-
#include "common-hal/microcontroller/Pin.h"
10+
#include "driver/gpio.h"
1311

1412
void board_init(void) {
1513
reset_board();

ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#include "supervisor/board.h"
88
#include "mpconfigboard.h"
99
#include "shared-bindings/microcontroller/Pin.h"
10-
#include "components/driver/gpio/include/driver/gpio.h"
11-
#include "components/hal/include/hal/gpio_hal.h"
12-
#include "common-hal/microcontroller/Pin.h"
10+
#include "driver/gpio.h"
1311

1412
void board_init(void) {
1513
reset_board();

ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m
1010
CIRCUITPY_ESP_FLASH_SIZE = 4MB
1111

1212
CIRCUITPY_ESPCAMERA = 0
13+
CIRCUITPY_MAX3421E = 0
14+
CIRCUITPY_PS2IO = 0
15+
CIRCUITPY_SDCARDIO = 0
16+
CIRCUITPY_EPAPERDISPLAY = 0
17+
CIRCUITPY_PARALLELDISPLAYBUS = 0
18+
CIRCUITPY_RGBMATRIX = 0
19+
CIRCUITPY_SHARPDISPLAY = 0
20+
CIRCUITPY_FRAMEBUFFERIO = 0
1321

1422
# Include these Python libraries in firmware.
1523
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel

ports/espressif/boards/adafruit_itsybitsy_esp32/board.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#include "supervisor/board.h"
88
#include "mpconfigboard.h"
99
#include "shared-bindings/microcontroller/Pin.h"
10-
#include "components/driver/gpio/include/driver/gpio.h"
11-
#include "components/hal/include/hal/gpio_hal.h"
12-
#include "common-hal/microcontroller/Pin.h"
10+
#include "driver/gpio.h"
1311

1412
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
1513
if (pin_number == 2) {

0 commit comments

Comments
 (0)
0