Skip to content

Commit

Permalink
enable most warning option, fix all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Mar 25, 2020
1 parent 6b3f70d commit 2128d60
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)),)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
10 changes: 9 additions & 1 deletion src/nrfx_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/sdk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//==========================================================
Expand Down
5 changes: 1 addition & 4 deletions src/usb/uf2/ghostfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2128d60

Please sign in to comment.