Skip to content

Commit

Permalink
Remove SDK project duplication
Browse files Browse the repository at this point in the history
Project is created from a single default
Settings are assembled from multiple files
  • Loading branch information
mikee47 committed Sep 3, 2021
1 parent c636225 commit a5d4621
Show file tree
Hide file tree
Showing 26 changed files with 93 additions and 334 deletions.
4 changes: 1 addition & 3 deletions Sming/Arch/Esp32/Components/esp32/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
sdkconfig
sdkconfig.defaults
sdkconfig.old
project
33 changes: 16 additions & 17 deletions Sming/Arch/Esp32/Components/esp32/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,6 @@ Followed by::
Configuration variables
-----------------------

These are read-only debug variables:

.. envvar:: SDK_INTERNAL

**READONLY** When compiled using the current (version 3+) Espressif SDK this value is set to 1.


.. envvar:: SDK_LIBDIR

**READONLY** Path to the directory containing SDK archive libraries


.. envvar:: SDK_INCDIR

**READONLY** Path to the directory containing SDK header files


Option variables:

.. envvar:: ESP_VARIANT
Expand Down Expand Up @@ -68,3 +51,19 @@ or if multiple versions are installed. By default, the most current version will

Location of ESP-IDF python.


Background
----------

An empty ESP IDF project is built which generates a set of libraries and headers
which the framework can then be built against.

The project is located in ``project/{ESP_VARIANT}`.
The code for this project is copied from ``sdk/project``.

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``.
20 changes: 14 additions & 6 deletions Sming/Arch/Esp32/Components/esp32/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ SDK_FULL_BUILD ?= 0

COMPONENT_RELINK_VARS += DISABLE_NETWORK DISABLE_WIFI

SDK_BUILD_BASE := $(COMPONENT_BUILD_BASE)/sdk.$(ESP_VARIANT)
SDK_COMPONENT_LIBDIR := $(COMPONENT_BUILD_BASE)/lib.$(ESP_VARIANT)
SDK_BUILD_BASE := $(COMPONENT_BUILD_BASE)/$(ESP_VARIANT)/sdk
SDK_COMPONENT_LIBDIR := $(COMPONENT_BUILD_BASE)/$(ESP_VARIANT)/lib

SDKCONFIG_H := $(SDK_BUILD_BASE)/config/sdkconfig.h

Expand Down Expand Up @@ -314,7 +314,7 @@ SDK_PARTITION_PATH := $(SDK_DEFAULT_PATH)/partitions

##@SDK

SDK_PROJECT_PATH := $(COMPONENT_PATH)/project.$(ESP_VARIANT)
SDK_PROJECT_PATH := $(COMPONENT_PATH)/project/$(ESP_VARIANT)
SDK_CONFIG_DEFAULTS := $(SDK_PROJECT_PATH)/sdkconfig.defaults

SDKCONFIG_MAKEFILE := $(SDK_PROJECT_PATH)/sdkconfig
Expand All @@ -333,7 +333,7 @@ SDK_BUILD_COMPLETE := $(SDK_BUILD_BASE)/.complete
CUSTOM_TARGETS += checksdk

.PHONY: checksdk
checksdk: $(SDK_BUILD_COMPLETE)
checksdk: $(SDK_PROJECT_PATH) $(SDK_BUILD_COMPLETE)

SDK_BUILD = $(ESP32_PYTHON) $(IDF_PATH)/tools/idf.py -C $(SDK_PROJECT_PATH) -B $(SDK_BUILD_BASE) -G Ninja

Expand All @@ -348,12 +348,20 @@ $(SDK_BUILD_COMPLETE): $(SDKCONFIG_H) $(SDKCONFIG_MAKEFILE)
$(Q) $(MAKE) --no-print-directory -C $(SDK_DEFAULT_PATH) -f misc.mk copylibs
touch $(SDK_BUILD_COMPLETE)

$(SDKCONFIG_H) $(SDKCONFIG_MAKEFILE) $(SDK_COMPONENT_LIBS): $(SDK_CONFIG_DEFAULTS) | $(SDK_BUILD_BASE) $(SDK_COMPONENT_LIBDIR)
$(SDKCONFIG_H) $(SDKCONFIG_MAKEFILE) $(SDK_COMPONENT_LIBS): $(SDK_PROJECT_PATH) $(SDK_CONFIG_DEFAULTS) | $(SDK_BUILD_BASE) $(SDK_COMPONENT_LIBDIR)

$(SDK_PROJECT_PATH):
$(Q) mkdir -p $@
$(Q) cp -r $(SDK_DEFAULT_PATH)/project/* $@

$(SDK_COMPONENT_LIBS): $(SDK_BUILD_COMPLETE)

SDK_CONFIG_FILES := common $(BUILD_TYPE) $(ESP_VARIANT).common $(ESP_VARIANT).$(BUILD_TYPE)

$(SDK_CONFIG_DEFAULTS):
$(Q) cp $@.$(BUILD_TYPE) $@
$(foreach f,$(addprefix $(SDK_DEFAULT_PATH)/config/,$(SDK_CONFIG_FILES)),\
$(if $(wildcard $f),cat $f >> $@;) \
)

PHONY: sdk-menuconfig
sdk-menuconfig: $(SDK_CONFIG_DEFAULTS) | $(SDK_BUILD_BASE) ##Configure SDK options
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions Sming/Arch/Esp32/Components/esp32/project.esp32c3/main/main.c

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions Sming/Arch/Esp32/Components/esp32/project.esp32s2/main/main.c

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions Sming/Arch/Esp32/Components/esp32/project.esp32s3/main/main.c

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit a5d4621

Please sign in to comment.