Skip to content

Commit 760a171

Browse files
committed
nrf: Make port build with -Werror=undef
.. build-tested on particle_xenon
1 parent bbac68e commit 760a171

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

ports/nrf/Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ INC += -I$(BUILD)
7373
INC += -I$(BUILD)/genhdr
7474
INC += -I./../../lib/cmsis/inc
7575
INC += -I./boards/$(BOARD)
76-
INC += -I./nrfx
77-
INC += -I./nrfx/hal
78-
INC += -I./nrfx/mdk
79-
INC += -I./nrfx/drivers/include
80-
INC += -I./nrfx/drivers/src
76+
INC += -isystem ./nrfx
77+
INC += -isystem ./nrfx/hal
78+
INC += -isystem ./nrfx/mdk
79+
INC += -isystem ./nrfx/drivers/include
80+
INC += -isystem ./nrfx/drivers/src
8181
INC += -I./bluetooth
8282
INC += -I./peripherals
8383
INC += -I../../lib/mp-readline
@@ -100,8 +100,8 @@ CFLAGS += $(OPTIMIZATION_FLAGS)
100100
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
101101

102102
# Undo some warnings.
103-
# nrfx uses undefined preprocessor variables quite casually, so we can't do warning checks for these.
104-
CFLAGS += -Wno-undef
103+
## nrfx uses undefined preprocessor variables quite casually, so we can't do warning checks for these.
104+
#CFLAGS += -Wno-undef
105105
# nrfx does casts that increase alignment requirements.
106106
CFLAGS += -Wno-cast-align
107107

@@ -240,6 +240,8 @@ endif
240240
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
241241
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
242242

243+
$(addprefix $(BUILD)/, $(SRC_NRFX:.c=.o)): CFLAGS += -Wno-undef
244+
243245
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
244246
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
245247

ports/nrf/common-hal/busio/SPI.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@
3434
#include "nrfx_spim.h"
3535
#include "nrf_gpio.h"
3636

37+
#ifndef NRFX_SPIM3_ENABLED
38+
#define NRFX_SPIM3_ENABLED (0)
39+
#endif
40+
41+
#ifndef NRFX_SPIM2_ENABLED
42+
#define NRFX_SPIM2_ENABLED (0)
43+
#endif
44+
45+
#ifndef NRFX_SPIM1_ENABLED
46+
#define NRFX_SPIM1_ENABLED (0)
47+
#endif
48+
49+
#ifndef NRFX_SPIM0_ENABLED
50+
#define NRFX_SPIM0_ENABLED (0)
51+
#endif
52+
3753
// These are in order from highest available frequency to lowest (32MHz first, then 8MHz).
3854
STATIC spim_peripheral_t spim_peripherals[] = {
3955
#if NRFX_CHECK(NRFX_SPIM3_ENABLED)

ports/nrf/supervisor/qspi_flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void spi_flash_init(void) {
201201
.irq_priority = 7,
202202
};
203203

204-
#if EXTERNAL_FLASH_QSPI_DUAL
204+
#if defined(EXTERNAL_FLASH_QSPI_DUAL)
205205
qspi_cfg.pins.io1_pin = MICROPY_QSPI_DATA1;
206206
qspi_cfg.prot_if.readoc = NRF_QSPI_READOC_READ2O;
207207
qspi_cfg.prot_if.writeoc = NRF_QSPI_WRITEOC_PP2O;

0 commit comments

Comments
 (0)