Skip to content

Commit 70b26d8

Browse files
committed
Merge branch 'feature/support_gcc_v8.x' into 'master'
feat(gcc): update cross toolchain GCC to v8.x See merge request sdk/ESP8266_RTOS_SDK!1539
2 parents f49aa13 + fd54106 commit 70b26d8

File tree

155 files changed

+320
-15414
lines changed

Some content is hidden

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

155 files changed

+320
-15414
lines changed

.gitlab-ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ before_script:
2525
- *apply_bot_filter
2626
- echo "Not setting up GitLab key, fetching submodules ..."
2727
- git submodule update --init --recursive
28+
- ./install.sh
29+
- . ./export.sh
2830
- source tools/ci/configure_ci_environment.sh
2931

3032
.build_template: &build_template
@@ -40,6 +42,8 @@ build_ssc:
4042
- ./SSC/ssc_bin
4143
expire_in: 6 mos
4244
script:
45+
- ./install.sh
46+
- . ./export.sh
4347
- git clone $GITLAB_SSH_SERVER/yinling/SSC.git
4448
- cd SSC
4549
# try checkout same branch

components/esp8266/Kconfig

-24
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,6 @@ config ESP8266_DEFAULT_CPU_FREQ_MHZ
2727
default 80 if ESP8266_DEFAULT_CPU_FREQ_80
2828
default 160 if ESP8266_DEFAULT_CPU_FREQ_160
2929

30-
choice NEWLIB_STDOUT_LINE_ENDING
31-
prompt "Line ending for UART output"
32-
default NEWLIB_STDOUT_LINE_ENDING_CRLF
33-
help
34-
This option allows configuring the desired line endings sent to UART
35-
when a newline ('\n', LF) appears on stdout.
36-
Three options are possible:
37-
38-
CRLF: whenever LF is encountered, prepend it with CR
39-
40-
LF: no modification is applied, stdout is sent as is
41-
42-
CR: each occurence of LF is replaced with CR
43-
44-
This option doesn't affect behavior of the UART driver (drivers/uart.h).
45-
46-
config NEWLIB_STDOUT_LINE_ENDING_CRLF
47-
bool "CRLF"
48-
config NEWLIB_STDOUT_LINE_ENDING_LF
49-
bool "LF"
50-
config NEWLIB_STDOUT_LINE_ENDING_CR
51-
bool "CR"
52-
endchoice
53-
5430
choice ESP_FILENAME_MACRO
5531
prompt "File name macro text"
5632
default ESP_FILENAME_MACRO_NO_PATH

components/esp8266/Makefile.projbuild

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
SUPPORTED_TOOLCHAIN_COMMIT_DESC := 1.22.0-100-ge567ec7
2-
SUPPORTED_TOOLCHAIN_GCC_VERSIONS := 5.2.0
1+
SUPPORTED_TOOLCHAIN_COMMIT_DESC := esp-2020r3-49-gd5524c1
2+
SUPPORTED_TOOLCHAIN_GCC_VERSIONS := 8.4.0
33

44
ifdef CONFIG_ESP8266_LEGACY
55

components/esp8266/source/startup.c

-6
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
#include "task.h"
3636
#include "esp_task.h"
3737

38-
#ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
3938
#include "esp_newlib.h"
40-
#endif
4139

4240
extern esp_err_t esp_pthread_init(void);
4341
extern void chip_boot(void);
@@ -85,9 +83,7 @@ static void user_init_entry(void *param)
8583
esp_task_wdt_init();
8684
#endif
8785

88-
#ifdef CONFIG_ENABLE_PTHREAD
8986
assert(esp_pthread_init() == 0);
90-
#endif
9187

9288
#ifdef CONFIG_BOOTLOADER_FAST_BOOT
9389
REG_CLR_BIT(DPORT_CTL_REG, DPORT_CTL_DOUBLE_CLK);
@@ -167,9 +163,7 @@ void call_start_cpu(size_t start_addr)
167163
assert(__esp_os_init() == 0);
168164
#endif
169165

170-
#ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
171166
esp_newlib_init();
172-
#endif
173167

174168
assert(xTaskCreate(user_init_entry, "uiT", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL) == pdPASS);
175169

components/freertos/port/esp8266/impure.c

-53
This file was deleted.

components/freertos/port/esp8266/include/freertos/FreeRTOSConfig.h

-4
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,7 @@ NVIC value of 255. */
133133
* 1: pthread (optional)
134134
* 2: errno
135135
*/
136-
#ifdef CONFIG_ENABLE_PTHREAD
137136
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 3
138-
#else
139-
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 2
140-
#endif
141137
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1
142138

143139
/* add this to dump task stack information */

components/freertos/port/esp8266/include/freertos/portmacro.h

-4
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,11 @@ extern "C" {
4242
#include "xtensa_rtos.h"
4343

4444
#if defined(configUSE_NEWLIB_REENTRANT) && configUSE_NEWLIB_REENTRANT == 1
45-
#ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
4645
#include "esp_newlib.h"
4746

48-
#define _impure_ptr _global_impure_ptr
49-
5047
#undef _REENT_INIT_PTR
5148
#define _REENT_INIT_PTR(p) esp_reent_init(p)
5249
#endif
53-
#endif
5450

5551
/*-----------------------------------------------------------
5652
* Port specific definitions.

components/http_parser/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ set(COMPONENT_ADD_INCLUDEDIRS "include")
22
set(COMPONENT_SRCDIRS "src")
33

44
register_component()
5+
6+
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-implicit-fallthrough)

components/http_parser/component.mk

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
COMPONENT_SRCDIRS := src
33
COMPONENT_ADD_INCLUDEDIRS := include
44
COMPONENT_PRIV_INCLUDEDIRS :=
5+
6+
src/http_parser.o: CFLAGS += -Wno-implicit-fallthrough

components/newlib/CMakeLists.txt

+25-36
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,31 @@
1-
set(COMPONENT_SRCDIRS newlib/port)
2-
set(COMPONENT_ADD_INCLUDEDIRS newlib/port/include newlib/include)
3-
4-
5-
if(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO)
6-
set(LIBC c_nano)
7-
elseif(CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL)
8-
set(LIBC c)
9-
elseif(CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO)
10-
set(LIBC c_fnano)
1+
set(include_dirs platform_include)
2+
set(srcs src/esp_malloc.c
3+
src/locks.c
4+
src/random.c
5+
src/reent_init.c
6+
src/select.c
7+
src/syscall.c
8+
src/termios.c
9+
src/time.c)
10+
11+
idf_component_register(SRCS "${srcs}"
12+
INCLUDE_DIRS "${include_dirs}"
13+
PRIV_REQUIRES esp8266 freertos)
14+
15+
if(CONFIG_NEWLIB_NANO_FORMAT)
16+
set(LIBC c_nano)
17+
else()
18+
set(LIBC c)
1119
endif()
1220

1321
set(LIBM m)
1422

15-
set(COMPONENT_PRIV_REQUIRES "vfs" "lwip") # for sys/ioctl.h
16-
17-
register_component()
18-
19-
if(CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO)
20-
target_link_libraries(${COMPONENT_LIB} PUBLIC "-u _printf_float" "-u _scanf_float")
21-
endif()
22-
23-
target_compile_definitions(${COMPONENT_LIB} PUBLIC
24-
-D_CLOCKS_PER_SEC_=CONFIG_FREERTOS_HZ -D_POSIX_THREADS=1 -D_UNIX98_THREAD_MUTEX_ATTRIBUTES=1
25-
)
26-
27-
target_link_libraries(${COMPONENT_LIB} PUBLIC "-L ${CMAKE_CURRENT_SOURCE_DIR}/newlib/lib")
28-
29-
set(blobs "${LIBC}" "${LIBM}")
30-
foreach(blob ${blobs})
31-
add_library(${blob} STATIC IMPORTED)
32-
set_property(TARGET ${blob} PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/newlib/lib/lib${blob}.a)
33-
target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob})
23+
# Toolchain libraries require code defined in this component
24+
idf_component_get_property(newlib newlib COMPONENT_LIB)
25+
target_link_libraries(${COMPONENT_LIB} INTERFACE ${LIBC} ${LIBM} gcc "$<TARGET_FILE:${newlib}>")
3426

35-
foreach(_blob ${blobs})
36-
if(NOT _blob STREQUAL ${blob})
37-
set_property(TARGET ${blob} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${_blob})
38-
endif()
39-
endforeach()
27+
# Forces the linker to include __errno from this component,
28+
# instead of the implementations provided by newlib.
29+
set(EXTRA_LINK_FLAGS "-u __errno")
30+
target_link_libraries(${COMPONENT_LIB} INTERFACE "${EXTRA_LINK_FLAGS}")
4031

41-
set_property(TARGET ${blob} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${COMPONENT_LIB})
42-
endforeach()

components/newlib/Kconfig

+46-51
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,48 @@
11
menu "Newlib"
22

3-
choice NEWLIB_LIBRARY_LEVEL
4-
prompt "newlib level"
5-
default NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
6-
help
7-
Choose newlib library level.
8-
9-
config NEWLIB_LIBRARY_LEVEL_NORMAL
10-
bool "normal"
11-
help
12-
If you need 64-bit integer formatting support or C99 features, select this
13-
option.
14-
15-
config NEWLIB_LIBRARY_LEVEL_NANO
16-
bool "nano"
17-
help
18-
The newlib library which has been compiled with so-called "nano"
19-
formatting option. This option doesn't support 64-bit integer formats, C99
20-
features and float formats, such as positional arguments.
21-
22-
For more details about "nano" formatting option, please see newlib readme file,
23-
search for '--enable-newlib-nano-formatted-io':
24-
https://sourceware.org/newlib/README
25-
26-
If you do not need 64-bit integer formatting support, C99 features and float,
27-
select this option.
28-
29-
config NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
30-
bool "float nano"
31-
help
32-
The newlib library which has been compiled with so-called "float nano"
33-
formatting option. This option doesn't support 64-bit integer formats and C99
34-
features, but support float formats, such as positional arguments.
35-
36-
For more details about "nano" formatting option, please see newlib readme file,
37-
search for '--enable-newlib-nano-formatted-io':
38-
https://sourceware.org/newlib/README
39-
40-
If you do not need 64-bit integer formatting support and C99 features, but need float formats,
41-
select this option.
42-
43-
config NEWLIB_LIBRARY_CUSTOMER
44-
bool "customer"
45-
help
46-
If you need use you own C library, select this option. The libraries and
47-
header files at this component will not be used.
48-
49-
Note: ABI of the C library of your own must be same as SDK.
50-
51-
endchoice
52-
53-
endmenu
3+
choice NEWLIB_STDOUT_LINE_ENDING
4+
prompt "Line ending for UART output"
5+
default NEWLIB_STDOUT_LINE_ENDING_CRLF
6+
help
7+
This option allows configuring the desired line endings sent to UART
8+
when a newline ('\n', LF) appears on stdout.
9+
Three options are possible:
10+
11+
CRLF: whenever LF is encountered, prepend it with CR
12+
13+
LF: no modification is applied, stdout is sent as is
14+
15+
CR: each occurence of LF is replaced with CR
16+
17+
This option doesn't affect behavior of the UART driver (drivers/uart.h).
18+
19+
config NEWLIB_STDOUT_LINE_ENDING_CRLF
20+
bool "CRLF"
21+
config NEWLIB_STDOUT_LINE_ENDING_LF
22+
bool "LF"
23+
config NEWLIB_STDOUT_LINE_ENDING_CR
24+
bool "CR"
25+
endchoice
26+
27+
config NEWLIB_NANO_FORMAT
28+
bool "Enable 'nano' formatting options for printf/scanf family"
29+
default n
30+
help
31+
ESP32 ROM contains parts of newlib C library, including printf/scanf family
32+
of functions. These functions have been compiled with so-called "nano"
33+
formatting option. This option doesn't support 64-bit integer formats and C99
34+
features, such as positional arguments.
35+
36+
For more details about "nano" formatting option, please see newlib readme file,
37+
search for '--enable-newlib-nano-formatted-io':
38+
https://sourceware.org/newlib/README
39+
40+
If this option is enabled, build system will use functions available in
41+
ROM, reducing the application binary size. Functions available in ROM run
42+
faster than functions which run from flash. Functions available in ROM can
43+
also run when flash instruction cache is disabled.
44+
45+
If you need 64-bit integer formatting support or C99 features, keep this
46+
option disabled.
47+
48+
endmenu # Newlib

components/newlib/Makefile.projbuild

-9
This file was deleted.

components/newlib/component.mk

+9-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
#
22
# Component Makefile
33
#
4-
ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
54

6-
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL
7-
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc.a $(COMPONENT_PATH)/newlib/lib/libm.a
8-
else ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NANO
9-
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc_nano.a $(COMPONENT_PATH)/newlib/lib/libm.a
10-
else ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
11-
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc_fnano.a $(COMPONENT_PATH)/newlib/lib/libm.a
12-
endif
5+
COMPONENT_ADD_INCLUDEDIRS := platform_include
6+
COMPONENT_SRCDIRS := src
137

14-
COMPONENT_ADD_INCLUDEDIRS := newlib/port/include newlib/include
15-
COMPONENT_SRCDIRS += newlib/port
16-
COMPONENT_ADD_LDFLAGS := $(LIB_PATH) -lnewlib
17-
COMPONENT_ADD_LINKER_DEPS := $(LIB_PATH)
8+
ifdef CONFIG_NEWLIB_NANO_FORMAT
9+
LIBC := c_nano
10+
else # CONFIG_NEWLIB_NANO_FORMAT
11+
LIBC := c
12+
endif # CONFIG_NEWLIB_NANO_FORMAT
1813

19-
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
20-
COMPONENT_ADD_LDFLAGS := $(COMPONENT_ADD_LDFLAGS) -u _printf_float -u _scanf_float
21-
endif
22-
23-
endif # CONFIG_NEWLIB_LIBRARY_CUSTOMER
14+
# Order of linking matters: libnewlib.a should go before libc.a
15+
COMPONENT_ADD_LDFLAGS := -lnewlib -l$(LIBC) -lm -u __errno

components/newlib/newlib/README

-5
This file was deleted.

0 commit comments

Comments
 (0)