nrf: Make port build with -Werror=undef

.. build-tested on particle_xenon
This commit is contained in:
Jeff Epler 2020-08-11 09:14:13 -05:00
parent bbac68e77c
commit 760a171903
3 changed files with 26 additions and 8 deletions

View File

@ -73,11 +73,11 @@ INC += -I$(BUILD)
INC += -I$(BUILD)/genhdr
INC += -I./../../lib/cmsis/inc
INC += -I./boards/$(BOARD)
INC += -I./nrfx
INC += -I./nrfx/hal
INC += -I./nrfx/mdk
INC += -I./nrfx/drivers/include
INC += -I./nrfx/drivers/src
INC += -isystem ./nrfx
INC += -isystem ./nrfx/hal
INC += -isystem ./nrfx/mdk
INC += -isystem ./nrfx/drivers/include
INC += -isystem ./nrfx/drivers/src
INC += -I./bluetooth
INC += -I./peripherals
INC += -I../../lib/mp-readline
@ -100,8 +100,8 @@ CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
# Undo some warnings.
# nrfx uses undefined preprocessor variables quite casually, so we can't do warning checks for these.
CFLAGS += -Wno-undef
## nrfx uses undefined preprocessor variables quite casually, so we can't do warning checks for these.
#CFLAGS += -Wno-undef
# nrfx does casts that increase alignment requirements.
CFLAGS += -Wno-cast-align
@ -240,6 +240,8 @@ endif
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
$(addprefix $(BUILD)/, $(SRC_NRFX:.c=.o)): CFLAGS += -Wno-undef
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os

View File

@ -34,6 +34,22 @@
#include "nrfx_spim.h"
#include "nrf_gpio.h"
#ifndef NRFX_SPIM3_ENABLED
#define NRFX_SPIM3_ENABLED (0)
#endif
#ifndef NRFX_SPIM2_ENABLED
#define NRFX_SPIM2_ENABLED (0)
#endif
#ifndef NRFX_SPIM1_ENABLED
#define NRFX_SPIM1_ENABLED (0)
#endif
#ifndef NRFX_SPIM0_ENABLED
#define NRFX_SPIM0_ENABLED (0)
#endif
// These are in order from highest available frequency to lowest (32MHz first, then 8MHz).
STATIC spim_peripheral_t spim_peripherals[] = {
#if NRFX_CHECK(NRFX_SPIM3_ENABLED)

View File

@ -201,7 +201,7 @@ void spi_flash_init(void) {
.irq_priority = 7,
};
#if EXTERNAL_FLASH_QSPI_DUAL
#if defined(EXTERNAL_FLASH_QSPI_DUAL)
qspi_cfg.pins.io1_pin = MICROPY_QSPI_DATA1;
qspi_cfg.prot_if.readoc = NRF_QSPI_READOC_READ2O;
qspi_cfg.prot_if.writeoc = NRF_QSPI_WRITEOC_PP2O;