8000 stm32,rp2,esp32: Improve consistency of board and variant names. by jimmo · Pull Request #12240 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ports/cc3200/boards/WIPY/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"WiFi",
"microSD"
],
"id": "wipy",
"images": [
"wipy.jpg"
],
Expand Down
2 changes: 1 addition & 1 deletion ports/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.12)

# Set the board if it's not already set.
if(NOT MICROPY_BOARD)
set(MICROPY_BOARD GENERIC)
set(MICROPY_BOARD ESP32_GENERIC)
endif()

# Set the board directory and check that it exists.
Expand Down
14 changes: 11 additions & 3 deletions ports/esp32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,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 ESP32_GENERIC.
BOARD ?= ESP32_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 ESP32_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

# Device serial settings.
PORT ?= /dev/ttyUSB0
Expand Down
33 changes: 24 additions & 9 deletions ports/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ $ make submodules
$ make
```

This will produce a combined `firmware.bin` image in the `build-GENERIC/`
This will produce a combined `firmware.bin` image in the `build-ESP32_GENERIC/`
subdirectory (this firmware image is made up of: bootloader.bin, partitions.bin
and micropython.bin).

Expand Down Expand Up @@ -123,12 +123,12 @@ To flash the MicroPython firmware to your ESP32 use:
$ make deploy
```

The default ESP32 board build by the above commands is the `GENERIC` one, which
should work on most ESP32 modules. You can specify a different board by passing
`BOARD=<board>` to the make commands, for example:
The default ESP32 board build by the above commands is the `ESP32_GENERIC`
one, which should work on most ESP32 modules. You can specify a different
board by passing `BOARD=<board>` to the make commands, for example:

```bash
$ make BOARD=GENERIC_SPIRAM
$ make BOARD=ESP32_GENERIC_S3
```

Note: the above "make" commands are thin wrappers for the underlying `idf.py`
Expand All @@ -137,10 +137,25 @@ for example:

```bash
$ idf.py build
$ idf.py -D MICROPY_BOARD=GENERIC_SPIRAM build
$ idf.py -D MICROPY_BOARD=ESP32_GENERIC build
$ idf.py flash
```

Some boards also support "variants", which are allow for small variations of
an otherwise similar board. For example different flash sizes or features. For
example to build the `OTA` variant of `ESP32_GENERIC`.

```bash
$ make BOARD=ESP32_GENERIC BOARD_VARIANT=OTA
```

or to enable octal-SPIRAM support for the `ESP32_GENERIC_S3` board:

```bash
$ make BOARD=ESP32_GENERIC BOARD_VARIANT=SPIRAM_OCT
```


Getting a Python prompt on the device
-------------------------------------

Expand Down Expand Up @@ -202,10 +217,10 @@ antenna = machine.Pin(16, machine.Pin.OUT, value=0)
Defining a custom ESP32 board
-----------------------------

The default ESP-IDF configuration settings are provided by the `GENERIC`
board definition in the directory `boards/GENERIC`. For a custom configuration
The default ESP-IDF configuration settings are provided by the `ESP32_GENERIC`
board definition in the directory `boards/ESP32_GENERIC`. For a custom configuration
you can define your own board directory. Start a new board configuration by
copying an existing one (like `GENERIC`) and modifying it to suit your board.
copying an existing one (like `ESP32_GENERIC`) and modifying it to suit your board.

MicroPython specific configuration values are defined in the board-specific
`mpconfigboard.h` file, which is included by `mpconfigport.h`. Additional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"External Flash",
"WiFi"
],
"id": "esp32",
"images": [
"esp32_devkitc.jpg"
],
Expand All @@ -17,11 +16,11 @@
"thumbnail": "",
"url": "https://www.espressif.com/en/products/modules",
"variants": {
"idf3": "Compiled with IDF 3.x",
"d2wd": "ESP32 D2WD",
"spiram": "Support for SPIRAM / WROVER",
"unicore": "ESP32 Unicore",
"ota": "Support for OTA"
"IDF3": "Compiled with IDF 3.x",
"D2WD": "ESP32 D2WD",
"SPIRAM": "Support for SPIRAM / WROVER",
"UNICORE": "ESP32 Unicore",
"OTA": "Support for OTA"
},
"vendor": "Espressif"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ set(SDKCONFIG_DEFAULTS
boards/sdkconfig.ble
)

if(MICROPY_BOARD_VARIANT STREQUAL "d2wd")
if(MICROPY_BOARD_VARIANT STREQUAL "D2WD")
set(SDKCONFIG_DEFAULTS
${SDKCONFIG_DEFAULTS}
boards/GENERIC/sdkconfig.d2wd
boards/ESP32_GENERIC/sdkconfig.d2wd
)

list(APPEND MICROPY_DEF_BOARD
MICROPY_HW_MCU_NAME="ESP32-D2WD"
)
endif()

if(MICROPY_BOARD_VARIANT STREQUAL "ota")
if(MICROPY_BOARD_VARIANT STREQUAL "OTA")
set(SDKCONFIG_DEFAULTS
${SDKCONFIG_DEFAULTS}
boards/GENERIC/sdkconfig.ota
boards/ESP32_GENERIC/sdkconfig.ota
)

list(APPEND MICROPY_DEF_BOARD
MICROPY_HW_BOARD_NAME="Generic ESP32 module with OTA"
)
endif()

if(MICROPY_BOARD_VARIANT STREQUAL "spiram")
if(MICROPY_BOARD_VARIANT STREQUAL "SPIRAM")
set(SDKCONFIG_DEFAULTS
${SDKCONFIG_DEFAULTS}
boards/sdkconfig.spiram
Expand All @@ -36,10 +36,10 @@ if(MICROPY_BOARD_VARIANT STREQUAL "spiram")
)
endif()

if(MICROPY_BOARD_VARIANT STREQUAL "unicore")
if(MICROPY_BOARD_VARIANT STREQUAL "UNICORE")
set(SDKCONFIG_DEFAULTS
${SDKCONFIG_DEFAULTS}
boards/GENERIC/sdkconfig.unicore
boards/ESP32_GENERIC/sdkconfig.unicore
)

list(APPEND MICROPY_DEF_BOARD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"External Flash",
"WiFi"
],
"id": "esp32c3",
"images": [
"esp32c3_devkitmini.jpg"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set(IDF_TARGET esp32c3)
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
boards/sdkconfig.ble
boards/GENERIC_C3/sdkconfig.c3usb
boards/ESP32_GENERIC_C3/sdkconfig.c3usb
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
#define MICROPY_HW_ENABLE_SDCARD (0)
#define MICROPY_PY_MACHINE_DAC (0)
#define MICROPY_PY_MACHINE_I2S (0)

// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
#define MICROPY_HW_ENABLE_UART_REPL (1)
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"url": "https://www.espressif.com/en/products/modules",
"vendor": "Espressif",
"variants": {
"spiram-oct": "Support for Octal-SPIRAM"
"SPIRAM_OCT": "Support for Octal-SPIRAM"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ set(SDKCONFIG_DEFAULTS
boards/sdkconfig.usb
boards/sdkconfig.ble
boards/sdkconfig.spiram_sx
boards/GENERIC_S3/sdkconfig.board
boards/ESP32_GENERIC_S3/sdkconfig.board
)

if(MICROPY_BOARD_VARIANT STREQUAL "spiram-oct")
if(MICROPY_BOARD_VARIANT STREQUAL "SPIRAM_OCT")
set(SDKCONFIG_DEFAULTS
${SDKCONFIG_DEFAULTS}
boards/sdkconfig.240mhz
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/SIL_WESP32/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"PoE",
"WiFi"
],
"id": "wesp32",
"images": [
"wesp32-iso.jpg",
"wesp32-top.jpg"
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_FEATHERS2/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"features_non_filterable": [
"Second LDO"
],
"id": "featherS2",
"images": [
"unexpectedmaker_feathers2.jpg"
],
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_FEATHERS2NEO/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"features_non_filterable": [
"5x5 RGB LED Matrix"
],
"id": "featherS2neo",
"images": [
"FeatherS2_Neo_White_Product2.jpg"
],
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_FEATHERS3/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"WiFi"
],
"features_non_filterable": [],
"id": "feathers3",
"images": [
"unexpectedmaker_feathers3.jpg"
],
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_PROS3/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"WiFi"
],
"features_non_filterable": [],
"id": "pros3",
"images": [
"unexpectedmaker_pros3.jpg"
],
Expand Down
3 changes: 1 addition & 2 deletions ports/esp32/boards/UM_TINYPICO/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"features_non_filterable": [
"TinyPICO Compatible"
],
"id": "tinypico",
"images": [
"tinypico-v2-both.jpg"
],
Expand All @@ -24,7 +23,7 @@
"thumbnail": "",
"url": "https://www.tinypico.com/",
"variants": {
"idf3": "Compiled with IDF 3.x"
"IDF3": "Compiled with IDF 3.x"
},
"vendor": "Unexpected Maker"
}
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_TINYS2/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"features_non_filterable": [
"TinyPICO Compatible"
],
"id": "tinys2",
"images": [
"TinyS2+Product+Shot.jpg"
],
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/UM_TINYS3/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"features_non_filterable": [
"TinyPICO Compatible"
],
"id": "tinys3",
"images": [
"unexpectedmaker_tinys3.jpg"
],
Expand Down
32 changes: 23 additions & 9 deletions ports/esp8266/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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 $<

Expand All @@ -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:
Expand Down
Loading
0