Use IDF_PATH instead of SDK_PATH for the environment variable pointing to esp-idf

This will require a matching change in all projects using ESP-IDF.
This commit is contained in:
Angus Gratton 2016-08-19 14:32:35 +08:00
parent 9ec0e1545d
commit f853f94335
19 changed files with 43 additions and 43 deletions

View file

@ -127,7 +127,7 @@ all components and make the elf target depend on this. The targets
invoke Make on the makefiles of the components in a subshell: this way
the components have full freedom to do whatever is necessary to build
the library without influencing other components. By default, the
component includes the utility makefile $(SDK_PATH)/make/component.mk.
component includes the utility makefile $(IDF_PATH)/make/component.mk.
This provides default targets and configurations that will work
out-of-the-box for most projects.
@ -158,7 +158,7 @@ minimum, it will just include the ESP-IDF component makefile, which adds
component functionality:
----8<----
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk
---->8----
This will take all the .c and .S files in the component root and compile
@ -169,7 +169,7 @@ system by setting COMPONENT_SRCDIRS:
----8<----
COMPONENT_SRCDIRS := src1 src2
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk
---->8----
This will compile all source files in the src1/ and src2/ subdirectories
@ -183,7 +183,7 @@ objects that need to be generated:
----8<----
COMPONENT_OBJS := file1.o file2.o thing/filea.o thing/fileb.o anotherthing/main.o
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk
---->8----
This can also be used in order to conditionally compile some files
@ -200,7 +200,7 @@ config FOO_ENABLE_BAR
Makefile:
----8<----
COMPONENT_OBJS := foo_a.o foo_b.o $(if $(CONFIG_FOO_ENABLE_BAR),foo_bar.o foo_bar_interface.o)
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk
---->8----
Some components will have a situation where a source file isn't supplied
@ -217,7 +217,7 @@ graphics_lib.o: logo.h
logo.h: $(COMPONENT_PATH)/logo.bmp
bmp2h -i $^ -o $@
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk
---->8----
In this example, graphics_lib.o and logo.h will be generated in the
@ -242,7 +242,7 @@ logo.h: $(COMPONENT_PATH)/logo.bmp
$(vecho) BMP2H $@
$(Q) bmp2h -i $^ -o $@
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk
---->8----
Obviously, there are cases where all these recipes are insufficient for a

View file

@ -9,4 +9,4 @@ COMPONENTS := esptool_py
#We cannot include the esp32 component directly but we need its includes. This is fixed by
#adding it in the main/Makefile directory.
include $(SDK_PATH)/make/project.mk
include $(IDF_PATH)/make/project.mk

View file

@ -1,13 +1,13 @@
#
# Main Makefile. This is basically the same as a component makefile.
#
# This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default,
# This Makefile should, at the very least, just include $(IDF_PATH)/make/component.mk. By default,
# this will take the sources in the src/ directory, compile them and link them into
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the esp-idf build system document if you need to do this.
#
COMPONENT_ADD_LDFLAGS := -L $(abspath .) -lmain -T eagle.bootloader.ld -T $(SDK_PATH)/components/esp32/ld/eagle.fpga32.rom.addr.v7.ld
COMPONENT_EXTRA_INCLUDES := $(SDK_PATH)/components/esp32/include
COMPONENT_ADD_LDFLAGS := -L $(abspath .) -lmain -T eagle.bootloader.ld -T $(IDF_PATH)/components/esp32/ld/eagle.fpga32.rom.addr.v7.ld
COMPONENT_EXTRA_INCLUDES := $(IDF_PATH)/components/esp32/include
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk

View file

@ -1,23 +1,23 @@
#
# Component Makefile
#
# This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default,
# This Makefile should, at the very least, just include $(IDF_PATH)/make/component.mk. By default,
# this will take the sources in this directory, compile them and link them into
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the SDK documents if you need to do this.
# please read the esp-idf build system document if you need to do this.
#
LIBS := crypto core net80211 phy rtc pp wpa wps
COMPONENT_ADD_LDFLAGS := -lesp32 \
$(abspath libhal.a) \
-L$(abspath lib) \
$(addprefix -l,$(LIBS)) \
-L $(abspath ld) \
-T eagle.fpga32.v7.ld \
-T eagle.fpga32.rom.addr.v7.ld
-T eagle.fpga32.rom.addr.v7.ld
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk
ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
@ -25,10 +25,10 @@ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
# be invoked if any modules are missing (probably because
# git submodule update --init needs to be run).
$(ALL_LIB_FILES):
$(Q) [ -d ${SDK_PATH}/.git ] || ( @echo "ERROR: Missing libraries in esp32 component. esp-idf must be cloned from git to work."; exit 1 )
$(Q) [ -d ${IDF_PATH}/.git ] || ( @echo "ERROR: Missing libraries in esp32 component. esp-idf must be cloned from git to work."; exit 1 )
$(Q) [ -x $(which git) ] || ( @echo "ERROR: Missing libraries in esp32 component. Need to run 'git submodule update --init' in esp-idf root directory."; exit 1 )
@echo "Warning: Missing libraries in components/esp32/lib/ submodule. Going to try running 'git submodule update --init' in esp-idf root directory..."
cd ${SDK_PATH} && git submodule update --init
cd ${IDF_PATH} && git submodule update --init
# adding $(ALL_LIB_FILES) as a build dependency here is a hack to make
# sure they get evaluated. Once TW6630 lands and we have library file

View file

@ -9,7 +9,7 @@ PYTHON ?= $(call dequote,$(CONFIG_PYTHON))
# to invoke esptool.py (with or without serial port args)
#
# NB: esptool.py lives in the sdk/bin directory not the component directory
ESPTOOLPY := $(PYTHON) $(SDK_PATH)/bin/esptool.py --chip esp32
ESPTOOLPY := $(PYTHON) $(IDF_PATH)/bin/esptool.py --chip esp32
ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD)
APP_FLASH_COMMAND=$(ESPTOOLPY_SERIAL) write_flash $(CONFIG_APP_OFFSET) $(APP_BIN)

View file

@ -5,4 +5,4 @@
COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_PRIV_INCLUDEDIRS := include/freertos
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk

View file

@ -8,4 +8,4 @@ COMPONENT_SRCDIRS := api apps core/ipv4 core/ipv6 core netif port/freertos port/
EXTRA_CFLAGS := -Wno-error=address -Waddress -DLWIP_ESP8266
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk

View file

@ -5,4 +5,4 @@ define COMPONENT_BUILDRECIPE
#Nothing to do; this does not generate a library.
endef
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk

View file

@ -6,4 +6,4 @@ COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_SRCDIRS := src
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk

View file

@ -9,7 +9,7 @@
.PHONY: partition_table partition_table-flash partition_table-clean
# NB: gen_esp32part.py lives in the sdk/bin/ dir not component dir
GEN_ESP32PART := $(PYTHON) $(SDK_PATH)/bin/gen_esp32part.py -q
GEN_ESP32PART := $(PYTHON) $(IDF_PATH)/bin/gen_esp32part.py -q
# Path to partition CSV file is relative to project path for custom
# partition CSV files, but relative to component dir otherwise.$

View file

@ -1,3 +1,3 @@
COMPONENT_ADD_INCLUDEDIRS := include
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk

View file

@ -4,4 +4,4 @@
EXTRA_CFLAGS := -DLWIP_ESP8266
include $(SDK_PATH)/make/component.mk
include $(IDF_PATH)/make/component.mk

View file

@ -35,13 +35,13 @@ Project Properties
* Click on the "Environment" properties page under "C/C++ Build". Click "Add..." and enter name ``V`` and value ``1``.
* Click "Add..." again, and enter name ``SDK_PATH``. The value should be the full path where ESP-IDF is installed. *Windows users: Use forward-slashes not backslashes for this path, ie C:/Users/MyUser/Development/esp-idf*.
* Click "Add..." again, and enter name ``IDF_PATH``. The value should be the full path where ESP-IDF is installed. *Windows users: Use forward-slashes not backslashes for this path, ie C:/Users/MyUser/Development/esp-idf*.
*Windows users only, follow these two additional steps:*
* On the same Environment property page, edit the PATH environment variable and append ``;C:\msys32\usr\bin;C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin`` to the end of the default value. (If you installed msys32 to a different directory then you'll need to change these paths to match.)
* Click on the "C/C++ Build" top-level properties page then uncheck "Use default build command" and enter this for the custom build command: ``bash ${SDK_PATH}/bin/eclipse_windows_make.sh``.
* Click on the "C/C++ Build" top-level properties page then uncheck "Use default build command" and enter this for the custom build command: ``bash ${IDF_PATH}/bin/eclipse_windows_make.sh``.
*All users, continue with these steps:*

View file

@ -64,7 +64,7 @@ Step 4: Configuring the project
Open an MSYS2 terminal window by running ``C:\msys32\msys2_shell.cmd``. The environment in this window is a bash shell.
Type a command like this to set the path to ESP-IDF directory: ``export SDK_PATH="C:/path/to/esp-idf"`` (note the forward-slashes not back-slashes for the path). If you don't want to run this command every time you open an MSYS2 window, create a new file in ``C:/msys32/etc/profile.d/`` and paste this line in - then it will be run each time you open an MYS2 terminal.
Type a command like this to set the path to ESP-IDF directory: ``export IDF_PATH="C:/path/to/esp-idf"`` (note the forward-slashes not back-slashes for the path). If you don't want to run this command every time you open an MSYS2 window, create a new file in ``C:/msys32/etc/profile.d/`` and paste this line in - then it will be run each time you open an MYS2 terminal.
Use ``cd`` to change to the project directory (not the ESP-IDF directory.) Type ``make menuconfig`` to configure your project, then ``make`` to build it, ``make clean`` to remove built files, and ``make flash`` to flash (use the menuconfig to set the serial port for flashing.)

View file

@ -10,8 +10,8 @@
ifeq ("$(LDFLAGS)","")
LDFLAGS = -nostdlib \
-L$(SDK_PATH)/lib \
-L$(SDK_PATH)/ld \
-L$(IDF_PATH)/lib \
-L$(IDF_PATH)/ld \
$(addprefix -L$(BUILD_DIR_BASE)/,$(COMPONENTS) $(SRCDIRS)) \
-u call_user_start_cpu0 \
-Wl,--gc-sections \

View file

@ -10,7 +10,7 @@
#
#
# This Makefile requires the environment variable SDK_PATH to be set
# This Makefile requires the environment variable IDF_PATH to be set
# to the top-level directory where ESP-IDF is located (the directory
# containing this 'make' directory).
#
@ -23,7 +23,7 @@ endif
COMPONENT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
export COMPONENT_PATH
include $(SDK_PATH)/make/common.mk
include $(IDF_PATH)/make/common.mk
#Some of these options are overridable by the components Makefile.

View file

@ -6,7 +6,7 @@
#
#
# This Makefile requires the environment variable SDK_PATH to be set to the directory where this
# This Makefile requires the environment variable IDF_PATH to be set to the directory where this
# Makefile is located.
#
@ -52,7 +52,7 @@ BUILD_DIR_BASE ?= $(PROJECT_PATH)/build
#Component directories. These directories are searched for components.
#The project Makefile can override these component dirs, or define extra component directories.
COMPONENT_DIRS ?= $(PROJECT_PATH)/components $(EXTRA_COMPONENT_DIRS) $(SDK_PATH)/components
COMPONENT_DIRS ?= $(PROJECT_PATH)/components $(EXTRA_COMPONENT_DIRS) $(IDF_PATH)/components
export COMPONENT_DIRS
#The project Makefile can define a list of components, but if it does not do this we just take
@ -130,7 +130,7 @@ $(foreach comp,$(COMPONENT_PATHS_BUILDABLE), $(eval $(call GenerateComponentDepe
export PROJECT_PATH
#Include functionality common to both project & component
-include $(SDK_PATH)/make/common.mk
-include $(IDF_PATH)/make/common.mk
#Set host compiler and binutils
HOSTCC := $(CC)
@ -163,7 +163,7 @@ endef
$(foreach componentpath,$(COMPONENT_PATHS),$(eval $(call includeProjBuildMakefile,$(componentpath))))
# once we know component paths, we can include the config
include $(SDK_PATH)/make/project_config.mk
include $(IDF_PATH)/make/project_config.mk
# ELF depends on the -build target of every component
$(APP_ELF): $(addsuffix -build,$(notdir $(COMPONENT_PATHS_BUILDABLE)))

View file

@ -5,7 +5,7 @@ COMPONENT_KCONFIGS := $(foreach component,$(COMPONENT_PATHS),$(wildcard $(compon
COMPONENT_KCONFIGS_PROJBUILD := $(foreach component,$(COMPONENT_PATHS),$(wildcard $(component)/Kconfig.projbuild))
#For doing make menuconfig etc
KCONFIG_TOOL_DIR=$(SDK_PATH)/tools/kconfig
KCONFIG_TOOL_DIR=$(IDF_PATH)/tools/kconfig
# clear MAKEFLAGS as the menuconfig makefile uses implicit compile rules
$(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
@ -15,13 +15,13 @@ $(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
CC=$(HOSTCC) LD=$(HOSTLD) \
$(MAKE) -C $(KCONFIG_TOOL_DIR)
menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(SDK_PATH)/Kconfig $(BUILD_DIR_BASE)
menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(BUILD_DIR_BASE)
$(vecho) MENUCONFIG
$(Q) KCONFIG_AUTOHEADER=$(PROJECT_PATH)/build/include/sdkconfig.h \
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
$(KCONFIG_TOOL_DIR)/mconf $(SDK_PATH)/Kconfig
$(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig
ifeq ("$(wildcard $(PROJECT_PATH)/sdkconfig)","")
#No sdkconfig found. Need to run menuconfig to make this if we need it.
@ -51,7 +51,7 @@ $(AUTO_CONF_REGEN_TARGET) $(PROJECT_PATH)/build/include/sdkconfig.h: $(PROJECT_P
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
$(KCONFIG_TOOL_DIR)/conf --silentoldconfig $(SDK_PATH)/Kconfig
$(KCONFIG_TOOL_DIR)/conf --silentoldconfig $(IDF_PATH)/Kconfig
$(Q) touch $(AUTO_CONF_REGEN_TARGET) $(PROJECT_PATH)/build/include/sdkconfig.h
# touch to ensure both output files are newer - as 'conf' can also update sdkconfig (a dependency). Without this,
# sometimes you can get an infinite make loop on Windows where sdkconfig always gets regenerated newer

View file

@ -53,7 +53,7 @@ echo "your path. Execute 'msys_shell.cmd' to launch an"
echo "MSYS terminal."
echo
echo "Once ESP-IDF is downloaded/checked out, set the"
echo "environment variable SDK_PATH in /etc/profile to"
echo "environment variable IDF_PATH in /etc/profile to"
echo "point to the directory."
echo "************************************************"
echo