From 344f694ce2022c0cf7c5d49511eef89524548edf Mon Sep 17 00:00:00 2001 From: mikee47 Date: Fri, 3 Sep 2021 20:14:36 +0100 Subject: [PATCH] Add `SDK_CUSTOM_CONFIG`, rename `sdk-menuconfig-clean` target to `sdk-config-clean`. --- Sming/Arch/Esp32/Components/esp32/README.rst | 5 ++- .../Arch/Esp32/Components/esp32/component.mk | 32 +++++++++++++------ .../Components/esp32/sdk/config/README.rst | 6 +++- .../Components/esp32/sdk/config/esp32.common | 11 ------- Sming/Arch/Esp32/README.rst | 18 ++++++++++- 5 files changed, 48 insertions(+), 24 deletions(-) delete mode 100644 Sming/Arch/Esp32/Components/esp32/sdk/config/esp32.common diff --git a/Sming/Arch/Esp32/Components/esp32/README.rst b/Sming/Arch/Esp32/Components/esp32/README.rst index f44e74d97f..94c906a6ee 100644 --- a/Sming/Arch/Esp32/Components/esp32/README.rst +++ b/Sming/Arch/Esp32/Components/esp32/README.rst @@ -66,4 +66,7 @@ The default configuration settings are obtained from ``sdk/config`` and written to ``project/{ESP_VARIANT}/sdkconfig.defaults``. When ``sdk-menuconfig`` is run, the ``project/{ESP_VARIANT}/sdkconfig`` is modified. -This can be reset using ``make sdk-menuconfig-clean``. +This can be reset using ``make sdk-config-clean``. + +If custom settings are required for a project then place these in a separate file +and set :envvar:`SDK_CUSTOM_CONFIG` to the location, relative to the project source root directory. diff --git a/Sming/Arch/Esp32/Components/esp32/component.mk b/Sming/Arch/Esp32/Components/esp32/component.mk index 41756f3e77..a10569902a 100644 --- a/Sming/Arch/Esp32/Components/esp32/component.mk +++ b/Sming/Arch/Esp32/Components/esp32/component.mk @@ -11,6 +11,9 @@ COMPONENT_INCDIRS := src/include include CACHE_VARS += SDK_FULL_BUILD SDK_FULL_BUILD ?= 0 +# Applications can provide file with custom SDK configuration settings +CACHE_VARS += SDK_CUSTOM_CONFIG + COMPONENT_RELINK_VARS += DISABLE_NETWORK DISABLE_WIFI SDK_BUILD_BASE := $(COMPONENT_BUILD_BASE)/$(ESP_VARIANT)/sdk @@ -308,10 +311,6 @@ FLASH_BOOT_CHUNKS := 0x1000=$(FLASH_BOOT_LOADER) SDK_DEFAULT_PATH := $(COMPONENT_PATH)/sdk -##@Partitions - -SDK_PARTITION_PATH := $(SDK_DEFAULT_PATH)/partitions - ##@SDK SDK_PROJECT_PATH := $(COMPONENT_PATH)/project/$(ESP_VARIANT) @@ -356,10 +355,23 @@ $(SDK_PROJECT_PATH): $(SDK_COMPONENT_LIBS): $(SDK_BUILD_COMPLETE) -SDK_CONFIG_FILES := common $(BUILD_TYPE) $(ESP_VARIANT).common $(ESP_VARIANT).$(BUILD_TYPE) +SDK_CONFIG_FILES := \ + common \ + $(BUILD_TYPE) \ + $(ESP_VARIANT).common \ + $(ESP_VARIANT).$(BUILD_TYPE) + +ifdef SDK_CUSTOM_CONFIG +SDK_CUSTOM_CONFIG_PATH := $(call AbsoluteSourcePath,$(PROJECT_DIR),$(SDK_CUSTOM_CONFIG)) +endif + +SDK_CONFIG_FILES := \ + $(addprefix $(SDK_DEFAULT_PATH)/config/,$(SDK_CONFIG_FILES)) \ + $(SDK_CUSTOM_CONFIG_PATH) -$(SDK_CONFIG_DEFAULTS): - $(foreach f,$(addprefix $(SDK_DEFAULT_PATH)/config/,$(SDK_CONFIG_FILES)),\ +$(SDK_CONFIG_DEFAULTS): $(SDK_CUSTOM_CONFIG_PATH) + @echo Creating $(SDK_CONFIG_DEFAULTS) + $(Q) $(foreach f,$(SDK_CONFIG_FILES),\ $(if $(wildcard $f),cat $f >> $@;) \ ) @@ -372,9 +384,9 @@ sdk-menuconfig: $(SDK_CONFIG_DEFAULTS) | $(SDK_BUILD_BASE) ##Configure SDK optio .PHONY: sdk-defconfig sdk-defconfig: $(SDKCONFIG_H) ##Create default SDK config files -.PHONY: sdk-menuconfig-clean -sdk-menuconfig-clean: esp32-clean ##Wipe SDK configuration and revert to defaults - $(Q) rm -f $(SDKCONFIG_MAKEFILE) $(SDK_CONFIG_DEFAULTS) +.PHONY: sdk-config-clean +sdk-config-clean: esp32-clean ##Wipe SDK configuration and revert to defaults + $(Q) rm -rf $(SDK_PROJECT_PATH) .PHONY: sdk-help sdk-help: ##Get SDK build options diff --git a/Sming/Arch/Esp32/Components/esp32/sdk/config/README.rst b/Sming/Arch/Esp32/Components/esp32/sdk/config/README.rst index 2850743dda..404ff46990 100644 --- a/Sming/Arch/Esp32/Components/esp32/sdk/config/README.rst +++ b/Sming/Arch/Esp32/Components/esp32/sdk/config/README.rst @@ -10,8 +10,12 @@ The following files are assembled, in order: {BUILD_TYPE} {ESP_VARIANT}.common {ESP_VARIANT}.{BUILD_TYPE} + {PROJECT_DIR}/{SDK_CUSTOM_CONFIG} -Where ``{BUILD_TYPE}`` is ``debug`` or ``release``. +Where: + +- ``{BUILD_TYPE}`` is ``debug`` or ``release``. +- ``SDK_CUSTOM_CONFIG`` is optional and is always relative to the project root directory. To provide additional settings for a specific variant use the variant prefix such as ``esp32.debug``, ``esp32c3.release``, ``esp32s2.common``, etc. diff --git a/Sming/Arch/Esp32/Components/esp32/sdk/config/esp32.common b/Sming/Arch/Esp32/Components/esp32/sdk/config/esp32.common deleted file mode 100644 index 7380f825c0..0000000000 --- a/Sming/Arch/Esp32/Components/esp32/sdk/config/esp32.common +++ /dev/null @@ -1,11 +0,0 @@ -# -# COMMON -# - -# Ethernet -#CONFIG_ETH_USE_ESP32_EMAC=y -#CONFIG_ETH_PHY_INTERFACE_RMII=y -#CONFIG_ETH_RMII_CLK_INPUT=y -#CONFIG_ETH_RMII_CLK_IN_GPIO=0 -CONFIG_ETH_USE_SPI_ETHERNET=n - diff --git a/Sming/Arch/Esp32/README.rst b/Sming/Arch/Esp32/README.rst index abcc82a6a2..549d831f40 100644 --- a/Sming/Arch/Esp32/README.rst +++ b/Sming/Arch/Esp32/README.rst @@ -11,11 +11,27 @@ Build variables This contains the base directory for the ESP-IDF toolchain used to build the framework. This variable is required and must be set accordingly. + +.. envvar:: SDK_CUSTOM_CONFIG + + Custom SDK settings for a project can be defined in a separate file + and setting this value to the location, relative to the project source root directory. + + These will be added to the default SDK settings. + + To make the settings current, you must run ``make sdk-config-clean``. + This will discard any changes made via ``make sdk-menuconfig``. + + Requirements ------------ In order to be able to compile for the ESP32 architecture you should have ESP-IDF v4.3 installed. -The Sming installers can do this for you - see :doc:`/getting-started/index`. +Some slight changes are required to enable code to compile correctly for C++, +so a fork has been created here https://github.com/mikee47/esp-idf/tree/sming/release%2Fv4.3 +which you may clone. + +The Sming installers do all this for you - see :doc:`/getting-started/index`. You can find further details in the `ESP-IDF documentation `__.