diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt index 10ffe359..8b0ecb6c 100644 --- a/.github/.cSpellWords.txt +++ b/.github/.cSpellWords.txt @@ -254,6 +254,7 @@ vsocket vsync Vwij YPJLH +Werror WGHT wght WLATENCY diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b77cc0ba..b589f801 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arm Limited and/or its affiliates +# Copyright (c) 2023-2025 Arm Limited and/or its affiliates # # SPDX-License-Identifier: MIT @@ -66,7 +66,7 @@ jobs: git-secrets --scan formatting: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout project uses: actions/checkout@v3 diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index cd8defd7..5c8a9129 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -1,4 +1,6 @@ # Copyright (C) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + # Copyright 2025 Arm Limited and/or its affiliates + # # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -38,7 +40,7 @@ jobs: if: ${{ github.event.issue.pull_request && ( ( github.event.comment.body == '/bot run uncrustify' ) || ( github.event.comment.body == '/bot run formatting' ) ) }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Apply Formatting Fix uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main diff --git a/bsp/cmake/SetLinkerOptions.cmake b/bsp/cmake/SetLinkerOptions.cmake index 60ee3a43..2b9ee758 100644 --- a/bsp/cmake/SetLinkerOptions.cmake +++ b/bsp/cmake/SetLinkerOptions.cmake @@ -32,6 +32,7 @@ macro(set_linker_script executable_target) $<$:--scatter=${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/bsp/corstone315/corstone_315_ns.sct> $<$:--scatter=${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/bsp/corstone320/corstone_320_ns.sct> --map + --strict ) endif() endmacro(set_linker_script executable_target) diff --git a/cmake/CompilerFlagsARMCLANG.cmake b/cmake/CompilerFlagsARMCLANG.cmake index 782b0ce7..7ccc1260 100644 --- a/cmake/CompilerFlagsARMCLANG.cmake +++ b/cmake/CompilerFlagsARMCLANG.cmake @@ -33,6 +33,20 @@ macro(set_compiler_and_linker_flags) list(APPEND compile_options $<$:-fno-exceptions>) list(APPEND compile_options $<$:-fno-rtti>) list(APPEND compile_options -mthumb) + list(APPEND compile_options -Wall) + list(APPEND compile_options -Wextra) + list(APPEND compile_options -Wcast-align) + list(APPEND compile_options -Wformat) + list(APPEND compile_options -Wformat-security) + list(APPEND compile_options -Wno-format-zero-length) + list(APPEND compile_options -Wdouble-promotion) + list(APPEND compile_options -Wpointer-arith) + list(APPEND compile_options -Werror=format-security) + list(APPEND compile_options -Werror=implicit-function-declaration) + list(APPEND compile_options -Wnull-dereference) + list(APPEND compile_options -Wredundant-decls) + list(APPEND compile_options -Wshadow) + list(APPEND compile_options -Wswitch-default) list(REMOVE_ITEM compile_options $<$:-masm=armasm>) list(APPEND compile_options $<$:-masm=auto>) list(APPEND compile_options $<$:--target=arm-arm-none-eabi>) diff --git a/cmake/CompilerFlagsGNUARM.cmake b/cmake/CompilerFlagsGNUARM.cmake index b0775da9..a6486cc3 100644 --- a/cmake/CompilerFlagsGNUARM.cmake +++ b/cmake/CompilerFlagsGNUARM.cmake @@ -31,6 +31,20 @@ macro(set_compiler_and_linker_flags) list(APPEND compile_options "-fomit-frame-pointer") list(APPEND compile_options $<$:-fno-exceptions>) list(APPEND compile_options $<$:-fno-rtti>) + list(APPEND compile_options -Wall) + list(APPEND compile_options -Wextra) + list(APPEND compile_options -Wcast-align) + list(APPEND compile_options -Wformat) + list(APPEND compile_options -Wformat-security) + list(APPEND compile_options -Wno-format-zero-length) + list(APPEND compile_options -Wdouble-promotion) + list(APPEND compile_options -Wpointer-arith) + list(APPEND compile_options -Werror=format-security) + list(APPEND compile_options -Werror=implicit-function-declaration) + list(APPEND compile_options -Wnull-dereference) + list(APPEND compile_options -Wredundant-decls) + list(APPEND compile_options -Wshadow) + list(APPEND compile_options -Wswitch-default) set_property(DIRECTORY PROPERTY COMPILE_OPTIONS ${compile_options}) get_property(link_options DIRECTORY PROPERTY LINK_OPTIONS) diff --git a/components/security/mbedtls/integration/CMakeLists.txt b/components/security/mbedtls/integration/CMakeLists.txt index 39edb98e..247939e6 100644 --- a/components/security/mbedtls/integration/CMakeLists.txt +++ b/components/security/mbedtls/integration/CMakeLists.txt @@ -66,3 +66,27 @@ target_link_libraries(iot-tls PRIVATE helpers-logging ) + +# The toolchain enables different warnings (ex. -Wswitch-default) +# and MbedTLS enables -Werror on all its libraries. Some of the files +# under the mbedcrypto, mbedtls, mbedx509, and everest third party library +# violate these rules which result in compilation time errors. +# Hence, disbaling errors on violated warnings for those libraries. +target_compile_options(mbedcrypto + PRIVATE + -Wno-error=switch-default + -Wno-error=null-dereference +) +target_compile_options(mbedtls + PRIVATE + -Wno-error=switch-default + -Wno-error=null-dereference +) +target_compile_options(mbedx509 + PRIVATE + -Wno-error=null-dereference +) +target_compile_options(everest + PRIVATE + -Wno-error=redundant-decls +) diff --git a/release_changes/202503281420.change.md b/release_changes/202503281420.change.md new file mode 100644 index 00000000..5ca3907c --- /dev/null +++ b/release_changes/202503281420.change.md @@ -0,0 +1 @@ +toolchains: Add recommended toolchain flags.