# Ignore the next messages:
# "error.o" or "-Werror" in compiler's command line
# "reassigning to symbol" or "changes choice state" in sdkconfig
-# Compiler and toochain versions is not supported from make/project.mk
+# 'Compiler and toochain versions is not supported' from make/project.mk
IGNORE_WARNS="\
library/error\.o\
-\|\ -Werror\|error\.d\
+\|\ -Werror\
+\|error\.d\
\|reassigning to symbol\
\|changes choice state\
\|Compiler version is not supported\
# Ignore the next messages:
# "error.o" or "-Werror" in compiler's command line
# "reassigning to symbol" or "changes choice state" in sdkconfig
-sort -u "${LOG_SUSPECTED}" | \
-grep -v "library/error.o\|\ -Werror\|reassigning to symbol\|changes choice state" \
+# 'Compiler and toochain versions is not supported' from crosstool_version_check.cmake
+IGNORE_WARNS="\
+library/error\.o\
+\|\ -Werror\
+\|error\.d\
+\|reassigning to symbol\
+\|changes choice state\
+\|crosstool_version_check\.cmake\
+"
+
+sort -u "${LOG_SUSPECTED}" | grep -v "${IGNORE_WARNS}" \
&& RESULT=$RESULT_ISSUES \
|| echo -e "\tNone"
OUTPUT_QUIET)
string(REGEX MATCH "crosstool-ng-[0-9a-g\\.-]+" ctng_version "${toolchain_stderr}")
- string(REPLACE "crosstool-ng-" "" ctng_version "${ctng_version}")
# We use FIND to match version instead of STREQUAL because some toolchains are built
# with longer git hash strings than others. This will match any version which starts with
# the expected version string.
"doesn't match supported version ${expected_ctng_version}. ${ctng_version_warning}")
endif()
endfunction()
+
+function(get_expected_ctng_version _toolchain_ver _gcc_ver)
+ file(STRINGS ${IDF_PATH}/tools/toolchain_versions.mk config_contents)
+ foreach(name_and_value ${config_contents})
+ # Strip spaces
+ string(REPLACE " " "" name_and_value ${name_and_value})
+ # Find variable name
+ string(REGEX MATCH "^[^=]+" name ${name_and_value})
+ # Find the value
+ string(REPLACE "${name}=" "" value ${name_and_value})
+ # Getting values
+ if("${name}" STREQUAL "SUPPORTED_TOOLCHAIN_COMMIT_DESC")
+ set("${_toolchain_ver}" "${value}" PARENT_SCOPE)
+ elseif("${name}" STREQUAL "SUPPORTED_TOOLCHAIN_GCC_VERSIONS")
+ set(${_gcc_ver} "${value}" PARENT_SCOPE)
+ endif()
+ endforeach()
+endfunction()
# path to idf.py tool
set(IDFTOOL ${PYTHON} "${IDF_PATH}/tools/idf.py")
+
+ # Temporary trick to support both gcc5 and gcc8 builds
+ if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL 5.2.0)
+ set(GCC_NOT_5_2_0 0)
+ else()
+ set(GCC_NOT_5_2_0 1)
+ endif()
endmacro()
# Add all the IDF global compiler & preprocessor options
-Wno-old-style-declaration
)
+ if(CONFIG_DISABLE_GCC8_WARNINGS)
+ add_compile_options(
+ -Wno-parentheses
+ -Wno-sizeof-pointer-memaccess
+ -Wno-clobbered
+ )
+
+ # doesn't use GCC_NOT_5_2_0 because idf_set_global_variables was not called before
+ if(NOT CMAKE_C_COMPILER_VERSION VERSION_EQUAL 5.2.0)
+ add_compile_options(
+ -Wno-format-overflow
+ -Wno-stringop-truncation
+ -Wno-misleading-indentation
+ -Wno-cast-function-type
+ -Wno-implicit-fallthrough
+ -Wno-unused-const-variable
+ -Wno-switch-unreachable
+ -Wno-format-truncation
+ -Wno-memset-elt-size
+ -Wno-int-in-bool-context
+ )
+ endif()
+ endif()
+
# Stack protection
if(NOT BOOTLOADER_BUILD)
if(CONFIG_STACK_CHECK_NORM)
endif()
endif()
+ # Temporary trick to support both gcc5 and gcc8 builds
+ add_definitions(-DGCC_NOT_5_2_0=${GCC_NOT_5_2_0})
endfunction()
# Warn if the toolchain version doesn't match
#
# TODO: make these platform-specific for diff toolchains
- gcc_version_check("5.2.0")
- crosstool_version_check("1.22.0-80-g6c4433a")
+ get_expected_ctng_version(expected_toolchain expected_gcc)
+ gcc_version_check("${expected_gcc}")
+ crosstool_version_check("${expected_toolchain}")
endfunction()