-Werror=missing-prototypes for nRF
This commit is contained in:
parent
c9475adb00
commit
9e799a7c74
@ -101,7 +101,7 @@ endif
|
||||
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
||||
CFLAGS += $(OPTIMIZATION_FLAGS)
|
||||
|
||||
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
|
||||
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
|
||||
|
||||
# Nordic Softdevice SDK header files contains inline assembler that has
|
||||
# broken constraints. As a result the IPA-modref pass, introduced in gcc-11,
|
||||
@ -173,25 +173,32 @@ SRC_C += \
|
||||
bluetooth/ble_drv.c \
|
||||
common-hal/_bleio/bonding.c \
|
||||
nrfx/mdk/system_$(MCU_SUB_VARIANT).c \
|
||||
sd_mutex.c \
|
||||
|
||||
SRC_PERIPHERALS := \
|
||||
peripherals/nrf/cache.c \
|
||||
peripherals/nrf/clocks.c \
|
||||
peripherals/nrf/$(MCU_CHIP)/pins.c \
|
||||
peripherals/nrf/$(MCU_CHIP)/power.c \
|
||||
peripherals/nrf/nvm.c \
|
||||
peripherals/nrf/timers.c \
|
||||
sd_mutex.c
|
||||
|
||||
$(patsubst %.c,$(BUILD)/%.o,$(SRC_PERIPHERALS)): CFLAGS += -Wno-missing-prototypes
|
||||
|
||||
SRC_C += $(SRC_PERIPHERALS)
|
||||
ifneq ($(CIRCUITPY_USB),0)
|
||||
# USB source files for nrf52840
|
||||
ifeq ($(MCU_SUB_VARIANT),nrf52840)
|
||||
SRC_C += \
|
||||
SRC_DCD = \
|
||||
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c
|
||||
endif
|
||||
|
||||
ifeq ($(MCU_SUB_VARIANT),nrf52833)
|
||||
SRC_C += \
|
||||
SRC_DCD += \
|
||||
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c
|
||||
endif
|
||||
SRC_C += $(SRC_DCD)
|
||||
$(patsubst %.c,$(BUILD)/%.o,$(SRC_DCD)): CFLAGS += -Wno-missing-prototypes
|
||||
endif # CIRCUITPY_USB
|
||||
|
||||
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
||||
|
@ -26,8 +26,9 @@
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/usb.h"
|
||||
#include "supervisor/port.h"
|
||||
#include "supervisor/shared/stack.h"
|
||||
#include "supervisor/usb.h"
|
||||
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "shared-bindings/_bleio/Connection.h"
|
||||
#include "supervisor/shared/tick.h"
|
||||
#include "common-hal/_bleio/CharacteristicBuffer.h"
|
||||
#include "shared-bindings/_bleio/CharacteristicBuffer.h"
|
||||
|
||||
// Push all the data onto the ring buffer. When the buffer is full, new bytes will be dropped.
|
||||
STATIC void write_to_ringbuf(bleio_characteristic_buffer_obj_t *self, uint8_t *data, uint16_t len) {
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "common-hal/_bleio/UUID.h"
|
||||
#include "shared-bindings/_bleio/UUID.h"
|
||||
#include "shared-bindings/_bleio/__init__.h"
|
||||
#include "shared-bindings/_bleio/Adapter.h"
|
||||
|
||||
|
@ -85,4 +85,9 @@ const ble_gap_enc_key_t *bonding_load_peer_encryption_key(bool is_central, const
|
||||
size_t bonding_load_identities(bool is_central, const ble_gap_id_key_t **keys, size_t max_length);
|
||||
size_t bonding_peripheral_bond_count(void);
|
||||
|
||||
#if BONDING_DEBUG
|
||||
void bonding_print_block(bonding_block_t *);
|
||||
void bonding_print_keys(bonding_keys_t *);
|
||||
#endif
|
||||
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_BONDING_H
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "py/runtime.h"
|
||||
#include "common-hal/alarm/__init__.h"
|
||||
#include "common-hal/alarm/SleepMemory.h"
|
||||
#include "shared-bindings/alarm/SleepMemory.h"
|
||||
#include "nrf_power.h"
|
||||
|
||||
__attribute__((section(".uninitialized"))) static uint8_t _sleepmem[SLEEP_MEMORY_LENGTH];
|
||||
|
@ -147,7 +147,7 @@ STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t
|
||||
// TODO: this handles all possible types of wakeup, which is redundant with main.
|
||||
// revise to extract all parts essential to enabling sleep wakeup, but leave the
|
||||
// alarm/non-alarm sorting to the existing main loop.
|
||||
void system_on_idle_until_alarm(int64_t timediff_ms, bool wake_from_serial, uint32_t prescaler) {
|
||||
STATIC void system_on_idle_until_alarm(int64_t timediff_ms, bool wake_from_serial, uint32_t prescaler) {
|
||||
bool have_timeout = false;
|
||||
uint64_t start_tick = 0, end_tick = 0;
|
||||
int64_t tickdiff;
|
||||
|
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "common-hal/analogio/AnalogIn.h"
|
||||
#include "shared-bindings/analogio/AnalogIn.h"
|
||||
#include "py/runtime.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
|
@ -91,7 +91,7 @@ static void calculate_ratio_info(uint32_t target_sample_rate, struct frequency_i
|
||||
/ target_sample_rate;
|
||||
}
|
||||
|
||||
void choose_i2s_clocking(audiobusio_i2sout_obj_t *self, uint32_t sample_rate) {
|
||||
STATIC void choose_i2s_clocking(audiobusio_i2sout_obj_t *self, uint32_t sample_rate) {
|
||||
struct frequency_info best = {0, 0, 0, 1.0};
|
||||
for (size_t ri = 0; ri < sizeof(ratios) / sizeof(ratios[0]); ri++) {
|
||||
if (NRF_I2S->CONFIG.SWIDTH == I2S_CONFIG_SWIDTH_SWIDTH_16Bit
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "common-hal/audiobusio/PDMIn.h"
|
||||
#include "shared-bindings/audiobusio/PDMIn.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
#include "py/runtime.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
#include "common-hal/countio/Counter.h"
|
||||
#include "shared-bindings/countio/Counter.h"
|
||||
|
||||
#include "py/runtime.h"
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "common-hal/microcontroller/Processor.h"
|
||||
#include "shared-bindings/microcontroller/Processor.h"
|
||||
|
||||
#include "common-hal/alarm/__init__.h"
|
||||
#include "shared-bindings/microcontroller/ResetReason.h"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "py/mphal.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "shared-bindings/neopixel_write/__init__.h"
|
||||
#include "common-hal/neopixel_write/__init__.h"
|
||||
#include "supervisor/port.h"
|
||||
#include "nrf_pwm.h"
|
||||
|
||||
|
@ -26,13 +26,14 @@
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "common-hal/nvm/ByteArray.h"
|
||||
#include "shared-bindings/nvm/ByteArray.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "peripherals/nrf/nvm.h"
|
||||
|
||||
uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) {
|
||||
uint32_t common_hal_nvm_bytearray_get_length(const nvm_bytearray_obj_t *self) {
|
||||
return self->len;
|
||||
}
|
||||
|
||||
@ -50,7 +51,7 @@ static bool write_page(uint32_t page_addr, uint32_t offset, uint32_t len, uint8_
|
||||
}
|
||||
}
|
||||
|
||||
bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
|
||||
bool common_hal_nvm_bytearray_set_bytes(const nvm_bytearray_obj_t *self,
|
||||
uint32_t start_index, uint8_t *values, uint32_t len) {
|
||||
|
||||
uint32_t address = (uint32_t)self->start_address + start_index;
|
||||
@ -70,7 +71,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
|
||||
return true;
|
||||
}
|
||||
|
||||
void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self,
|
||||
void common_hal_nvm_bytearray_get_bytes(const nvm_bytearray_obj_t *self,
|
||||
uint32_t start_index, uint32_t len, uint8_t *values) {
|
||||
memcpy(values, self->start_address + start_index, len);
|
||||
}
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "py/objstr.h"
|
||||
#include "py/objtuple.h"
|
||||
|
||||
#include "shared-bindings/os/__init__.h"
|
||||
|
||||
#ifdef BLUETOOTH_SD
|
||||
#include "nrf_sdm.h"
|
||||
#endif
|
||||
@ -61,7 +63,7 @@ mp_obj_t common_hal_os_uname(void) {
|
||||
return (mp_obj_t)&os_uname_info_obj;
|
||||
}
|
||||
|
||||
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||
#ifdef BLUETOOTH_SD
|
||||
uint8_t sd_en = 0;
|
||||
(void)sd_softdevice_is_enabled(&sd_en);
|
||||
|
@ -86,7 +86,7 @@ void common_hal_pwmio_pwmout_reset_ok(pwmio_pwmout_obj_t *self) {
|
||||
}
|
||||
}
|
||||
|
||||
void reset_single_pwmout(uint8_t i) {
|
||||
STATIC void reset_single_pwmout(uint8_t i) {
|
||||
NRF_PWM_Type *pwm = pwms[i];
|
||||
|
||||
pwm->ENABLE = 0;
|
||||
@ -122,7 +122,7 @@ void pwmout_reset(void) {
|
||||
|
||||
// Find the smallest prescaler value that will allow the divisor to be in range.
|
||||
// This allows the most accuracy.
|
||||
bool convert_frequency(uint32_t frequency, uint16_t *countertop, nrf_pwm_clk_t *base_clock) {
|
||||
STATIC bool convert_frequency(uint32_t frequency, uint16_t *countertop, nrf_pwm_clk_t *base_clock) {
|
||||
uint32_t divisor = 1;
|
||||
// Use a 32-bit number so we don't overflow the uint16_t;
|
||||
uint32_t tentative_countertop;
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "common-hal/rotaryio/IncrementalEncoder.h"
|
||||
#include "shared-module/rotaryio/IncrementalEncoder.h"
|
||||
#include "shared-bindings/rotaryio/IncrementalEncoder.h"
|
||||
#include "nrfx_gpiote.h"
|
||||
|
||||
#include "py/runtime.h"
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "py/runtime.h"
|
||||
#include "shared/timeutils/timeutils.h"
|
||||
#include "shared-bindings/rtc/__init__.h"
|
||||
#include "common-hal/rtc/RTC.h"
|
||||
#include "shared-bindings/rtc/RTC.h"
|
||||
#include "supervisor/port.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
|
@ -40,12 +40,14 @@ typedef void (*func)(void);
|
||||
extern void _start(void) __attribute__((noreturn));
|
||||
extern void SystemInit(void);
|
||||
|
||||
extern void Default_Handler(void);
|
||||
void Default_Handler(void) {
|
||||
while (1) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
extern void Reset_Handler(void);
|
||||
void Reset_Handler(void) {
|
||||
uint32_t *p_src = &_sidata;
|
||||
uint32_t *p_dest = &_sdata;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "shared/timeutils/timeutils.h"
|
||||
#include "shared-bindings/rtc/RTC.h"
|
||||
#include "shared-bindings/time/__init__.h"
|
||||
#include "supervisor/fatfs_port.h"
|
||||
|
||||
DWORD _time_override = 0;
|
||||
DWORD get_fattime(void) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "nrfx.h"
|
||||
#include "peripherals/nrf/cache.h"
|
||||
|
||||
// Turn off cache and invalidate all data in it.
|
||||
void nrf_peripherals_disable_and_clear_cache(void) {
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "nrfx.h"
|
||||
#include "hal/nrf_nvmc.h"
|
||||
#include "peripherals/nrf/power.h"
|
||||
|
||||
void nrf_peripherals_power_init(void) {
|
||||
// Set GPIO reference voltage to 3.3V if it isn't already. REGOUT0 will get reset to 0xfffffff
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/runtime.h"
|
||||
#include "nrf_soc.h"
|
||||
#include "sd_mutex.h"
|
||||
|
||||
void sd_mutex_acquire_check(nrf_mutex_t *p_mutex) {
|
||||
uint32_t err_code = sd_mutex_acquire(p_mutex);
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "common-hal/_bleio/__init__.h"
|
||||
#include "common-hal/alarm/time/TimeAlarm.h"
|
||||
#include "common-hal/analogio/AnalogIn.h"
|
||||
#include "common-hal/busio/I2C.h"
|
||||
#include "common-hal/busio/SPI.h"
|
||||
@ -97,7 +98,7 @@ static volatile struct {
|
||||
uint32_t suffix;
|
||||
} overflow_tracker __attribute__((section(".uninitialized")));
|
||||
|
||||
void rtc_handler(nrfx_rtc_int_type_t int_type) {
|
||||
STATIC void rtc_handler(nrfx_rtc_int_type_t int_type) {
|
||||
if (int_type == NRFX_RTC_INT_OVERFLOW) {
|
||||
// Our RTC is 24 bits and we're clocking it at 32.768khz which is 32 (2 ** 5) subticks per
|
||||
// tick.
|
||||
@ -116,7 +117,7 @@ void rtc_handler(nrfx_rtc_int_type_t int_type) {
|
||||
}
|
||||
}
|
||||
|
||||
void tick_init(void) {
|
||||
STATIC void tick_init(void) {
|
||||
if (!nrf_clock_lf_is_running(NRF_CLOCK)) {
|
||||
nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_LFCLKSTART);
|
||||
}
|
||||
@ -137,7 +138,7 @@ void tick_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void tick_uninit(void) {
|
||||
STATIC void tick_uninit(void) {
|
||||
nrfx_rtc_counter_clear(&rtc_instance);
|
||||
nrfx_rtc_disable(&rtc_instance);
|
||||
nrfx_rtc_uninit(&rtc_instance);
|
||||
@ -400,6 +401,7 @@ void port_idle_until_interrupt(void) {
|
||||
}
|
||||
|
||||
|
||||
extern void HardFault_Handler(void);
|
||||
void HardFault_Handler(void) {
|
||||
reset_into_safe_mode(HARD_CRASH);
|
||||
while (true) {
|
||||
|
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "supervisor/spi_flash_api.h"
|
||||
#include "supervisor/qspi_flash.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@ -69,7 +70,7 @@ void qspi_disable(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void qspi_enable(void) {
|
||||
STATIC void qspi_enable(void) {
|
||||
if (NRF_QSPI->ENABLE) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
extern void qspi_flash_enter_sleep(void);
|
||||
extern void qspi_flash_exit_sleep(void);
|
||||
extern void qspi_disable(void);
|
||||
|
@ -91,6 +91,7 @@ void init_usb_hardware(void) {
|
||||
}
|
||||
}
|
||||
|
||||
extern void USBD_IRQHandler(void);
|
||||
void USBD_IRQHandler(void) {
|
||||
usb_irq_handler();
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#include "supervisor/fatfs_port.h"
|
||||
#include "supervisor/shared/autoreload.h"
|
||||
#include "supervisor/shared/bluetooth/file_transfer.h"
|
||||
#include "supervisor/shared/bluetooth/file_transfer_protocol.h"
|
||||
#include "supervisor/shared/tick.h"
|
||||
#include "supervisor/usb.h"
|
||||
@ -136,7 +137,7 @@ void supervisor_start_bluetooth_file_transfer(void) {
|
||||
// FATFS has a two second timestamp resolution but the BLE API allows for nanosecond resolution.
|
||||
// This function truncates the time the time to a resolution storable by FATFS and fills in the
|
||||
// FATFS encoded version into fattime.
|
||||
uint64_t truncate_time(uint64_t input_time, DWORD *fattime) {
|
||||
STATIC uint64_t truncate_time(uint64_t input_time, DWORD *fattime) {
|
||||
timeutils_struct_time_t tm;
|
||||
uint64_t seconds_since_epoch = timeutils_seconds_since_epoch_from_nanoseconds_since_1970(input_time);
|
||||
timeutils_seconds_since_epoch_to_struct_time(seconds_since_epoch, &tm);
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "shared-bindings/_bleio/Service.h"
|
||||
#include "shared-bindings/_bleio/UUID.h"
|
||||
#include "shared-module/storage/__init__.h"
|
||||
#include "supervisor/shared/bluetooth/serial.h"
|
||||
|
||||
#include "common-hal/_bleio/__init__.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user