diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 52145d21b79ee..7eff93736b21d 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -417,7 +417,12 @@ endif do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h QSTR_GLOBAL_REQUIREMENTS += $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig boards/$(BOARD)/mpconfigboard.mk CMakeLists.txt | $(BUILD)/esp-idf - IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja + $(STEPECHO) "LINK $@" + $(Q)env IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja + $(Q)$(PYTHON) tools/check-sdkconfig.py \ + CIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK) \ + CIRCUITPY_STORAGE_EXTEND=$(CIRCUITPY_STORAGE_EXTEND) \ + $@ # build a lib # Adding -d explain -j 1 -v to the ninja line will output debug info diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index 72782f0fe7289..a2901ae7530e5 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -12,10 +12,13 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_PSRAM_SIZE = 2MB CIRCUITPY_ESP_PSRAM_MODE = qio CIRCUITPY_ESP_PSRAM_FREQ = 80m -FLASH_SDKCONFIG = esp-idf-config/sdkconfig-4MB-1ota.defaults + +# No OTA partition: larger firmware partition +FLASH_SIZE_SDKCONFIG = esp-idf-config/sdkconfig-flash-$(CIRCUITPY_ESP_FLASH_SIZE)-no-ota.defaults CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_CANIO = 0 +CIRCUITPY_DUALBANK = 0 CIRCUITPY_ESPCAMERA = 1 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_KEYPAD = 0 diff --git a/ports/espressif/esp-idf-config/partitions-4MB-1ota.csv b/ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv similarity index 100% rename from ports/espressif/esp-idf-config/partitions-4MB-1ota.csv rename to ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-1ota.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-ota.defaults similarity index 54% rename from ports/espressif/esp-idf-config/sdkconfig-flash-4MB-1ota.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-ota.defaults index 5677b79418e7c..f856207b13266 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-1ota.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-ota.defaults @@ -1,4 +1,7 @@ # +# Espressif IoT Development Framework Configuration +# +# # Serial flasher config # # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set @@ -6,13 +9,17 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="4MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y # end of Serial flasher config -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-1ota.csv" # # Partition Table # -CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-1ota.csv" +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-ota.csv" +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-ota.csv" # end of Partition Table + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 22a39ec71aa4a..bfc22b74f883a 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -26,7 +26,6 @@ CIRCUITPY_AUDIOMP3 ?= 0 CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_CANIO ?= 1 CIRCUITPY_COUNTIO ?= 1 -CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION = 0 CIRCUITPY_DUALBANK ?= 1 CIRCUITPY_ESPCAMERA ?= 1 CIRCUITPY_ESPIDF ?= 1 @@ -113,14 +112,12 @@ else ifeq ($(IDF_TARGET),esp32s2) # Modules # No BLE in hw CIRCUITPY_BLEIO = 0 -CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0 CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0 else ifeq ($(IDF_TARGET),esp32s3) # Modules CIRCUITPY_BITMAPFILTER ?= $(CIRCUITPY_ESPCAMERA) -CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0 CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0 # No room for _bleio on boards with 4MB flash diff --git a/ports/espressif/supervisor/internal_flash.c b/ports/espressif/supervisor/internal_flash.c index 5ec875bcea78d..903e02a853661 100644 --- a/ports/espressif/supervisor/internal_flash.c +++ b/ports/espressif/supervisor/internal_flash.c @@ -168,7 +168,7 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32 #if CIRCUITPY_STORAGE_EXTEND multi_partition_rw(_cache, sector_offset, SECTOR_SIZE, OP_WRITE); #else - single_partition_rw(_partition[0], _cache, sector_offset, SECTOR_SIZE, OP_READ); + single_partition_rw(_partition[0], _cache, sector_offset, SECTOR_SIZE, OP_WRITE); #endif } return 0; // success diff --git a/ports/espressif/tools/check-sdkconfig.py b/ports/espressif/tools/check-sdkconfig.py new file mode 100755 index 0000000000000..8a7ef8821770e --- /dev/null +++ b/ports/espressif/tools/check-sdkconfig.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +import sys + +import click + + +def int_or_string(s): + try: + return int(s) + except ValueError: + return s.strip('"') + + +def collect_definitions(file): + """Collect all definitions in supplied sdkconfig.h.""" + sdk_config = {} + for line in file: + if line.startswith("#define "): + _, k, v = line.strip().split(None, 2) + # Handle transitive definitions like '#define CONFIG_TCP_MSL CONFIG_LWIP_TCP_MSL' + v = sdk_config.get(k, v) + sdk_config[k] = int_or_string(v) + return sdk_config + + +def validate(sdk_config, circuitpy_config): + partition_table = sdk_config.get("CONFIG_PARTITION_TABLE_FILENAME") + for var in ("CIRCUITPY_STORAGE_EXTEND", "CIRCUITPY_DUALBANK"): + if circuitpy_config.get(var): + with open(partition_table) as f: + content = f.read() + if not "ota_1" in content: + raise SystemExit( + f"{var} is incompatible with {partition_table=} (no ota_1 partition)" + ) + + # Add more checks here for other things we want to verify. + return + + +@click.command() +@click.argument("definitions", nargs=-1, metavar="CIRCUITPY_X=1 CIRCUITPY_Y=0 ...") +@click.argument( + "sdkconfig_h", required=True, nargs=1, type=click.File("r"), metavar="" +) +def run(definitions, sdkconfig_h): + sdk_config = collect_definitions(sdkconfig_h) + + # Parse definitions arguments + circuitpy_config = {} + for definition in definitions: + k, v = definition.split("=", 1) + circuitpy_config[k] = int_or_string(v) + + # Validate. + validate(sdk_config, circuitpy_config) + + +if __name__ == "__main__": + run() diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index c3591b45caf88..9867b97c97cf3 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -415,9 +415,6 @@ extern const struct _mp_obj_module_t nvm_module; #define MP_STATE_PORT MP_STATE_VM -// From supervisor/memory.c -struct _supervisor_allocation_node; - void background_callback_run_all(void); #define RUN_BACKGROUND_TASKS (background_callback_run_all()) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 57db5c8c7bc03..fc9fdcbd31afa 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -237,8 +237,6 @@ CFLAGS += -DCIRCUITPY_PARALLELDISPLAYBUS=$(CIRCUITPY_PARALLELDISPLAYBUS) CIRCUITPY_DOTCLOCKFRAMEBUFFER ?= 0 CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER) -CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION ?= 1 -CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION) # bitmaptools and framebufferio rely on displayio and are not on small boards CIRCUITPY_BITMAPTOOLS ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO)) @@ -435,8 +433,6 @@ CFLAGS += -DCIRCUITPY_RP2PIO=$(CIRCUITPY_RP2PIO) CIRCUITPY_RGBMATRIX ?= 0 CFLAGS += -DCIRCUITPY_RGBMATRIX=$(CIRCUITPY_RGBMATRIX) -CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION ?= 1 -CFLAGS += -DCIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION=$(CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION) CIRCUITPY_ROTARYIO ?= 1 CFLAGS += -DCIRCUITPY_ROTARYIO=$(CIRCUITPY_ROTARYIO) 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