Merge branch 'feature/toolchain_update' into 'master'

update toolchain version, rebuild newlib

- This MR updates the toolchain version used in the ESP-IDF
- Compiler version check and warning is added to project.mk
- Newlib is rebuilt to include wcsftime function
- libstdc++ build uses correct newlib headers (so we won't get undefined reference to `__impure_ptr` anymore)

See merge request !387
This commit is contained in:
Ivan Grokhotkov
2017-01-11 18:37:45 +08:00
7 changed files with 55 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
#include <functional> #include <functional>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <iostream>
#include "unity.h" #include "unity.h"
#include "esp_log.h" #include "esp_log.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
@@ -201,3 +202,9 @@ TEST_CASE("before scheduler has started, static initializers work correctly", "[
TEST_ASSERT_EQUAL(1, g_static_init_test3.index); TEST_ASSERT_EQUAL(1, g_static_init_test3.index);
TEST_ASSERT_EQUAL(2, StaticInitTestBeforeScheduler::order); TEST_ASSERT_EQUAL(2, StaticInitTestBeforeScheduler::order);
} }
TEST_CASE("can use iostreams", "[cxx]")
{
std::cout << "hello world";
}

Binary file not shown.

Binary file not shown.

View File

@@ -24,17 +24,17 @@ ESP32 toolchain for Linux is available for download from Espressif website:
- for 64-bit Linux:: - for 64-bit Linux::
https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-59.tar.gz https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
- for 32-bit Linux:: - for 32-bit Linux::
https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-59.tar.gz https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-61-gab8375a-5.2.0.tar.gz
Download this file, then extract it to the location you prefer, for example:: Download this file, then extract it to the location you prefer, for example::
mkdir -p ~/esp mkdir -p ~/esp
cd ~/esp cd ~/esp
tar -xzf ~/Downloads/xtensa-esp32-elf-linux64-1.22.0-59.tar.gz tar -xzf ~/Downloads/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
The toolchain will be extracted into ``~/esp/xtensa-esp32-elf/`` directory. The toolchain will be extracted into ``~/esp/xtensa-esp32-elf/`` directory.
@@ -67,6 +67,8 @@ If you can't think of a reason why you need to build it yourself, then probably
- if you want to customize toolchain build configuration - if you want to customize toolchain build configuration
- if you want to use a different GCC version (such as 4.8.5)
- if you want to hack gcc or newlib or libstdc++ - if you want to hack gcc or newlib or libstdc++
- if you are curious and/or have time to spare - if you are curious and/or have time to spare
@@ -79,7 +81,7 @@ In any case, here are the steps to compile the toolchain yourself.
- Ubuntu:: - Ubuntu::
sudo apt-get install gawk gperf grep gettext ncurses python python-dev automake bison flex texinfo help2man libtool sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool
- Debian:: - Debian::

View File

@@ -23,13 +23,13 @@ Step 1: Download binary toolchain for the ESP32
ESP32 toolchain for macOS is available for download from Espressif website: ESP32 toolchain for macOS is available for download from Espressif website:
https://dl.espressif.com/dl/xtensa-esp32-elf-osx-1.22.0-59.tar.gz https://dl.espressif.com/dl/xtensa-esp32-elf-osx-1.22.0-61-gab8375a-5.2.0.tar.gz
Download this file, then extract it to the location you prefer, for example:: Download this file, then extract it to the location you prefer, for example::
mkdir -p ~/esp mkdir -p ~/esp
cd ~/esp cd ~/esp
tar -xzf ~/Downloads/xtensa-esp32-elf-osx-1.22.0-59.tar.gz tar -xzf ~/Downloads/xtensa-esp32-elf-osx-1.22.0-61-gab8375a-5.2.0.tar.gz
The toolchain will be extracted into ``~/esp/xtensa-esp32-elf/`` directory. The toolchain will be extracted into ``~/esp/xtensa-esp32-elf/`` directory.
@@ -52,6 +52,8 @@ If you can't think of a reason why you need to build it yourself, then probably
- if you want to customize toolchain build configuration - if you want to customize toolchain build configuration
- if you want to use a different GCC version (such as 4.8.5)
- if you want to hack gcc or newlib or libstdc++ - if you want to hack gcc or newlib or libstdc++
- if you are curious and/or have time to spare - if you are curious and/or have time to spare
@@ -160,4 +162,3 @@ Further reading
=============== ===============
If you'd like to use the Eclipse IDE instead of running ``make``, check out the Eclipse setup guide in this directory. If you'd like to use the Eclipse IDE instead of running ``make``, check out the Eclipse setup guide in this directory.

View File

@@ -9,7 +9,7 @@ Windows doesn't have a built-in "make" environment, so as well as installing the
The quick setup is to download the Windows all-in-one toolchain & MSYS zip file from dl.espressif.com: The quick setup is to download the Windows all-in-one toolchain & MSYS zip file from dl.espressif.com:
https://dl.espressif.com/dl/esp32_win32_msys2_environment_and_toolchain-20160816.zip https://dl.espressif.com/dl/esp32_win32_msys2_environment_and_toolchain-20170111.zip
Unzip the zip file to C:\ and it will create an "msys32" directory with a pre-prepared environment. Unzip the zip file to C:\ and it will create an "msys32" directory with a pre-prepared environment.
@@ -38,7 +38,7 @@ Another Alternative Step 1: Just download a toolchain
If you already have an MSYS2 install or want to do things differently, you can download just the toolchain here: If you already have an MSYS2 install or want to do things differently, you can download just the toolchain here:
https://dl.espressif.com/dl/xtensa-esp32-elf-win32-1.22.0-59.zip https://dl.espressif.com/dl/xtensa-esp32-elf-win32-1.22.0-61-gab8375a-5.2.0.zip
If you followed one of the above options for Step 1, you won't need this download. If you followed one of the above options for Step 1, you won't need this download.

View File

@@ -421,3 +421,30 @@ endef
# filter/subst in expression ensures all submodule paths begin with $(IDF_PATH), and then strips that prefix # filter/subst in expression ensures all submodule paths begin with $(IDF_PATH), and then strips that prefix
# so the argument is suitable for use with 'git submodule' commands # so the argument is suitable for use with 'git submodule' commands
$(foreach submodule,$(subst $(IDF_PATH)/,,$(filter $(IDF_PATH)/%,$(COMPONENT_SUBMODULES))),$(eval $(call GenerateSubmoduleCheckTarget,$(submodule)))) $(foreach submodule,$(subst $(IDF_PATH)/,,$(filter $(IDF_PATH)/%,$(COMPONENT_SUBMODULES))),$(eval $(call GenerateSubmoduleCheckTarget,$(submodule))))
# Check toolchain version using the output of xtensa-esp32-elf-gcc --version command.
# The output normally looks as follows
# xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-59-ga194053) 4.8.5
# The part in brackets is extracted into TOOLCHAIN_COMMIT_DESC variable,
# the part after the brackets is extracted into TOOLCHAIN_GCC_VER.
ifndef MAKE_RESTARTS
TOOLCHAIN_COMMIT_DESC := $(shell $(CC) --version | sed -E -n 's|xtensa-esp32-elf-gcc\ \(([^)]*).*|\1|gp')
TOOLCHAIN_GCC_VER := $(shell $(CC) --version | sed -E -n 's|xtensa-esp32-elf-gcc\ \(.*\)\ (.*)|\1|gp')
# Officially supported version(s)
SUPPORTED_TOOLCHAIN_COMMIT_DESC := crosstool-NG crosstool-ng-1.22.0-61-gab8375a
SUPPORTED_TOOLCHAIN_GCC_VERSIONS := 5.2.0
ifneq ($(TOOLCHAIN_COMMIT_DESC), $(SUPPORTED_TOOLCHAIN_COMMIT_DESC))
$(info WARNING: Toolchain version is not supported: $(TOOLCHAIN_COMMIT_DESC))
$(info Expected to see version: $(SUPPORTED_TOOLCHAIN_COMMIT_DESC))
$(info Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.)
endif
ifeq (,$(findstring $(TOOLCHAIN_GCC_VER), $(SUPPORTED_TOOLCHAIN_GCC_VERSIONS)))
$(warning WARNING: Compiler version is not supported: $(TOOLCHAIN_GCC_VER))
$(info Expected to see version(s): $(SUPPORTED_TOOLCHAIN_GCC_VERSIONS))
$(info Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.)
endif
endif #MAKE_RESTARTS