Skip to content

Commit daa948f

Browse files
committed
esp8266: Rework board variant support to require mpconfigvariant file.
Following how esp32 has been reworked, each variant now has a corresponding `mpconfigvariant_VARIANT.mk` file associated with it. The base variant also has a `mpconfigvariant.mk` file because it has options that none of the other variants use. Signed-off-by: Damien George <[email protected]>
1 parent 43ebbec commit daa948f

File tree

6 files changed

+53
-52
lines changed

6 files changed

+53
-52
lines changed

ports/esp8266/Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ endif
1616
$(error Invalid BOARD specified: $(BOARD_DIR))
1717
endif
1818

19+
ifneq ($(BOARD_VARIANT),)
20+
ifeq ($(wildcard $(BOARD_DIR)/mpconfigvariant_$(BOARD_VARIANT).mk),)
21+
$(error Invalid BOARD_VARIANT specified: $(BOARD_VARIANT))
22+
endif
23+
endif
24+
1925
# If the build directory is not given, make it reflect the board name (and
2026
# optionally the board variant).
2127
ifneq ($(BOARD_VARIANT),)
@@ -26,8 +32,13 @@ endif
2632

2733
include ../../py/mkenv.mk
2834

29-
# Optional
30-
-include $(BOARD_DIR)/mpconfigboard.mk
35+
# Include board specific .mk file, and optional board variant .mk file.
36+
include $(BOARD_DIR)/mpconfigboard.mk
37+
ifeq ($(BOARD_VARIANT),)
38+
-include $(BOARD_DIR)/mpconfigvariant.mk
39+
else
40+
include $(BOARD_DIR)/mpconfigvariant_$(BOARD_VARIANT).mk
41+
endif
3142

3243
# qstr definitions (must come before including py.mk)
3344
QSTR_DEFS = qstrdefsport.h #$(BUILD)/pins_qstr.h
Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1 @@
1-
ifeq ($(BOARD_VARIANT),)
2-
LD_FILES = boards/esp8266_2MiB.ld
3-
4-
MICROPY_PY_ESPNOW ?= 1
5-
MICROPY_PY_BTREE ?= 1
6-
MICROPY_VFS_FAT ?= 1
7-
MICROPY_VFS_LFS2 ?= 1
8-
9-
# Add asyncio and extra micropython-lib packages (in addition to the port manifest).
10-
FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest_2MiB.py
11-
12-
# Configure mpconfigboard.h.
13-
CFLAGS += -DMICROPY_ESP8266_2M
14-
endif
15-
16-
ifeq ($(BOARD_VARIANT),FLASH_1M)
17-
LD_FILES = boards/esp8266_1MiB.ld
18-
19-
MICROPY_PY_ESPNOW ?= 1
20-
MICROPY_PY_BTREE ?= 1
21-
MICROPY_VFS_LFS2 ?= 1
22-
23-
# Note: Implicitly uses the port manifest.
24-
25-
# Configure mpconfigboard.h.
26-
CFLAGS += -DMICROPY_ESP8266_1M
27-
endif
28-
29-
ifeq ($(BOARD_VARIANT),OTA)
30-
LD_FILES = boards/esp8266_ota.ld
31-
32-
MICROPY_PY_ESPNOW ?= 1
33-
MICROPY_PY_BTREE ?= 1
34-
MICROPY_VFS_LFS2 ?= 1
35-
36-
# Note: Implicitly uses the port manifest.
37-
38-
# Configure mpconfigboard.h.
39-
CFLAGS += -DMICROPY_ESP8266_1M
40-
endif
41-
42-
ifeq ($(BOARD_VARIANT),FLASH_512K)
43-
LD_FILES = boards/esp8266_512kiB.ld
44-
45-
# Note: Use the minimal manifest.py.
46-
FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest_512kiB.py
47-
48-
# Configure mpconfigboard.h.
49-
CFLAGS += -DMICROPY_ESP8266_512K
50-
endif
1+
# There are no common .mk settings among the variants, so this file is empty.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
LD_FILES = boards/esp8266_2MiB.ld
2+
3+
MICROPY_PY_ESPNOW ?= 1
4+
MICROPY_PY_BTREE ?= 1
5+
MICROPY_VFS_FAT ?= 1
6+
MICROPY_VFS_LFS2 ?= 1
7+
8+
# Add asyncio and extra micropython-lib packages (in addition to the port manifest).
9+
FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest_2MiB.py
10+
11+
# Configure mpconfigboard.h.
12+
CFLAGS += -DMICROPY_ESP8266_2M
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
LD_FILES = boards/esp8266_1MiB.ld
2+
3+
MICROPY_PY_ESPNOW ?= 1
4+
MICROPY_PY_BTREE ?= 1
5+
MICROPY_VFS_LFS2 ?= 1
6+
7+
# Note: Implicitly uses the port manifest.
8+
9+
# Configure mpconfigboard.h.
10+
CFLAGS += -DMICROPY_ESP8266_1M
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
LD_FILES = boards/esp8266_512kiB.ld
2+
3+
# Note: Use the minimal manifest.py.
4+
FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest_512kiB.py
5+
6+
# Configure mpconfigboard.h.
7+
CFLAGS += -DMICROPY_ESP8266_512K
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
LD_FILES = boards/esp8266_ota.ld
2+
3+
MICROPY_PY_ESPNOW ?= 1
4+
MICROPY_PY_BTREE ?= 1
5+
MICROPY_VFS_LFS2 ?= 1
6+
7+
# Note: Implicitly uses the port manifest.
8+
9+
# Configure mpconfigboard.h.
10+
CFLAGS += -DMICROPY_ESP8266_1M

0 commit comments

Comments
 (0)