Skip to content

Commit 3a99771

Browse files
mikee47slaff
authored andcommitted
Update toolchains to C++17 (#1825)
Updates framework to build using GCC 9.2.0 toolchain for C++17. Toolchains are at https://github.com/earlephilhower/esp-quick-toolchain/releases. See `docs/source/arch/esp8266/getting-started/eqt.rst` for installation details. (Also at https://smingdev.readthedocs.io/en/dev-esp-quick-toolchain/arch/esp8266/getting-started/eqt.html) Extract the toolchain to a suitable location, e.g. `opt/esp-quick-toolchain` or `C:\tools\esp-quick-toolchain`, and set `ESP_HOME` accordingly. The main change for the new toolchain is that the core PROGMEM handling stuff is included in `sys/pgmspace.h`. See esp8266/Arduino#5376 for more details. Also includes de-duplication for NUL-terminated PSTR definitions.
1 parent d1a1efa commit 3a99771

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1587
-901
lines changed

.appveyor/build.cmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ REM Windows build script
22

33
set SMING_HOME=%APPVEYOR_BUILD_FOLDER%\Sming
44

5-
if "%SMING_ARCH%" == "Esp8266" set ESP_HOME=c:\Espressif
5+
if "%build_compiler%" == "udk" set ESP_HOME=%UDK_ROOT%
6+
if "%build_compiler%" == "eqt" set ESP_HOME=%EQT_ROOT%
67

78
cd %SMING_HOME%
89
gcc -v

.appveyor/install.cmd

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
REM Windows install script
22

33
rmdir /s /q c:\MinGW
4-
curl -LO https://github.com/SmingHub/SmingTools/releases/download/1.0/MinGW.7z
4+
curl -LO %SMINGTOOLS%/MinGW.7z
55
7z -oC:\ x MinGW.7z
66

77
goto :%SMING_ARCH%
88

99
:Esp8266
1010

11-
choco install esp8266-udk --source https://www.myget.org/F/sming/ -y --no-progress
11+
REM Old toolchain
12+
set TOOLCHAIN=esp-udk-win32.7z
13+
curl -LO %SMINGTOOLS%/%TOOLCHAIN%
14+
7z -o%UDK_ROOT% x %TOOLCHAIN%
15+
16+
REM New toolchain
17+
mkdir %EQT_ROOT%
18+
set TOOLCHAIN=i686-w64-mingw32.xtensa-lx106-elf-a5c9861.1575819473.zip
19+
curl -LO https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu5/%TOOLCHAIN%
20+
7z -o%EQT_ROOT% x %TOOLCHAIN%
1221

1322
goto :EOF
1423

.travis.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
language: cpp
2+
os: linux
23
env:
34
global:
4-
- SDK_BUILD=258
5+
- SMINGTOOLS=https://github.com/SmingHub/SmingTools/releases/download/1.0
56
- secure: D/cPk+sL2MNHLtfuU/rMiVN63+CTFpo9Chqa39LEH5VloGqC5f7RyIi2Maa3C/U2JQfM01HlsNR7E5bB0W8DQYbtzBDTqbZ4C7ppZRU5jCQ+L51ERKJ0EAV3KkaravQCRbWt3tlgOp6Xk6xaRMBaHEGrdbFjHYgEMPVteUQNr0A=
67
- secure: pc8Yqwmn6AM+iBjLNNnknmOoi+AxoyvcVy128b2WXSdj6Q4bOIXgj4WUg8I52i1fgyh0Rxg19WUB6qSVyykCXVdSRajIU1MsKZI+0q44Q83wnwVeYm7nPWxDqS3FKMajucZCg4p0BTE4T6tpnm7zZNHduHnggua/NpP2h7B/Sqs=
78
- secure: TX0IxYV3tTocCaJcgIA2xzJyHIzbxo7sAkLLYL+OITgWPD1VDUrEqEe7konQA5NIDJJ0VjoHxpdfti2LHG1fw45vrEMfBIOmZG6nW2gxD8ZS2G8KlYIxFB93oNNB6qJRHps1uIANk2hM+Ju6Pnqfc+lLh8oabs974ziAxoYuAJQ=
89
jobs:
910
include:
1011
- stage: test
11-
os: linux
12-
dist: xenial
1312
addons:
1413
apt:
1514
packages:
@@ -23,10 +22,23 @@ jobs:
2322
- graphviz-dev
2423
- xmlstarlet
2524
- jq
26-
env: SMING_ARCH=Host
25+
env:
26+
- SMING_ARCH=Host
27+
2728
- stage: build
28-
os: linux
29-
env: SMING_ARCH=Esp8266 SDK_VERSION=3.0.1
29+
name: C++11
30+
env:
31+
- SMING_ARCH=Esp8266
32+
- SDK_VERSION=3.0.1
33+
- ESP_HOME=$TRAVIS_BUILD_DIR/opt/esp-alt-sdk
34+
35+
- stage: build
36+
name: C++17
37+
env:
38+
- SMING_ARCH=Esp8266
39+
- SDK_VERSION=3.0.1
40+
- ESP_HOME=$TRAVIS_BUILD_DIR/opt/esp-quick-toolchain
41+
3042
git:
3143
submodules: false
3244
addons:

.travis/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ fi
2727

2828
# Setup ARCH SDK paths
2929
if [ "$SMING_ARCH" == "Esp8266" ]; then
30-
export ESP_HOME=$TRAVIS_BUILD_DIR/opt/esp-alt-sdk
3130
export PATH=$PATH:$ESP_HOME/xtensa-lx106-elf/bin:$ESP_HOME/utils/
3231
fi
3332

.travis/install.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ if [ "$TRAVIS_BUILD_STAGE_NAME" == "Test" ]; then
99
fi
1010

1111
if [ "$SMING_ARCH" == "Esp8266" ]; then
12-
mkdir -p $TRAVIS_BUILD_DIR/opt/esp-alt-sdk
13-
1412
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
15-
wget --no-verbose https://github.com/nodemcu/nodemcu-firmware/raw/2d958750b56fc60297f564b4ec303e47928b5927/tools/esp-open-sdk.tar.xz
16-
tar -Jxvf esp-open-sdk.tar.xz; ln -s $(pwd)/esp-open-sdk/xtensa-lx106-elf $TRAVIS_BUILD_DIR/opt/esp-alt-sdk/.
13+
# Old toolchain
14+
TOOLCHAIN=esp-open-sdk-linux-x86_64.tar.gz
15+
wget --no-verbose $SMINGTOOLS/$TOOLCHAIN
16+
tar -zxf $TOOLCHAIN
17+
mkdir -p $TRAVIS_BUILD_DIR/opt/esp-alt-sdk
18+
ln -s $(pwd)/esp-open-sdk/xtensa-lx106-elf $TRAVIS_BUILD_DIR/opt/esp-alt-sdk/.
19+
20+
# New toolchain
21+
TOOLCHAIN=x86_64-linux-gnu.xtensa-lx106-elf-a5c9861.1575819473.tar.gz
22+
wget --no-verbose https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu5/$TOOLCHAIN
23+
mkdir -p opt/esp-quick-toolchain
24+
tar -zxf $TOOLCHAIN -C opt/esp-quick-toolchain --totals
1725
fi
1826

1927
fi # Esp8266

Sming/Arch/Esp8266/Compiler/ld/common.ld

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,15 @@ SECTIONS
138138
{
139139
_irom0_text_start = ABSOLUTE(.);
140140

141-
*libsmartconfig.a:(.literal .text .literal.* .text.*)
141+
*libc.a:(.literal .text .literal.* .text.*)
142+
*libm.a:(.literal .text .literal.* .text.*)
143+
*gcc.a:_divsf3.o(.literal .text)
144+
*gcc.a:_fixsfsi.o(.literal .text)
145+
*gcc.a:_cmpdf2.o(.literal .text)
146+
*gcc.a:_cmpsf2.o(.literal .text)
142147
*libstdc++.a:(.literal .text .literal.* .text.*)
148+
149+
*libsmartconfig.a:(.literal .text .literal.* .text.*)
143150
*libat.a:(.literal.* .text.*)
144151
*libcrypto.a:(.literal.* .text.*)
145152
*libespnow.a:(.literal.* .text.*)
@@ -156,27 +163,30 @@ SECTIONS
156163

157164
*libmbedtls.a:(.literal.* .text.*)
158165

159-
*libm.a:(.literal .text .literal.* .text.*)
166+
/* C++ vtables */
167+
*(.rodata._ZTV*)
160168

161-
*(.rodata._ZTV*) /* C++ vtables */
162-
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom0.text.* .irom.text .irom.debug.*)
169+
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom0.text.* .irom.text .irom.text.* .irom.debug.*)
163170

164171
/* Generated libraries */
165172
*liblwip2.a:(.literal .text .literal.* .text.*)
166173
*/clib-*.a:*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.* .irom.debug.*)
167174

175+
/* Constant strings in flash (PSTRs) */
176+
*(.irom0.pstr.*)
177+
168178
/* __FUNCTION__ locals */
169179
*(.rodata._ZZ*__FUNCTION__)
170180
*(.rodata._ZZ*__PRETTY_FUNCTION__)
171181
*(.rodata._ZZ*__func__)
182+
*(.rodata.__func__*)
172183

173-
/* debug_e() string pointers */
174-
*(.rodata._ZZ*log_string)
175-
176-
/* const references, mainly in templated code */
177-
*(.rodata._ZN*)
184+
/* Inline flash strings, including those within templated code */
185+
*(*__pstr__*)
186+
*(*__fstr__*)
178187

179-
*(.rodata._ZZN*)
188+
/* Templated code */
189+
*(.rodata._ZN8NanoTimeL9unitTicksE)
180190

181191
_irom0_text_end = ABSOLUTE(.);
182192
_flash_code_end = ABSOLUTE(.);

Sming/Arch/Esp8266/Components/esp-open-lwip/component.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ INCDIR := \
7676
$(SDK_BASE)/include \
7777
$(SMING_HOME)/System/include \
7878
$(ARCH_SYS)/include \
79-
$(ARCH_COMPONENTS)/esp8266/include \
79+
$(ARCH_COMPONENTS)/libc/include \
8080
$(SMING_HOME)/Wiring
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
diff --git a/lib/libc.a b/lib/libc.orig.a
2+
rename from lib/libc.a
3+
rename to lib/libc.orig.a
4+
diff --git a/lib/libgcc.a b/lib/libgcc.orig.a
5+
rename from lib/libgcc.a
6+
rename to lib/libgcc.orig.a

Sming/Arch/Esp8266/Components/esp8266/esp_cplusplus.cpp

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,30 @@
1+
/****
2+
* Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3+
* Created 2015 by Skurydin Alexey
4+
* http://github.com/SmingHub/Sming
5+
* All files of the Sming Core are provided under the LGPL v3 license.
6+
*
7+
* esp_cplusplus.cpp
8+
*
9+
****/
10+
111
#include <esp_systemapi.h>
212
#include "include/esp_cplusplus.h"
313
#include <stdlib.h>
414

515
extern void (*__init_array_start)();
616
extern void (*__init_array_end)();
717

8-
////////////////////////////////////////////////////////////////////////
9-
10-
// Just do it! :)
1118
void cpp_core_initialize()
1219
{
13-
void (**p)(void);
14-
for (p = &__init_array_start; p != &__init_array_end; ++p)
15-
(*p)();
16-
}
17-
18-
////////////////////////////////////////////////////////////////////////
19-
20-
void *operator new(size_t size)
21-
{
22-
//debugf("new: %d (%d)", size, system_get_free_heap_size());
23-
return malloc(size);
24-
}
25-
26-
void *operator new[](size_t size)
27-
{
28-
//debugf("new[]: %d (%d)", size, system_get_free_heap_size());
29-
return malloc(size);
30-
}
31-
32-
void operator delete(void * ptr)
33-
{
34-
if (ptr != NULL)
35-
free(ptr);
36-
}
37-
38-
void operator delete[](void * ptr)
39-
{
40-
if (ptr != NULL)
41-
free(ptr);
20+
/*
21+
* Must be initialised in reverse order
22+
* see https://github.com/esp8266/Arduino/pull/2074
23+
*/
24+
auto p = &__init_array_end;
25+
while(p != &__init_array_start) {
26+
(*--p)();
27+
}
4228
}
4329

4430
extern "C" void __cxa_pure_virtual(void)

Sming/Arch/Esp8266/Components/esp8266/startup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
extern void init();
1919

20-
extern "C" void WEAK_ATTR user_init(void)
20+
extern "C" void user_init(void)
2121
{
2222
// Initialise hardware timers
2323
hw_timer_init();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy