Skip to content

Commit

Permalink
Add SDK_CUSTOM_CONFIG, rename sdk-menuconfig-clean target to `sdk…
Browse files Browse the repository at this point in the history
…-config-clean`.
  • Loading branch information
mikee47 committed Sep 3, 2021
1 parent a5d4621 commit 344f694
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 24 deletions.
5 changes: 4 additions & 1 deletion Sming/Arch/Esp32/Components/esp32/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
32 changes: 22 additions & 10 deletions Sming/Arch/Esp32/Components/esp32/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 >> $@;) \
)

Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Sming/Arch/Esp32/Components/esp32/sdk/config/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions Sming/Arch/Esp32/Components/esp32/sdk/config/esp32.common

This file was deleted.

18 changes: 17 additions & 1 deletion Sming/Arch/Esp32/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://docs.espressif.com/projects/esp-idf/en/v4.3/get-started/index.html#installation-step-by-step>`__.

Expand Down

0 comments on commit 344f694

Please sign in to comment.