Skip to content

Commit 9e799a7

Browse files
committed
-Werror=missing-prototypes for nRF
1 parent c9475ad commit 9e799a7

File tree

29 files changed

+58
-18
lines changed

29 files changed

+58
-18
lines changed

ports/nrf/Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ endif
101101
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
102102
CFLAGS += $(OPTIMIZATION_FLAGS)
103103

104-
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
104+
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
105105

106106
# Nordic Softdevice SDK header files contains inline assembler that has
107107
# broken constraints. As a result the IPA-modref pass, introduced in gcc-11,
@@ -173,25 +173,32 @@ SRC_C += \
173173
bluetooth/ble_drv.c \
174174
common-hal/_bleio/bonding.c \
175175
nrfx/mdk/system_$(MCU_SUB_VARIANT).c \
176+
sd_mutex.c \
177+
178+
SRC_PERIPHERALS := \
176179
peripherals/nrf/cache.c \
177180
peripherals/nrf/clocks.c \
178181
peripherals/nrf/$(MCU_CHIP)/pins.c \
179182
peripherals/nrf/$(MCU_CHIP)/power.c \
180183
peripherals/nrf/nvm.c \
181184
peripherals/nrf/timers.c \
182-
sd_mutex.c
183185

186+
$(patsubst %.c,$(BUILD)/%.o,$(SRC_PERIPHERALS)): CFLAGS += -Wno-missing-prototypes
187+
188+
SRC_C += $(SRC_PERIPHERALS)
184189
ifneq ($(CIRCUITPY_USB),0)
185190
# USB source files for nrf52840
186191
ifeq ($(MCU_SUB_VARIANT),nrf52840)
187-
SRC_C += \
192+
SRC_DCD = \
188193
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c
189194
endif
190195

191196
ifeq ($(MCU_SUB_VARIANT),nrf52833)
192-
SRC_C += \
197+
SRC_DCD += \
193198
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c
194199
endif
200+
SRC_C += $(SRC_DCD)
201+
$(patsubst %.c,$(BUILD)/%.o,$(SRC_DCD)): CFLAGS += -Wno-missing-prototypes
195202
endif # CIRCUITPY_USB
196203

197204
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \

ports/nrf/background.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626

2727
#include "py/runtime.h"
2828
#include "supervisor/filesystem.h"
29-
#include "supervisor/usb.h"
29+
#include "supervisor/port.h"
3030
#include "supervisor/shared/stack.h"
31+
#include "supervisor/usb.h"
3132

3233
#if CIRCUITPY_DISPLAYIO
3334
#include "shared-module/displayio/__init__.h"

ports/nrf/common-hal/_bleio/CharacteristicBuffer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "shared-bindings/_bleio/Connection.h"
4040
#include "supervisor/shared/tick.h"
4141
#include "common-hal/_bleio/CharacteristicBuffer.h"
42+
#include "shared-bindings/_bleio/CharacteristicBuffer.h"
4243

4344
// Push all the data onto the ring buffer. When the buffer is full, new bytes will be dropped.
4445
STATIC void write_to_ringbuf(bleio_characteristic_buffer_obj_t *self, uint8_t *data, uint16_t len) {

ports/nrf/common-hal/_bleio/UUID.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include "py/runtime.h"
3232
#include "common-hal/_bleio/UUID.h"
33+
#include "shared-bindings/_bleio/UUID.h"
3334
#include "shared-bindings/_bleio/__init__.h"
3435
#include "shared-bindings/_bleio/Adapter.h"
3536

ports/nrf/common-hal/_bleio/bonding.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,9 @@ const ble_gap_enc_key_t *bonding_load_peer_encryption_key(bool is_central, const
8585
size_t bonding_load_identities(bool is_central, const ble_gap_id_key_t **keys, size_t max_length);
8686
size_t bonding_peripheral_bond_count(void);
8787

88+
#if BONDING_DEBUG
89+
void bonding_print_block(bonding_block_t *);
90+
void bonding_print_keys(bonding_keys_t *);
91+
#endif
92+
8893
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_BONDING_H

ports/nrf/common-hal/alarm/SleepMemory.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "py/runtime.h"
2929
#include "common-hal/alarm/__init__.h"
3030
#include "common-hal/alarm/SleepMemory.h"
31+
#include "shared-bindings/alarm/SleepMemory.h"
3132
#include "nrf_power.h"
3233

3334
__attribute__((section(".uninitialized"))) static uint8_t _sleepmem[SLEEP_MEMORY_LENGTH];

ports/nrf/common-hal/alarm/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t
147147
// TODO: this handles all possible types of wakeup, which is redundant with main.
148148
// revise to extract all parts essential to enabling sleep wakeup, but leave the
149149
// alarm/non-alarm sorting to the existing main loop.
150-
void system_on_idle_until_alarm(int64_t timediff_ms, bool wake_from_serial, uint32_t prescaler) {
150+
STATIC void system_on_idle_until_alarm(int64_t timediff_ms, bool wake_from_serial, uint32_t prescaler) {
151151
bool have_timeout = false;
152152
uint64_t start_tick = 0, end_tick = 0;
153153
int64_t tickdiff;

ports/nrf/common-hal/analogio/AnalogIn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include "common-hal/analogio/AnalogIn.h"
29+
#include "shared-bindings/analogio/AnalogIn.h"
2930
#include "py/runtime.h"
3031
#include "supervisor/shared/translate.h"
3132

ports/nrf/common-hal/audiobusio/I2SOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void calculate_ratio_info(uint32_t target_sample_rate, struct frequency_i
9191
/ target_sample_rate;
9292
}
9393

94-
void choose_i2s_clocking(audiobusio_i2sout_obj_t *self, uint32_t sample_rate) {
94+
STATIC void choose_i2s_clocking(audiobusio_i2sout_obj_t *self, uint32_t sample_rate) {
9595
struct frequency_info best = {0, 0, 0, 1.0};
9696
for (size_t ri = 0; ri < sizeof(ratios) / sizeof(ratios[0]); ri++) {
9797
if (NRF_I2S->CONFIG.SWIDTH == I2S_CONFIG_SWIDTH_SWIDTH_16Bit

ports/nrf/common-hal/audiobusio/PDMIn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#include "common-hal/audiobusio/PDMIn.h"
28+
#include "shared-bindings/audiobusio/PDMIn.h"
2829
#include "shared-bindings/microcontroller/Pin.h"
2930

3031
#include "py/runtime.h"

0 commit comments

Comments
 (0)