From ef03ca8bf2e06d3d8b753aafdf13e1399dc26847 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Wed, 16 Aug 2023 00:51:37 +1000 Subject: [PATCH] esp8266: Add board variant support. This merges the existing GENERIC, GENERIC_1M, and GENERIC_512k boards into variants of the new ESP8266_GENERIC board (renamed from GENERIC so as not to clash with other ports). Also moves the generation of the "OTA" variant (previously generated by autobuild/build-esp8266-latest.sh) into the variant. Following the convention established for the WEACTSTUDIO rp2 board, the names of the variants are FLASH_1M and FLASH_512K (but rename the .ld files to use MiB and kiB). Updates autobuild to build esp8266 firmware the same way as other ports. This requires renaming the output from firmware-combined.bin to just firmware.bin. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared --- ports/esp8266/Makefile | 32 +++++++--- ports/esp8266/README.md | 43 +++++++------ ports/esp8266/boards/ESP8266_GENERIC/_boot.py | 6 ++ .../{GENERIC => ESP8266_GENERIC}/board.json | 6 +- .../{GENERIC => ESP8266_GENERIC}/board.md | 13 +++- .../manifest_2MiB.py} | 0 .../manifest_512kiB.py} | 0 .../boards/ESP8266_GENERIC/mpconfigboard.h | 52 ++++++++++++++++ .../boards/ESP8266_GENERIC/mpconfigboard.mk | 50 +++++++++++++++ ports/esp8266/boards/GENERIC/mpconfigboard.h | 14 ----- ports/esp8266/boards/GENERIC/mpconfigboard.mk | 8 --- ports/esp8266/boards/GENERIC_1M/board.json | 16 ----- ports/esp8266/boards/GENERIC_1M/board.md | 5 -- .../esp8266/boards/GENERIC_1M/mpconfigboard.h | 17 ------ .../boards/GENERIC_1M/mpconfigboard.mk | 5 -- ports/esp8266/boards/GENERIC_512K/_boot.py | 3 - ports/esp8266/boards/GENERIC_512K/board.json | 16 ----- ports/esp8266/boards/GENERIC_512K/board.md | 3 - .../boards/GENERIC_512K/mpconfigboard.h | 13 ---- .../boards/GENERIC_512K/mpconfigboard.mk | 3 - .../boards/{esp8266_1m.ld => esp8266_1MiB.ld} | 0 .../boards/{esp8266_2m.ld => esp8266_2MiB.ld} | 0 .../{esp8266_512k.ld => esp8266_512kiB.ld} | 0 pyproject.toml | 2 +- tools/autobuild/autobuild.sh | 2 +- tools/autobuild/build-boards.sh | 4 ++ tools/autobuild/build-esp8266-latest.sh | 61 ------------------- tools/ci.sh | 6 +- 28 files changed, 179 insertions(+), 201 deletions(-) create mode 100644 ports/esp8266/boards/ESP8266_GENERIC/_boot.py rename ports/esp8266/boards/{GENERIC => ESP8266_GENERIC}/board.json (70%) rename ports/esp8266/boards/{GENERIC => ESP8266_GENERIC}/board.md (58%) rename ports/esp8266/boards/{GENERIC/manifest.py => ESP8266_GENERIC/manifest_2MiB.py} (100%) rename ports/esp8266/boards/{GENERIC_512K/manifest.py => ESP8266_GENERIC/manifest_512kiB.py} (100%) create mode 100644 ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.h create mode 100644 ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.mk delete mode 100644 ports/esp8266/boards/GENERIC/mpconfigboard.h delete mode 100644 ports/esp8266/boards/GENERIC/mpconfigboard.mk delete mode 100644 ports/esp8266/boards/GENERIC_1M/board.json delete mode 100644 ports/esp8266/boards/GENERIC_1M/board.md delete mode 100644 ports/esp8266/boards/GENERIC_1M/mpconfigboard.h delete mode 100644 ports/esp8266/boards/GENERIC_1M/mpconfigboard.mk delete mode 100644 ports/esp8266/boards/GENERIC_512K/_boot.py delete mode 100644 ports/esp8266/boards/GENERIC_512K/board.json delete mode 100644 ports/esp8266/boards/GENERIC_512K/board.md delete mode 100644 ports/esp8266/boards/GENERIC_512K/mpconfigboard.h delete mode 100644 ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk rename ports/esp8266/boards/{esp8266_1m.ld => esp8266_1MiB.ld} (100%) rename ports/esp8266/boards/{esp8266_2m.ld => esp8266_2MiB.ld} (100%) rename ports/esp8266/boards/{esp8266_512k.ld => esp8266_512kiB.ld} (100%) delete mode 100755 tools/autobuild/build-esp8266-latest.sh diff --git a/ports/esp8266/Makefile b/ports/esp8266/Makefile index 1cdcafa031..e4c907c57a 100644 --- a/ports/esp8266/Makefile +++ b/ports/esp8266/Makefile @@ -4,17 +4,25 @@ ifdef BOARD_DIR # the path as the board name. BOARD ?= $(notdir $(BOARD_DIR:/=)) else -# If not given on the command line, then default to GENERIC. -BOARD ?= GENERIC +# If not given on the command line, then default to ESP8266_GENERIC. +BOARD ?= ESP8266_GENERIC BOARD_DIR ?= boards/$(BOARD) endif ifeq ($(wildcard $(BOARD_DIR)/.),) +ifeq ($(findstring boards/GENERIC,$(BOARD_DIR)),boards/GENERIC) +$(warning The GENERIC* boards have been renamed to ESP8266_GENERIC) +endif $(error Invalid BOARD specified: $(BOARD_DIR)) endif -# If the build directory is not given, make it reflect the board name. +# If the build directory is not given, make it reflect the board name (and +# optionally the board variant). +ifneq ($(BOARD_VARIANT),) +BUILD ?= build-$(BOARD)-$(BOARD_VARIANT) +else BUILD ?= build-$(BOARD) +endif include ../../py/mkenv.mk @@ -40,7 +48,7 @@ include $(TOP)/extmod/extmod.mk GIT_SUBMODULES += lib/axtls lib/berkeley-db-1.xx -FWBIN = $(BUILD)/firmware-combined.bin +FWBIN = $(BUILD)/firmware.bin PORT ?= /dev/ttyACM0 BAUD ?= 115200 FLASH_MODE ?= qio @@ -202,7 +210,7 @@ FROZEN_EXTRA_DEPS = $(CONFVARS_FILE) .PHONY: deploy -deploy: $(BUILD)/firmware-combined.bin +deploy: $(FWBIN) $(ECHO) "Writing $< to the board" $(Q)esptool.py --port $(PORT) --baud $(BAUD) write_flash --verify --flash_size=$(FLASH_SIZE) --flash_mode=$(FLASH_MODE) 0 $< @@ -213,20 +221,26 @@ erase: reset: echo -e "\r\nimport machine; machine.reset()\r\n" >$(PORT) +ifeq ($(BOARD_VARIANT),OTA) +$(FWBIN): $(BUILD)/firmware.elf + $(ECHO) "Create $@" + $(Q)esptool.py elf2image $^ + $(Q)$(PYTHON) makeimg.py $(BUILD)/firmware.elf-0x00000.bin $(BUILD)/firmware.elf-0x[0-5][1-f]000.bin $(BUILD)/firmware-ota.bin + + $(Q)cat $(YAOTA8266)/yaota8266.bin $(BUILD)/firmware-ota.bin > $@ + $(Q)$(PYTHON) $(YAOTA8266)/ota-client/ota_client.py sign $@ +else $(FWBIN): $(BUILD)/firmware.elf $(ECHO) "Create $@" $(Q)esptool.py elf2image $^ $(Q)$(PYTHON) makeimg.py $(BUILD)/firmware.elf-0x00000.bin $(BUILD)/firmware.elf-0x[0-5][1-f]000.bin $@ +endif $(BUILD)/firmware.elf: $(OBJ) $(ECHO) "LINK $@" $(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) $(Q)$(SIZE) $@ -ota: - rm -f $(BUILD)/firmware.elf $(BUILD)/firmware.elf*.bin - $(MAKE) LD_FILES=boards/esp8266_ota.ld FWBIN=$(BUILD)/firmware-ota.bin - include $(TOP)/py/mkrules.mk clean-modules: diff --git a/ports/esp8266/README.md b/ports/esp8266/README.md index 1e0cae2139..561c771403 100644 --- a/ports/esp8266/README.md +++ b/ports/esp8266/README.md @@ -23,6 +23,9 @@ Supported features include: Documentation is available at http://docs.micropython.org/en/latest/esp8266/quickref.html. +The default build requires a 2MiB flash chip, but see below for support for +1MiB and 512kiB options. + Build instructions ------------------ @@ -67,10 +70,10 @@ Then to compile the ESP8266 firmware: ``` $ cd ports/esp8266 -$ docker run --rm -v $HOME:$HOME -u $UID -w $PWD larsks/esp-open-sdk make -j BOARD=GENERIC +$ docker run --rm -v $HOME:$HOME -u $UID -w $PWD larsks/esp-open-sdk make -j BOARD=ESP8266_GENERIC ``` -This will produce binary images in the `build-GENERIC/` subdirectory. +This will produce binary images in the `build-ESP8266_GENERIC/` subdirectory. Substitute the board for whichever board you're using. __Building with a local toolchain__ @@ -106,10 +109,10 @@ Then to compile the ESP8266 firmware: ``` $ cd ports/esp8266 -$ make -j BOARD=GENERIC +$ make -j BOARD=ESP8266_GENERIC ``` -This will produce binary images in the `build-GENERIC/` subdirectory. +This will produce binary images in the `build-ESP8266_GENERIC/` subdirectory. Substitute the board for whichever board you're using. @@ -149,26 +152,30 @@ $ make PORT=/dev/ttyUSB0 FLASH_MODE=qio FLASH_SIZE=32m deploy (note that flash size is in megabits) If you want to flash manually using `esptool.py` directly, the image produced is -`build-GENERIC/firmware-combined.bin`, to be flashed at 0x00000. +`build-ESP8266_GENERIC/firmware.bin`, to be flashed at 0x00000. -The default board definition is the directory `boards/GENERIC`. +The default board definition is the directory `boards/ESP8266_GENERIC`. For a custom configuration you can define your own board in the directory `boards/`. -The `BOARD` variable can be set on the make command line, for example: +__Reduced FlashROM variants__ + +The normal build described above requires modules with at least 2MiB of +FlashROM onboard. There's a special configuration for 512kiB modules, which can +be built with the `FLASH_512K` variant. This configuration is highly limited, +lacks filesystem support, WebREPL, and has many other features disabled. It's +mostly suitable for advanced users who are interested to fine-tune options to +achieve a required setup. If you are an end user, please consider using a +module with at least 2MiB of FlashROM. + +A variant is also provided for 1MiB modules which just lacks the included +micropython-lib packages. + +The variant can be set on the make command line, for example: ```bash -$ make BOARD=GENERIC_512K +$ make BOARD=ESP8266_GENERIC BOARD_VARIANT=FLASH_512K +$ make BOARD=ESP8266_GENERIC BOARD_VARIANT=FLASH_1M ``` -__512KB FlashROM version__ - -The normal build described above requires modules with at least 1MB of FlashROM -onboard. There's a special configuration for 512KB modules, which can be -built with `make BOARD=GENERIC_512K`. This configuration is highly limited, lacks -filesystem support, WebREPL, and has many other features disabled. It's mostly -suitable for advanced users who are interested to fine-tune options to achieve a -required setup. If you are an end user, please consider using a module with at -least 1MB of FlashROM. - First start ----------- diff --git a/ports/esp8266/boards/ESP8266_GENERIC/_boot.py b/ports/esp8266/boards/ESP8266_GENERIC/_boot.py new file mode 100644 index 0000000000..16da8bc4c3 --- /dev/null +++ b/ports/esp8266/boards/ESP8266_GENERIC/_boot.py @@ -0,0 +1,6 @@ +# Minimal _boot.py for the 512kiB variant. Does not set up a block device or +# filesystem. Other variants use esp8266/modules/_boot.py. + +import gc + +gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4) diff --git a/ports/esp8266/boards/GENERIC/board.json b/ports/esp8266/boards/ESP8266_GENERIC/board.json similarity index 70% rename from ports/esp8266/boards/GENERIC/board.json rename to ports/esp8266/boards/ESP8266_GENERIC/board.json index dffe6d2711..1fca10c5f0 100644 --- a/ports/esp8266/boards/GENERIC/board.json +++ b/ports/esp8266/boards/ESP8266_GENERIC/board.json @@ -9,11 +9,13 @@ ], "images": [], "mcu": "esp8266", - "product": "ESP8266 with 2MiB+ flash", + "product": "ESP8266", "thumbnail": "", "url": "https://www.espressif.com/en/products/modules", "variants": { - "ota": "OTA compatible" + "OTA": "OTA compatible", + "FLASH_1M": "1MiB flash", + "FLASH_512K": "512kiB flash" }, "vendor": "Espressif" } diff --git a/ports/esp8266/boards/GENERIC/board.md b/ports/esp8266/boards/ESP8266_GENERIC/board.md similarity index 58% rename from ports/esp8266/boards/GENERIC/board.md rename to ports/esp8266/boards/ESP8266_GENERIC/board.md index fa0cf410d6..96fbab617a 100644 --- a/ports/esp8266/boards/GENERIC/board.md +++ b/ports/esp8266/boards/ESP8266_GENERIC/board.md @@ -1,6 +1,13 @@ -The following are daily builds of the ESP8266 firmware for boards with at -least 2MiB of flash. They have the latest features and bug fixes, WebREPL is -not automatically started, and debugging is enabled by default. +The following are daily builds of the ESP8266 firmware. This will work on +boards with at least 2MiB of flash. They have the latest features and bug +fixes, WebREPL is not automatically started, and debugging is enabled by +default. + +For boards with 1MiB or 512kiB of flash, two variants are provided with reduced +functionality. The 1MiB variant removes asyncio and FAT-filesystem support as +well as some modules from micropython-lib. The 512kiB variant further removes +all filesystem support, as well as framebuffer support, some Python language +features, and has less detailed error messages. Note: v1.12-334 and newer (including v1.13) require an ESP8266 module with 2MiB of flash or more, and use littlefs as the filesystem by default. When diff --git a/ports/esp8266/boards/GENERIC/manifest.py b/ports/esp8266/boards/ESP8266_GENERIC/manifest_2MiB.py similarity index 100% rename from ports/esp8266/boards/GENERIC/manifest.py rename to ports/esp8266/boards/ESP8266_GENERIC/manifest_2MiB.py diff --git a/ports/esp8266/boards/GENERIC_512K/manifest.py b/ports/esp8266/boards/ESP8266_GENERIC/manifest_512kiB.py similarity index 100% rename from ports/esp8266/boards/GENERIC_512K/manifest.py rename to ports/esp8266/boards/ESP8266_GENERIC/manifest_512kiB.py diff --git a/ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.h b/ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.h new file mode 100644 index 0000000000..3a9c40e795 --- /dev/null +++ b/ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.h @@ -0,0 +1,52 @@ +#if defined(MICROPY_ESP8266_2M) + +#define MICROPY_HW_BOARD_NAME "ESP module" +#define MICROPY_HW_MCU_NAME "ESP8266" + +#define MICROPY_PERSISTENT_CODE_LOAD (1) +#define MICROPY_EMIT_XTENSA (1) +#define MICROPY_EMIT_INLINE_XTENSA (1) + +#define MICROPY_DEBUG_PRINTERS (1) +#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) + +#define MICROPY_READER_VFS (MICROPY_VFS) +#define MICROPY_VFS (1) + +#define MICROPY_PY_CRYPTOLIB (1) + +#elif defined(MICROPY_ESP8266_1M) + +#define MICROPY_HW_BOARD_NAME "ESP module (1M)" +#define MICROPY_HW_MCU_NAME "ESP8266" + +#define MICROPY_PERSISTENT_CODE_LOAD (1) +#define MICROPY_EMIT_XTENSA (1) +#define MICROPY_EMIT_INLINE_XTENSA (1) + +#define MICROPY_DEBUG_PRINTERS (1) +#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) + +#define MICROPY_READER_VFS (MICROPY_VFS) +#define MICROPY_VFS (1) + + +#define MICROPY_PY_CRYPTOLIB (1) + +#elif defined(MICROPY_ESP8266_512K) + +#define MICROPY_HW_BOARD_NAME "ESP module (512K)" +#define MICROPY_HW_MCU_NAME "ESP8266" + +#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) + +#define MICROPY_PY_FSTRINGS (0) +#define MICROPY_PY_BUILTINS_SLICE_ATTRS (0) +#define MICROPY_PY_ALL_SPECIAL_METHODS (0) +#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0) +#define MICROPY_PY_SYS_STDIO_BUFFER (0) +#define MICROPY_PY_ASYNCIO (0) +#define MICROPY_PY_RE_SUB (0) +#define MICROPY_PY_FRAMEBUF (0) + +#endif diff --git a/ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.mk b/ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.mk new file mode 100644 index 0000000000..2eb78d7e85 --- /dev/null +++ b/ports/esp8266/boards/ESP8266_GENERIC/mpconfigboard.mk @@ -0,0 +1,50 @@ +ifeq ($(BOARD_VARIANT),) +LD_FILES = boards/esp8266_2MiB.ld + +MICROPY_ESPNOW ?= 1 +MICROPY_PY_BTREE ?= 1 +MICROPY_VFS_FAT ?= 1 +MICROPY_VFS_LFS2 ?= 1 + +# Add asyncio and extra micropython-lib packages (in addition to the port manifest). +FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest_2MiB.py + +# Configure mpconfigboard.h. +CFLAGS += -DMICROPY_ESP8266_2M +endif + +ifeq ($(BOARD_VARIANT),FLASH_1M) +LD_FILES = boards/esp8266_1MiB.ld + +MICROPY_ESPNOW ?= 1 +MICROPY_PY_BTREE ?= 1 +MICROPY_VFS_LFS2 ?= 1 + +# Note: Implicitly uses the port manifest. + +# Configure mpconfigboard.h. +CFLAGS += -DMICROPY_ESP8266_1M +endif + +ifeq ($(BOARD_VARIANT),OTA) +LD_FILES = boards/esp8266_ota.ld + +MICROPY_ESPNOW ?= 1 +MICROPY_PY_BTREE ?= 1 +MICROPY_VFS_LFS2 ?= 1 + +# Note: Implicitly uses the port manifest. + +# Configure mpconfigboard.h. +CFLAGS += -DMICROPY_ESP8266_1M +endif + +ifeq ($(BOARD_VARIANT),FLASH_512K) +LD_FILES = boards/esp8266_512kiB.ld + +# Note: Use the minimal manifest.py. +FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest_512kiB.py + +# Configure mpconfigboard.h. +CFLAGS += -DMICROPY_ESP8266_512K +endif diff --git a/ports/esp8266/boards/GENERIC/mpconfigboard.h b/ports/esp8266/boards/GENERIC/mpconfigboard.h deleted file mode 100644 index 52c93f83a3..0000000000 --- a/ports/esp8266/boards/GENERIC/mpconfigboard.h +++ /dev/null @@ -1,14 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "ESP module" -#define MICROPY_HW_MCU_NAME "ESP8266" - -#define MICROPY_PERSISTENT_CODE_LOAD (1) -#define MICROPY_EMIT_XTENSA (1) -#define MICROPY_EMIT_INLINE_XTENSA (1) - -#define MICROPY_DEBUG_PRINTERS (1) -#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) - -#define MICROPY_READER_VFS (MICROPY_VFS) -#define MICROPY_VFS (1) - -#define MICROPY_PY_CRYPTOLIB (1) diff --git a/ports/esp8266/boards/GENERIC/mpconfigboard.mk b/ports/esp8266/boards/GENERIC/mpconfigboard.mk deleted file mode 100644 index 8d7babdc84..0000000000 --- a/ports/esp8266/boards/GENERIC/mpconfigboard.mk +++ /dev/null @@ -1,8 +0,0 @@ -LD_FILES = boards/esp8266_2m.ld - -MICROPY_ESPNOW ?= 1 -MICROPY_PY_BTREE ?= 1 -MICROPY_VFS_FAT ?= 1 -MICROPY_VFS_LFS2 ?= 1 - -FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py diff --git a/ports/esp8266/boards/GENERIC_1M/board.json b/ports/esp8266/boards/GENERIC_1M/board.json deleted file mode 100644 index 4ab5c79df0..0000000000 --- a/ports/esp8266/boards/GENERIC_1M/board.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "deploy": [ - "../deploy.md" - ], - "docs": "", - "features": [ - "External Flash", - "WiFi" - ], - "images": [], - "mcu": "esp8266", - "product": "ESP8266 with 1MiB flash", - "thumbnail": "", - "url": "https://www.espressif.com/en/products/modules", - "vendor": "Espressif" -} diff --git a/ports/esp8266/boards/GENERIC_1M/board.md b/ports/esp8266/boards/GENERIC_1M/board.md deleted file mode 100644 index 17cc6e3a6b..0000000000 --- a/ports/esp8266/boards/GENERIC_1M/board.md +++ /dev/null @@ -1,5 +0,0 @@ -The following are daily builds of the ESP8266 firmware tailored for modules with -only 1MiB of flash. This firmware uses littlefs as the filesystem. -When upgrading from older firmware that uses a FAT filesystem please backup your files -first, and either erase all flash before upgrading, or after upgrading execute -`os.VfsLfs2.mkfs(bdev)`. diff --git a/ports/esp8266/boards/GENERIC_1M/mpconfigboard.h b/ports/esp8266/boards/GENERIC_1M/mpconfigboard.h deleted file mode 100644 index 41752e692b..0000000000 --- a/ports/esp8266/boards/GENERIC_1M/mpconfigboard.h +++ /dev/null @@ -1,17 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "ESP module (1M)" -#define MICROPY_HW_MCU_NAME "ESP8266" - -#define MICROPY_PERSISTENT_CODE_LOAD (1) -#define MICROPY_EMIT_XTENSA (1) -#define MICROPY_EMIT_INLINE_XTENSA (1) - -#define MICROPY_DEBUG_PRINTERS (1) -#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) - -#define MICROPY_READER_VFS (MICROPY_VFS) -#define MICROPY_VFS (1) - -#define MICROPY_PY_FSTRINGS (0) -#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0) -#define MICROPY_PY_ASYNCIO (0) -#define MICROPY_PY_CRYPTOLIB (1) diff --git a/ports/esp8266/boards/GENERIC_1M/mpconfigboard.mk b/ports/esp8266/boards/GENERIC_1M/mpconfigboard.mk deleted file mode 100644 index adc31702e0..0000000000 --- a/ports/esp8266/boards/GENERIC_1M/mpconfigboard.mk +++ /dev/null @@ -1,5 +0,0 @@ -LD_FILES = boards/esp8266_1m.ld - -MICROPY_ESPNOW ?= 1 -MICROPY_PY_BTREE ?= 1 -MICROPY_VFS_LFS2 ?= 1 diff --git a/ports/esp8266/boards/GENERIC_512K/_boot.py b/ports/esp8266/boards/GENERIC_512K/_boot.py deleted file mode 100644 index 1a55cfd36c..0000000000 --- a/ports/esp8266/boards/GENERIC_512K/_boot.py +++ /dev/null @@ -1,3 +0,0 @@ -import gc - -gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4) diff --git a/ports/esp8266/boards/GENERIC_512K/board.json b/ports/esp8266/boards/GENERIC_512K/board.json deleted file mode 100644 index e035562be7..0000000000 --- a/ports/esp8266/boards/GENERIC_512K/board.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "deploy": [ - "../deploy.md" - ], - "docs": "", - "features": [ - "External Flash", - "WiFi" - ], - "images": [], - "mcu": "esp8266", - "product": "ESP8266 with 512kiB flash", - "thumbnail": "", - "url": "https://www.espressif.com/en/products/modules", - "vendor": "Espressif" -} diff --git a/ports/esp8266/boards/GENERIC_512K/board.md b/ports/esp8266/boards/GENERIC_512K/board.md deleted file mode 100644 index 1f6e2c7907..0000000000 --- a/ports/esp8266/boards/GENERIC_512K/board.md +++ /dev/null @@ -1,3 +0,0 @@ -The following are daily builds of the ESP8266 firmware tailored for modules with -only 512kiB of flash. Certain features are disabled to get the firmware down -to this size. diff --git a/ports/esp8266/boards/GENERIC_512K/mpconfigboard.h b/ports/esp8266/boards/GENERIC_512K/mpconfigboard.h deleted file mode 100644 index c29e23d5ad..0000000000 --- a/ports/esp8266/boards/GENERIC_512K/mpconfigboard.h +++ /dev/null @@ -1,13 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "ESP module (512K)" -#define MICROPY_HW_MCU_NAME "ESP8266" - -#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) - -#define MICROPY_PY_FSTRINGS (0) -#define MICROPY_PY_BUILTINS_SLICE_ATTRS (0) -#define MICROPY_PY_ALL_SPECIAL_METHODS (0) -#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0) -#define MICROPY_PY_SYS_STDIO_BUFFER (0) -#define MICROPY_PY_ASYNCIO (0) -#define MICROPY_PY_RE_SUB (0) -#define MICROPY_PY_FRAMEBUF (0) diff --git a/ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk b/ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk deleted file mode 100644 index 120351909b..0000000000 --- a/ports/esp8266/boards/GENERIC_512K/mpconfigboard.mk +++ /dev/null @@ -1,3 +0,0 @@ -LD_FILES = boards/esp8266_512k.ld - -FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py diff --git a/ports/esp8266/boards/esp8266_1m.ld b/ports/esp8266/boards/esp8266_1MiB.ld similarity index 100% rename from ports/esp8266/boards/esp8266_1m.ld rename to ports/esp8266/boards/esp8266_1MiB.ld diff --git a/ports/esp8266/boards/esp8266_2m.ld b/ports/esp8266/boards/esp8266_2MiB.ld similarity index 100% rename from ports/esp8266/boards/esp8266_2m.ld rename to ports/esp8266/boards/esp8266_2MiB.ld diff --git a/ports/esp8266/boards/esp8266_512k.ld b/ports/esp8266/boards/esp8266_512kiB.ld similarity index 100% rename from ports/esp8266/boards/esp8266_512k.ld rename to ports/esp8266/boards/esp8266_512kiB.ld diff --git a/pyproject.toml b/pyproject.toml index a05abf887e..e3d70385c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,4 +48,4 @@ max-complexity = 40 # manifest.py files are evaluated with some global names pre-defined "**/manifest.py" = ["F821"] -"ports/**/boards/manifest*.py" = ["F821"] +"ports/**/boards/**/manifest_*.py" = ["F821"] diff --git a/tools/autobuild/autobuild.sh b/tools/autobuild/autobuild.sh index 999a42c0ed..12ac230dfb 100755 --- a/tools/autobuild/autobuild.sh +++ b/tools/autobuild/autobuild.sh @@ -62,7 +62,7 @@ FW_TAG="-$FW_DATE-unstable-$FW_GIT" cd ports/cc3200 ${AUTODIR}/build-cc3200-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE} cd ../esp8266 -${AUTODIR}/build-esp8266-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE} +build_esp8266_boards ${FW_TAG} ${LOCAL_FIRMWARE} cd ../esp32 (source ${IDF_PATH_V50}/export.sh && build_esp32_boards ${FW_TAG} ${LOCAL_FIRMWARE}) cd ../mimxrt diff --git a/tools/autobuild/build-boards.sh b/tools/autobuild/build-boards.sh index 82d7f36057..6f3f938096 100755 --- a/tools/autobuild/build-boards.sh +++ b/tools/autobuild/build-boards.sh @@ -92,6 +92,10 @@ function build_esp32_boards { build_boards modesp32.c $1 $2 bin elf map uf2 app-bin } +function build_esp8266_boards { + build_boards modesp.c $1 $2 bin elf map +} + function build_mimxrt_boards { build_boards modmimxrt.c $1 $2 bin hex } diff --git a/tools/autobuild/build-esp8266-latest.sh b/tools/autobuild/build-esp8266-latest.sh deleted file mode 100755 index 1972e85fcd..0000000000 --- a/tools/autobuild/build-esp8266-latest.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -PYTHON3=python3 -yaota8266=$HOME/yaota8266 - -# for debugging -#exec &> /tmp/esp-log-$$.txt - -# function for building firmware -function do_build() { - descr=$1 - board=$2 - shift - shift - echo "building $descr $board" - build_dir=/tmp/esp8266-build-$board - $MICROPY_AUTOBUILD_MAKE $@ BOARD=$board BUILD=$build_dir || exit 1 - mv $build_dir/firmware-combined.bin $dest_dir/$descr$fw_tag.bin - mv $build_dir/firmware.elf $dest_dir/$descr$fw_tag.elf - mv $build_dir/firmware.map $dest_dir/$descr$fw_tag.map - rm -rf $build_dir -} - -function do_build_ota() { - descr=$1 - board=$2 - shift - shift - echo "building $descr $board" - build_dir=/tmp/esp8266-build-$board - $MICROPY_AUTOBUILD_MAKE $@ BOARD=$board BUILD=$build_dir || exit 1 - cat $yaota8266/yaota8266.bin $build_dir/firmware-ota.bin > $dest_dir/$descr$fw_tag.bin - pushd $yaota8266/ota-client - $PYTHON3 ota_client.py sign $build_dir/firmware-ota.bin - popd - mv $build_dir/firmware-ota.bin.ota $dest_dir/$descr$fw_tag.ota - mv $build_dir/firmware.elf $dest_dir/$descr$fw_tag.elf - mv $build_dir/firmware.map $dest_dir/$descr$fw_tag.map - rm -rf $build_dir -} - -# check/get parameters -if [ $# != 2 ]; then - echo "usage: $0 " - exit 1 -fi - -fw_tag=$1 -dest_dir=$2 - -# check we are in the correct directory -if [ ! -r boards/esp8266_common.ld ]; then - echo "must be in esp8266 directory" - exit 1 -fi - -# build the versions -do_build esp8266 GENERIC -do_build esp8266-512k GENERIC_512K -do_build esp8266-1m GENERIC_1M -do_build_ota esp8266-ota GENERIC_1M ota diff --git a/tools/ci.sh b/tools/ci.sh index 55e90dc4a8..f60ba0fd51 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -155,9 +155,9 @@ function ci_esp8266_path { function ci_esp8266_build { make ${MAKEOPTS} -C mpy-cross make ${MAKEOPTS} -C ports/esp8266 submodules - make ${MAKEOPTS} -C ports/esp8266 - make ${MAKEOPTS} -C ports/esp8266 BOARD=GENERIC_512K - make ${MAKEOPTS} -C ports/esp8266 BOARD=GENERIC_1M + make ${MAKEOPTS} -C ports/esp8266 BOARD=ESP8266_GENERIC + make ${MAKEOPTS} -C ports/esp8266 BOARD=ESP8266_GENERIC BOARD_VARIANT=FLASH_512K + make ${MAKEOPTS} -C ports/esp8266 BOARD=ESP8266_GENERIC BOARD_VARIANT=FLASH_1M } ########################################################################################