Skip to content

Commit e754795

Browse files
committed
fix build warnings
1 parent a7f330f commit e754795

File tree

13 files changed

+73
-37
lines changed

13 files changed

+73
-37
lines changed

.github/workflows/build_iar.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# Alphabetical order
3333
# Note: bundle multiple families into a matrix since there is only one self-hosted instance can
3434
# run IAR build. Too many matrix can hurt due to setup/teardown overhead.
35-
- 'stm32f0 stm32f1 stm32f4 stm32f7 stm32g4 stm32h7 stm32l4'
35+
- 'stm32f0 stm32f1 stm32f7 stm32h7 stm32l4'
3636
steps:
3737
- name: Clean workspace
3838
run: |

examples/device/audio_test_multi_rate/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ bool tud_audio_set_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
268268

269269
sampFreq = (uint32_t)((audio_control_cur_4_t *)pBuff)->bCur;
270270

271-
TU_LOG2("Clock set current freq: %d\r\n", sampFreq);
271+
TU_LOG2("Clock set current freq: %lu\r\n", sampFreq);
272272

273273
return true;
274274
break;

examples/host/msc_file_explorer/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ target_sources(${PROJECT} PUBLIC
2121
${TOP}/lib/fatfs/source/ffunicode.c
2222
)
2323

24+
# Suppress warnings on fatfs
25+
set_source_files_properties(
26+
${TOP}/lib/fatfs/source/ff.c
27+
PROPERTIES
28+
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual"
29+
)
30+
2431
# Example include
2532
target_include_directories(${PROJECT} PUBLIC
2633
${CMAKE_CURRENT_SOURCE_DIR}/src

examples/rules.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ SRC_C += \
2828
src/common/tusb_fifo.c \
2929
src/device/usbd.c \
3030
src/device/usbd_control.c \
31+
src/typec/usbc.c \
3132
src/class/audio/audio_device.c \
3233
src/class/cdc/cdc_device.c \
3334
src/class/dfu/dfu_device.c \

examples/typec/power_delivery/src/main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ int main(void)
6363

6464
tuc_init(0, TUSB_TYPEC_PORT_SNK);
6565

66-
uint32_t start_ms = 0;
67-
bool led_state = false;
68-
6966
while (1) {
7067
led_blinking_task();
7168

@@ -155,6 +152,7 @@ bool tuc_pd_data_received_cb(uint8_t rhport, pd_header_t const* header, uint8_t
155152
}
156153

157154
bool tuc_pd_control_received_cb(uint8_t rhport, pd_header_t const* header) {
155+
(void) rhport;
158156
switch (header->msg_type) {
159157
case PD_CTRL_ACCEPT:
160158
printf("PD Request Accepted\r\n");

hw/bsp/family_support.cmake

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,33 @@ if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${FAMILY}/family.cmake)
1919
message(FATAL_ERROR "Family '${FAMILY}' is not known/supported")
2020
endif()
2121

22+
set(WARNING_FLAGS_GNU
23+
-Wall
24+
-Wextra
25+
-Werror
26+
-Wfatal-errors
27+
-Wdouble-promotion
28+
-Wstrict-prototypes
29+
-Wstrict-overflow
30+
-Werror-implicit-function-declaration
31+
-Wfloat-equal
32+
-Wundef
33+
-Wshadow
34+
-Wwrite-strings
35+
-Wsign-compare
36+
-Wmissing-format-attribute
37+
-Wunreachable-code
38+
-Wcast-align
39+
-Wcast-function-type
40+
-Wcast-qual
41+
-Wnull-dereference
42+
-Wuninitialized
43+
-Wunused
44+
-Wreturn-type
45+
-Wredundant-decls
46+
)
47+
48+
set(WARNINGS_FLAGS_IAR "")
2249

2350
function(family_filter RESULT DIR)
2451
get_filename_component(DIR ${DIR} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
@@ -121,6 +148,8 @@ function(family_configure_common TARGET)
121148
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${TARGET}>
122149
)
123150

151+
target_compile_options(${TARGET} PUBLIC ${WARNING_FLAGS_${CMAKE_C_COMPILER_ID}})
152+
124153
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
125154
# Generate map file
126155
target_link_options(${TARGET} PUBLIC

hw/bsp/imxrt/family.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@
2626

2727
#include "bsp/board.h"
2828
#include "board.h"
29+
30+
// Suppress warning caused by mcu driver
31+
#ifdef __GNUC__
32+
#pragma GCC diagnostic push
33+
#pragma GCC diagnostic ignored "-Wunused-parameter"
34+
#endif
35+
2936
#include "fsl_device_registers.h"
3037
#include "fsl_gpio.h"
3138
#include "fsl_iomuxc.h"
3239
#include "fsl_clock.h"
3340
#include "fsl_lpuart.h"
3441

42+
#ifdef __GNUC__
43+
#pragma GCC diagnostic pop
44+
#endif
45+
3546
#include "clock_config.h"
3647

3748
#if defined(BOARD_TUD_RHPORT) && CFG_TUD_ENABLED

hw/bsp/lpc55/family.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ function(family_configure_example TARGET)
102102
# external driver
103103
${TOP}/lib/sct_neopixel/sct_neopixel.c
104104
)
105+
105106
target_include_directories(${TARGET} PUBLIC
106107
# family, hw, board
107108
${CMAKE_CURRENT_FUNCTION_LIST_DIR}

hw/bsp/nrf/family.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
#include "bsp/board.h"
2828
#include "board.h"
2929

30+
// Suppress warning caused by mcu driver
31+
#ifdef __GNUC__
32+
#pragma GCC diagnostic push
33+
#pragma GCC diagnostic ignored "-Wcast-qual"
34+
#pragma GCC diagnostic ignored "-Wcast-align"
35+
#pragma GCC diagnostic ignored "-Wunused-parameter"
36+
#pragma GCC diagnostic ignored "-Wundef"
37+
#endif
38+
3039
#include "nrfx.h"
3140
#include "hal/nrf_gpio.h"
3241
#include "drivers/include/nrfx_power.h"
@@ -37,6 +46,11 @@
3746
#include "nrf_soc.h"
3847
#endif
3948

49+
#ifdef __GNUC__
50+
#pragma GCC diagnostic pop
51+
#endif
52+
53+
4054
//--------------------------------------------------------------------+
4155
// Forward USB interrupt events to TinyUSB IRQ Handler
4256
//--------------------------------------------------------------------+

hw/bsp/stm32g4/family.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ IAR_ASFLAGS += --cpu cortex-m4 --fpu VFPv4
3636

3737
SRC_C += \
3838
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
39+
src/portable/st/typec/typec_stm32.c \
3940
$(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
4041
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal.c \
4142
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_cortex.c \

0 commit comments

Comments
 (0)