Skip to content

Commit 199db15

Browse files
toolchains: Add recommended toolchain flags (#110)
* toolchains: Add recommended toolchain flags Recommended toolchain flags are added to both GNU and ARMClang toolchains. Signed-off-by: Ahmed Ismail <[email protected]> * formatting: Update the job to run on Ubuntu 22.04 Ubuntu 20.04 LTS runner will be removed mid April 2025. Hence, updating to use Ubuntu 22.04. Signed-off-by: Ahmed Ismail <[email protected]> --------- Signed-off-by: Ahmed Ismail <[email protected]>
1 parent 1876dcc commit 199db15

File tree

8 files changed

+60
-3
lines changed

8 files changed

+60
-3
lines changed

.github/.cSpellWords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ vsocket
254254
vsync
255255
Vwij
256256
YPJLH
257+
Werror
257258
WGHT
258259
wght
259260
WLATENCY

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023 Arm Limited and/or its affiliates
1+
# Copyright (c) 2023-2025 Arm Limited and/or its affiliates
22
33
# SPDX-License-Identifier: MIT
44

@@ -66,7 +66,7 @@ jobs:
6666
git-secrets --scan
6767
6868
formatting:
69-
runs-on: ubuntu-20.04
69+
runs-on: ubuntu-22.04
7070
steps:
7171
- name: Checkout project
7272
uses: actions/checkout@v3

.github/workflows/formatting.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Copyright (C) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# Copyright 2025 Arm Limited and/or its affiliates
3+
24
#
35
# Permission is hereby granted, free of charge, to any person obtaining a copy of
46
# this software and associated documentation files (the "Software"), to deal in
@@ -38,7 +40,7 @@ jobs:
3840
if: ${{ github.event.issue.pull_request &&
3941
( ( github.event.comment.body == '/bot run uncrustify' ) ||
4042
( github.event.comment.body == '/bot run formatting' ) ) }}
41-
runs-on: ubuntu-20.04
43+
runs-on: ubuntu-22.04
4244
steps:
4345
- name: Apply Formatting Fix
4446
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main

bsp/cmake/SetLinkerOptions.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ macro(set_linker_script executable_target)
3232
$<$<STREQUAL:${ARM_CORSTONE_BSP_TARGET_PLATFORM},corstone315>:--scatter=${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/bsp/corstone315/corstone_315_ns.sct>
3333
$<$<STREQUAL:${ARM_CORSTONE_BSP_TARGET_PLATFORM},corstone320>:--scatter=${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/bsp/corstone320/corstone_320_ns.sct>
3434
--map
35+
--strict
3536
)
3637
endif()
3738
endmacro(set_linker_script executable_target)

cmake/CompilerFlagsARMCLANG.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ macro(set_compiler_and_linker_flags)
3333
list(APPEND compile_options $<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>)
3434
list(APPEND compile_options $<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
3535
list(APPEND compile_options -mthumb)
36+
list(APPEND compile_options -Wall)
37+
list(APPEND compile_options -Wextra)
38+
list(APPEND compile_options -Wcast-align)
39+
list(APPEND compile_options -Wformat)
40+
list(APPEND compile_options -Wformat-security)
41+
list(APPEND compile_options -Wno-format-zero-length)
42+
list(APPEND compile_options -Wdouble-promotion)
43+
list(APPEND compile_options -Wpointer-arith)
44+
list(APPEND compile_options -Werror=format-security)
45+
list(APPEND compile_options -Werror=implicit-function-declaration)
46+
list(APPEND compile_options -Wnull-dereference)
47+
list(APPEND compile_options -Wredundant-decls)
48+
list(APPEND compile_options -Wshadow)
49+
list(APPEND compile_options -Wswitch-default)
3650
list(REMOVE_ITEM compile_options $<$<COMPILE_LANGUAGE:ASM>:-masm=armasm>)
3751
list(APPEND compile_options $<$<COMPILE_LANGUAGE:ASM>:-masm=auto>)
3852
list(APPEND compile_options $<$<COMPILE_LANGUAGE:ASM>:--target=arm-arm-none-eabi>)

cmake/CompilerFlagsGNUARM.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ macro(set_compiler_and_linker_flags)
3131
list(APPEND compile_options "-fomit-frame-pointer")
3232
list(APPEND compile_options $<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>)
3333
list(APPEND compile_options $<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
34+
list(APPEND compile_options -Wall)
35+
list(APPEND compile_options -Wextra)
36+
list(APPEND compile_options -Wcast-align)
37+
list(APPEND compile_options -Wformat)
38+
list(APPEND compile_options -Wformat-security)
39+
list(APPEND compile_options -Wno-format-zero-length)
40+
list(APPEND compile_options -Wdouble-promotion)
41+
list(APPEND compile_options -Wpointer-arith)
42+
list(APPEND compile_options -Werror=format-security)
43+
list(APPEND compile_options -Werror=implicit-function-declaration)
44+
list(APPEND compile_options -Wnull-dereference)
45+
list(APPEND compile_options -Wredundant-decls)
46+
list(APPEND compile_options -Wshadow)
47+
list(APPEND compile_options -Wswitch-default)
3448
set_property(DIRECTORY PROPERTY COMPILE_OPTIONS ${compile_options})
3549

3650
get_property(link_options DIRECTORY PROPERTY LINK_OPTIONS)

components/security/mbedtls/integration/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,27 @@ target_link_libraries(iot-tls
6666
PRIVATE
6767
helpers-logging
6868
)
69+
70+
# The toolchain enables different warnings (ex. -Wswitch-default)
71+
# and MbedTLS enables -Werror on all its libraries. Some of the files
72+
# under the mbedcrypto, mbedtls, mbedx509, and everest third party library
73+
# violate these rules which result in compilation time errors.
74+
# Hence, disbaling errors on violated warnings for those libraries.
75+
target_compile_options(mbedcrypto
76+
PRIVATE
77+
-Wno-error=switch-default
78+
-Wno-error=null-dereference
79+
)
80+
target_compile_options(mbedtls
81+
PRIVATE
82+
-Wno-error=switch-default
83+
-Wno-error=null-dereference
84+
)
85+
target_compile_options(mbedx509
86+
PRIVATE
87+
-Wno-error=null-dereference
88+
)
89+
target_compile_options(everest
90+
PRIVATE
91+
-Wno-error=redundant-decls
92+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
toolchains: Add recommended toolchain flags.

0 commit comments

Comments
 (0)