From 2285dd1838fba467f800ad6c114569fb07101909 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 21 Oct 2022 17:11:56 +0530 Subject: [PATCH 1/2] update espressif risc-v build configuration - use optimization level O2 - explicitly state risc-v arch --- ports/espressif/Makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index ebf636bb39..30c35f9caf 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -163,12 +163,9 @@ ifeq ($(DEBUG), 1) # CFLAGS += -fno-inline -fno-ipa-sra else CFLAGS += -DNDEBUG -ggdb3 - ifeq ($(IDF_TARGET_ARCH),xtensa) - OPTIMIZATION_FLAGS ?= -O2 - else - # RISC-V is larger than xtensa so do -Os for it - OPTIMIZATION_FLAGS ?= -Os - endif + OPTIMIZATION_FLAGS ?= -O2 + # RISC-V is larger than xtensa + # Use -Os for RISC-V when it overflows endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk @@ -178,6 +175,8 @@ CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_D ifeq ($(IDF_TARGET_ARCH),xtensa) CFLAGS += -mlongcalls +else ifeq ($(IDF_TARGET_ARCH),riscv) +CFLAGS += -march=rv32imc endif LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority From 5b2728bd65a9b6463dd33326d8400d57ef3b10f8 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Fri, 21 Oct 2022 17:13:19 +0530 Subject: [PATCH 2/2] reorganize espressif `mpconfigport.mk` --- ports/espressif/mpconfigport.mk | 77 ++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 404f47cfe9..241cbcd0df 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -7,77 +7,86 @@ INTERNAL_LIBM = 1 # Longints can be implemented as mpz, as longlong, or not LONGINT_IMPL = MPZ -# These modules are implemented in ports//common-hal: +# Enable more features CIRCUITPY_FULL_BUILD ?= 1 + +# These modules are implemented in ports//common-hal: CIRCUITPY_ALARM ?= 1 -CIRCUITPY_AUDIOCORE ?= 1 -CIRCUITPY_AUDIOMP3 ?= 0 CIRCUITPY_AUDIOBUSIO ?= 1 -CIRCUITPY_AUDIOBUSIO_PDMIN ?= 0 CIRCUITPY_AUDIOBUSIO_I2SOUT ?= 1 +CIRCUITPY_AUDIOBUSIO_PDMIN ?= 0 +CIRCUITPY_AUDIOCORE ?= 1 CIRCUITPY_AUDIOIO ?= 0 CIRCUITPY_AUDIOMIXER ?= 1 +CIRCUITPY_AUDIOMP3 ?= 0 +CIRCUITPY_BLEIO ?= 1 +CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_CANIO ?= 1 -CIRCUITPY_COUNTIO ?= 1 CIRCUITPY_COPROC ?= 1 +CIRCUITPY_COUNTIO ?= 1 CIRCUITPY_DUALBANK ?= 1 +CIRCUITPY_ESPIDF ?= 1 CIRCUITPY_FRAMEBUFFERIO ?= 1 CIRCUITPY_FREQUENCYIO ?= 1 CIRCUITPY_HASHLIB ?= 1 -CIRCUITPY_IMAGECAPTURE ?= 0 CIRCUITPY_I2CTARGET ?= 1 -CIRCUITPY_RGBMATRIX ?= 1 -CIRCUITPY_ROTARYIO ?= 1 +CIRCUITPY_IMAGECAPTURE = 0 CIRCUITPY_NVM ?= 1 CIRCUITPY_PS2IO ?= 1 +CIRCUITPY_RGBMATRIX ?= 1 +CIRCUITPY_ROTARYIO ?= 1 CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1 -CIRCUITPY_WIFI ?= 1 CIRCUITPY_WATCHDOG ?= 1 +CIRCUITPY_WIFI ?= 1 -CIRCUITPY_ESPIDF ?= 1 - +# Conditionally turn off modules/features ifeq ($(IDF_TARGET),esp32) +# Modules CIRCUITPY_BLEIO = 0 -CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_COPROC = 0 CIRCUITPY_PARALLELDISPLAY = 0 -# Protomatter needs to support ESP32. CIRCUITPY_RGBMATRIX = 0 +# Features CIRCUITPY_USB = 0 -CIRCUITPY_BUILD_EXTENSIONS ?= bin -CIRCUITPY_ESP32_CAMERA ?= 1 else ifeq ($(IDF_TARGET),esp32c3) -CIRCUITPY_AESIO = 0 +# Modules CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 -CIRCUITPY_BLEIO = 1 -CIRCUITPY_BLEIO_HCI = 0 -CIRCUITPY_COUNTIO = 0 CIRCUITPY_COPROC = 0 -CIRCUITPY_DUALBANK = 0 +CIRCUITPY_COUNTIO = 0 +CIRCUITPY_ESP32_CAMERA = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_PARALLELDISPLAY = 0 -CIRCUITPY_PS2IO = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_TOUCHIO ?= 1 CIRCUITPY_TOUCHIO_USE_NATIVE = 0 +# Features CIRCUITPY_USB = 0 -CIRCUITPY_BUILD_EXTENSIONS ?= bin - -else ifeq ($(IDF_TARGET),esp32s3) -CIRCUITPY_BLEIO = 1 -CIRCUITPY_BLEIO_HCI = 0 -CIRCUITPY_PARALLELDISPLAY = 0 -CIRCUITPY_BUILD_EXTENSIONS ?= bin,uf2 -CIRCUITPY_ESP32_CAMERA ?= 1 else ifeq ($(IDF_TARGET),esp32s2) -# No BLE on S2 +# Modules CIRCUITPY_BLEIO = 0 -CIRCUITPY_BLEIO_HCI = 0 + +else ifeq ($(IDF_TARGET),esp32s3) +# Modules +CIRCUITPY_PARALLELDISPLAY = 0 +endif + +# No room for dualbank on boards with 2MB flash +ifeq ($(CIRCUITPY_ESP_FLASH_SIZE),2MB) +CIRCUITPY_DUALBANK = 0 +endif + +# Modules dependent on other modules +CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESP32_CAMERA) +CIRCUITPY_QRIO ?= $(CIRCUITPY_ESP32_CAMERA) + +# Features dependent on other features +ifneq ($(CIRCUITPY_USB),0) CIRCUITPY_BUILD_EXTENSIONS ?= bin,uf2 -CIRCUITPY_ESP32_CAMERA ?= 1 +else +CIRCUITPY_BUILD_EXTENSIONS ?= bin endif # From ESP32-S2/S3 Technical Reference Manual: @@ -91,7 +100,3 @@ endif # only if something else is turned off, such as HID. USB_NUM_ENDPOINT_PAIRS = 7 USB_NUM_IN_ENDPOINTS = 5 - -CIRCUITPY_ESP32_CAMERA ?= 0 -CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESP32_CAMERA) -CIRCUITPY_QRIO ?= $(CIRCUITPY_ESP32_CAMERA)