enable most warning option, fix all warnings

This commit is contained in:
hathach 2020-03-25 18:39:39 +07:00
parent 6b3f70db47
commit 2128d60cc9
6 changed files with 29 additions and 12 deletions

View File

@ -52,9 +52,9 @@ RM = rm -rf
BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1)
GDB_BMP = $(GDB) -ex 'target extended-remote $(BMP_PORT)' -ex 'monitor swdp_scan' -ex 'attach 1'
#*********************************
#---------------------------------
# Select the board to build
#*********************************
#---------------------------------
BOARD_LIST = $(sort $(subst src/boards/,,$(wildcard src/boards/*)))
ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
@ -125,6 +125,7 @@ C_SRC += $(SDK_PATH)/libraries/util/nrf_assert.c
# UART or USB Serial
ifeq ($(MCU_SUB_VARIANT),nrf52)
C_SRC += $(SDK_PATH)/libraries/uart/app_uart.c
C_SRC += $(SDK_PATH)/drivers_nrf/uart/nrf_drv_uart.c
C_SRC += $(SDK_PATH)/drivers_nrf/common/nrf_drv_common.c
@ -223,15 +224,24 @@ CFLAGS += \
-fstack-usage \
-fno-strict-aliasing \
-Wall \
-Wextra \
-Werror \
-Wfatal-errors \
-Wextra
-Werror-implicit-function-declaration \
-Wfloat-equal \
-Wundef \
-Wshadow \
-Wwrite-strings \
-Wsign-compare \
-Wmissing-format-attribute \
-Wno-endif-labels \
-Wunreachable-code
# Suppress warning caused by SDK
CFLAGS += -Wno-error=unused-parameter -Wno-error=expansion-to-defined
CFLAGS += -Wno-unused-parameter -Wno-expansion-to-defined
# TinyUSB tusb_hal_nrf_power_event
CFLAGS += -Wno-error=cast-function-type
CFLAGS += -Wno-cast-function-type
# Defined Symbol (MACROS)
CFLAGS += -D__HEAP_SIZE=0

View File

@ -967,7 +967,7 @@ static void service_error_handler(uint32_t nrf_error)
}
static void ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, char * p_ascii)
static void ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, const char * p_ascii)
{
p_utf8->length = (uint16_t)strlen(p_ascii);
p_utf8->p_str = (uint8_t *)p_ascii;

View File

@ -295,7 +295,7 @@ void led_state(uint32_t state)
} else if (temp_color_active) {
final_color = (uint8_t*)&rgb_color;
}
#if LED_NEOPIXEL || defined(LED_RGB_RED_PIN)
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
if (final_color != NULL) {
neopixel_write(final_color);
}

View File

@ -6,11 +6,19 @@
#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY 7
#define NRFX_CLOCK_ENABLED 0
#define NRFX_NVMC_ENABLED 1
#define NRFX_PRS_ENABLED 0
#define NRFX_PWM_ENABLED 0
#define NRFX_PWM0_ENABLED 0
#define NRFX_PWM1_ENABLED 0
#define NRFX_PWM2_ENABLED 0
#define NRFX_PWM3_ENABLED 0
// UART
#ifdef NRF52832_XXAA
#define NRFX_UART_ENABLED 1
#define NRFX_UART0_ENABLED 1

View File

@ -78,10 +78,12 @@
#define UART_DEFAULT_CONFIG_IRQ_PRIORITY 7
#define UART_EASY_DMA_SUPPORT 1
#define UART_LEGACY_SUPPORT 1
#define UART_CONFIG_LOG_ENABLED 0
#define UART0_ENABLED 1
#define UART0_CONFIG_USE_EASY_DMA 0
//==========================================================
// <e> APP_UART_ENABLED - app_uart - UART driver
//==========================================================

View File

@ -311,10 +311,7 @@ int write_block(uint32_t block_no, uint8_t *data, bool quiet, WriteState *state)
if ((bl->flags & UF2_FLAG_NOFLASH) || bl->payloadSize > 256 || (bl->targetAddr & 0xff) ||
bl->targetAddr < USER_FLASH_START || bl->targetAddr + bl->payloadSize > USER_FLASH_END) {
#if USE_DBG_MSC
if (!quiet)
logval("invalid target addr", bl->targetAddr);
#endif
NRF_LOG_WARNING("Skip block at %x", bl->targetAddr);
// this happens when we're trying to re-flash CURRENT.UF2 file previously
// copied from a device; we still want to count these blocks to reset properly