fix build warnings
This commit is contained in:
@@ -19,6 +19,33 @@ if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${FAMILY}/family.cmake)
|
||||
message(FATAL_ERROR "Family '${FAMILY}' is not known/supported")
|
||||
endif()
|
||||
|
||||
set(WARNING_FLAGS_GNU
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
-Wfatal-errors
|
||||
-Wdouble-promotion
|
||||
-Wstrict-prototypes
|
||||
-Wstrict-overflow
|
||||
-Werror-implicit-function-declaration
|
||||
-Wfloat-equal
|
||||
-Wundef
|
||||
-Wshadow
|
||||
-Wwrite-strings
|
||||
-Wsign-compare
|
||||
-Wmissing-format-attribute
|
||||
-Wunreachable-code
|
||||
-Wcast-align
|
||||
-Wcast-function-type
|
||||
-Wcast-qual
|
||||
-Wnull-dereference
|
||||
-Wuninitialized
|
||||
-Wunused
|
||||
-Wreturn-type
|
||||
-Wredundant-decls
|
||||
)
|
||||
|
||||
set(WARNINGS_FLAGS_IAR "")
|
||||
|
||||
function(family_filter RESULT DIR)
|
||||
get_filename_component(DIR ${DIR} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
@@ -121,6 +148,8 @@ function(family_configure_common TARGET)
|
||||
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${TARGET}>
|
||||
)
|
||||
|
||||
target_compile_options(${TARGET} PUBLIC ${WARNING_FLAGS_${CMAKE_C_COMPILER_ID}})
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
# Generate map file
|
||||
target_link_options(${TARGET} PUBLIC
|
||||
|
||||
@@ -26,12 +26,23 @@
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "board.h"
|
||||
|
||||
// Suppress warning caused by mcu driver
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
|
||||
#include "fsl_device_registers.h"
|
||||
#include "fsl_gpio.h"
|
||||
#include "fsl_iomuxc.h"
|
||||
#include "fsl_clock.h"
|
||||
#include "fsl_lpuart.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "clock_config.h"
|
||||
|
||||
#if defined(BOARD_TUD_RHPORT) && CFG_TUD_ENABLED
|
||||
|
||||
@@ -102,6 +102,7 @@ function(family_configure_example TARGET)
|
||||
# external driver
|
||||
${TOP}/lib/sct_neopixel/sct_neopixel.c
|
||||
)
|
||||
|
||||
target_include_directories(${TARGET} PUBLIC
|
||||
# family, hw, board
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
|
||||
@@ -27,6 +27,15 @@
|
||||
#include "bsp/board.h"
|
||||
#include "board.h"
|
||||
|
||||
// Suppress warning caused by mcu driver
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
|
||||
#include "nrfx.h"
|
||||
#include "hal/nrf_gpio.h"
|
||||
#include "drivers/include/nrfx_power.h"
|
||||
@@ -37,6 +46,11 @@
|
||||
#include "nrf_soc.h"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
@@ -36,6 +36,7 @@ IAR_ASFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
|
||||
SRC_C += \
|
||||
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
|
||||
src/portable/st/typec/typec_stm32.c \
|
||||
$(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_cortex.c \
|
||||
|
||||
Reference in New Issue
Block a user