From bb19e08cde1bf1720ddb65ce1dbfb0dc441f7d6b Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Wed, 3 May 2017 13:13:13 -0700 Subject: [PATCH] Support for Espressif SDK (ESP32, etc) Three environment variables must be set to use this variant: export ZEPHYR_GCC_VARIANT="espressif" export ESP_IDF_PATH=/path/to/esp-idf export ESPRESSIF_TOOLCHAIN_PATH=/path/to/xtensa-esp32-elf/ ESP-IDF is the SDK provided by Espressif. It contains, among other things, the HAL and header files for registers and ROM functions used by the Zephyr port. At this stage, with the exception of the HAL library, none of the binary blobs provided by ESP-IDF are used. This can be obtained directly from Espressif, at . Instructions on how to obtain the toolchain are detailed in the README for ESP-IDF. Signed-off-by: Leandro Pereira --- scripts/Makefile.toolchain.espressif | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/Makefile.toolchain.espressif diff --git a/scripts/Makefile.toolchain.espressif b/scripts/Makefile.toolchain.espressif new file mode 100644 index 00000000000..0467b45319b --- /dev/null +++ b/scripts/Makefile.toolchain.espressif @@ -0,0 +1,21 @@ +ifndef ESPRESSIF_TOOLCHAIN_PATH +$(error ESPRESSIF_TOOLCHAIN_PATH is not set) +endif + +ifndef ESP_IDF_PATH +$(error ESP_IDF_PATH is not set) +endif + +CROSS_COMPILE = ${ESPRESSIF_TOOLCHAIN_PATH}/bin/xtensa-esp32-elf- + +TOOLCHAIN_LIBS = gcc hal +LIBGCC_DIR = $(shell dirname `$(CROSS_COMPILE)gcc ${KBUILD_CFLAGS} -print-libgcc-file-name`) + +LIB_INCLUDE_DIR += -L${ESP_IDF_PATH}/components/esp32 -L${LIBGCC_DIR} +TOOLCHAIN_CFLAGS = -I${ESPRESSIF_TOOLCHAIN_PATH}/xtensa-esp32-elf/include + +ZEPHYRINCLUDE += -I${ESP_IDF_PATH}/components/esp32/include +ZEPHYRINCLUDE += -I${ESP_IDF_PATH}/components/soc/esp32/include + +export CROSS_COMPILE TOOLCHAIN_LIBS TOOLCHAIN_CFLAGS LIB_INCLUDE_DIR +