diff --git a/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c b/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c index bb6b8788b6f4..0d87f03ae30a 100644 --- a/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c +++ b/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c @@ -33,6 +33,7 @@ #include "shared-bindings/_bleio/__init__.h" #include "shared-bindings/_bleio/Connection.h" +#include "shared-bindings/_bleio/CharacteristicBuffer.h" #include "supervisor/shared/tick.h" #include "common-hal/_bleio/CharacteristicBuffer.h" diff --git a/devices/ble_hci/common-hal/_bleio/Connection.h b/devices/ble_hci/common-hal/_bleio/Connection.h index 2933bb87a555..185a8b351758 100644 --- a/devices/ble_hci/common-hal/_bleio/Connection.h +++ b/devices/ble_hci/common-hal/_bleio/Connection.h @@ -85,5 +85,6 @@ typedef struct { uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self); mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *connection); bleio_connection_internal_t *bleio_conn_handle_to_connection(uint16_t conn_handle); +void bleio_connection_clear(bleio_connection_internal_t *self); #endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_CONNECTION_H diff --git a/devices/ble_hci/common-hal/_bleio/att.c b/devices/ble_hci/common-hal/_bleio/att.c index b0fc884e005b..abfe7429f490 100644 --- a/devices/ble_hci/common-hal/_bleio/att.c +++ b/devices/ble_hci/common-hal/_bleio/att.c @@ -1,6 +1,12 @@ // Derived from ArduinoBLE. // Copyright 2020 Dan Halbert for Adafruit Industries +// Some functions here are unused now, but may be used in the future. +// Don't warn or error about this, and depend on the compiler & linker to +// eliminate the associated code. +#pragma GCC diagnostic ignored "-Wunused" +#pragma GCC diagnostic ignored "-Wunused-function" + /* This file is part of the ArduinoBLE library. Copyright (c) 2018 Arduino SA. All rights reserved. @@ -857,7 +863,7 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl } } -int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t response_buffer[]) { +static int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t response_buffer[]) { struct __packed req { struct bt_att_hdr h; struct bt_att_find_info_req r; @@ -925,7 +931,7 @@ STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl } } -void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) { +static void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) { struct bt_att_read_group_req *req = (struct bt_att_read_group_req *)data; uint16_t type_uuid = req->uuid[0] | (req->uuid[1] << 8); @@ -1009,7 +1015,7 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui } } -int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) { +static int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) { typedef struct __packed { struct bt_att_hdr h; @@ -1305,7 +1311,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl } } -int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) { +static int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) { typedef struct __packed { struct bt_att_hdr h; struct bt_att_read_type_req r; @@ -1715,7 +1721,7 @@ void att_process_data(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) { } // FIX Do we need all of these? -void check_att_err(uint8_t err) { +static void check_att_err(uint8_t err) { const compressed_string_t *msg = NULL; switch (err) { case 0: diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index c828a78df58d..74baebd355f5 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -291,7 +291,7 @@ $(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sdhc/hpl_sdhc.o: CFLAGS += -Wno-cast-align -Wno endif SRC_ASF := $(addprefix asf4/$(CHIP_FAMILY)/, $(SRC_ASF)) -$(patsubst $(SRC_ASF),%.c,%.o): CFLAGS += -Wno-missing-prototypes +$(patsubst %.c,$(BUILD)/%.o,$(SRC_ASF)): CFLAGS += -Wno-missing-prototypes SRC_PERIPHERALS := \ peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \ @@ -310,7 +310,7 @@ SRC_PERIPHERALS := \ peripherals/samd/sercom.c \ peripherals/samd/timers.c \ -$(patsubst $(SRC_PERIPHERALS),%.c,%.o): CFLAGS += -Wno-missing-prototypes +$(patsubst %.c,$(BUILD)/%.o,$(SRC_PERIPHERALS)): CFLAGS += -Wno-missing-prototypes SRC_C += \ audio_dma.c \ @@ -328,6 +328,8 @@ SRC_C += \ timer_handler.c \ $(SRC_PERIPHERALS) \ +$(BUILD)/lib/tinyusb/src/portable/microchip/samd/dcd_samd.o: CFLAGS += -Wno-missing-prototypes + # This is an OR because it filters to any 1s and then checks to see if it is not # empty. ifneq (,$(filter 1,$(CIRCUITPY_PWMIO) $(CIRCUITPY_AUDIOIO) $(CIRCUITPY_RGBMATRIX))) diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c index 6ce97f7b3f20..5e339d88cb59 100644 --- a/ports/atmel-samd/boards/pewpew_m4/board.c +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -50,7 +50,7 @@ typedef struct { #define DELAY 0x80 -uint32_t lookupCfg(uint32_t key, uint32_t defl) { +STATIC uint32_t lookupCfg(uint32_t key, uint32_t defl) { const uint32_t *ptr = UF2_BINFO->config_data; if (!ptr || (((uint32_t)ptr) & 3) || *ptr != CFG_MAGIC0) { // no config data! diff --git a/ports/atmel-samd/common-hal/alarm/SleepMemory.c b/ports/atmel-samd/common-hal/alarm/SleepMemory.c index cb3b1b3aa9b9..8ad357756495 100644 --- a/ports/atmel-samd/common-hal/alarm/SleepMemory.c +++ b/ports/atmel-samd/common-hal/alarm/SleepMemory.c @@ -28,6 +28,7 @@ #include "py/runtime.h" #include "common-hal/alarm/SleepMemory.h" +#include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/nvm/ByteArray.h" void alarm_sleep_memory_reset(void) { diff --git a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c index e00d69c8483f..e6363395a6b8 100644 --- a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c +++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -485,6 +485,3 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se return values_output; } - -void common_hal_audiobusio_pdmin_record_to_file(audiobusio_pdmin_obj_t* self, uint8_t* buffer, uint32_t length) { -} diff --git a/ports/atmel-samd/common-hal/busio/__init__.c b/ports/atmel-samd/common-hal/busio/__init__.c index 8ec549e93194..8d1f085ffaed 100644 --- a/ports/atmel-samd/common-hal/busio/__init__.c +++ b/ports/atmel-samd/common-hal/busio/__init__.c @@ -25,6 +25,7 @@ */ #include "samd/sercom.h" +#include "common-hal/busio/__init__.h" static bool never_reset_sercoms[SERCOM_INST_NUM]; diff --git a/ports/atmel-samd/common-hal/canio/Listener.c b/ports/atmel-samd/common-hal/canio/Listener.c index e171ae5193c5..5cdfafe9c039 100644 --- a/ports/atmel-samd/common-hal/canio/Listener.c +++ b/ports/atmel-samd/common-hal/canio/Listener.c @@ -195,7 +195,7 @@ STATIC void install_extended_filter(CanMramXidfe *extended, int id1, int id2, in #define NO_ID (-1) -void set_filters(canio_listener_obj_t *self, size_t nmatch, canio_match_obj_t **matches) { +STATIC void set_filters(canio_listener_obj_t *self, size_t nmatch, canio_match_obj_t **matches) { int fifo = self->fifo_idx; if (!nmatch) { diff --git a/ports/atmel-samd/common-hal/countio/Counter.c b/ports/atmel-samd/common-hal/countio/Counter.c index 4531a4ed8c39..e4df55eba642 100644 --- a/ports/atmel-samd/common-hal/countio/Counter.c +++ b/ports/atmel-samd/common-hal/countio/Counter.c @@ -1,5 +1,6 @@ #include "common-hal/countio/Counter.h" +#include "shared-bindings/countio/Counter.h" #include "atmel_start_pins.h" diff --git a/ports/atmel-samd/common-hal/microcontroller/Processor.c b/ports/atmel-samd/common-hal/microcontroller/Processor.c index e9831c953a2b..29d6612ad804 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Processor.c +++ b/ports/atmel-samd/common-hal/microcontroller/Processor.c @@ -65,6 +65,7 @@ #include "py/mphal.h" #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" #include "samd/adc.h" diff --git a/ports/atmel-samd/common-hal/nvm/ByteArray.c b/ports/atmel-samd/common-hal/nvm/ByteArray.c index 9d711d34134c..e6f77bb04857 100644 --- a/ports/atmel-samd/common-hal/nvm/ByteArray.c +++ b/ports/atmel-samd/common-hal/nvm/ByteArray.c @@ -25,6 +25,7 @@ */ #include "common-hal/nvm/ByteArray.h" +#include "shared-bindings/nvm/ByteArray.h" #include "hal_flash.h" @@ -33,11 +34,11 @@ #include #include -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; } -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) { // We don't use features that use any advanced NVMCTRL features so we can fake the descriptor // whenever we need it instead of storing it long term. @@ -49,7 +50,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self, } // NVM memory is memory mapped so reading it is easy. -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); } diff --git a/ports/atmel-samd/common-hal/os/__init__.c b/ports/atmel-samd/common-hal/os/__init__.c index 6c554bff3004..f0e20bdfcf27 100644 --- a/ports/atmel-samd/common-hal/os/__init__.c +++ b/ports/atmel-samd/common-hal/os/__init__.c @@ -30,6 +30,8 @@ #include "py/objtuple.h" #include "py/qstr.h" +#include "shared-bindings/os/__init__.h" + #ifdef SAM_D5X_E5X #include "hal/include/hal_rand_sync.h" #endif @@ -66,7 +68,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 SAM_D5X_E5X hri_mclk_set_APBCMASK_TRNG_bit(MCLK); struct rand_sync_desc random; diff --git a/ports/atmel-samd/common-hal/ps2io/Ps2.c b/ports/atmel-samd/common-hal/ps2io/Ps2.c index f07cadf4179b..6e2fb58e5166 100644 --- a/ports/atmel-samd/common-hal/ps2io/Ps2.c +++ b/ports/atmel-samd/common-hal/ps2io/Ps2.c @@ -26,6 +26,7 @@ */ #include "common-hal/ps2io/Ps2.h" +#include "shared-bindings/ps2io/Ps2.h" #include @@ -302,11 +303,6 @@ uint16_t common_hal_ps2io_ps2_get_len(ps2io_ps2_obj_t *self) { return self->bufcount; } -bool common_hal_ps2io_ps2_get_paused(ps2io_ps2_obj_t *self) { - uint32_t mask = 1 << self->channel; - return (EIC->INTENSET.reg & (mask << EIC_INTENSET_EXTINT_Pos)) == 0; -} - int16_t common_hal_ps2io_ps2_popleft(ps2io_ps2_obj_t *self) { common_hal_mcu_disable_interrupts(); if (self->bufcount <= 0) { diff --git a/ports/atmel-samd/common-hal/pulseio/PulseOut.c b/ports/atmel-samd/common-hal/pulseio/PulseOut.c index b72e0d1f4305..b0407a11363c 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseOut.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseOut.c @@ -59,7 +59,7 @@ static void turn_off(__IO PORT_PINCFG_Type *pincfg) { pincfg->reg = PORT_PINCFG_RESETVALUE; } -void pulse_finish(void) { +STATIC void pulse_finish(void) { pulse_index++; if (active_pincfg == NULL) { diff --git a/ports/atmel-samd/common-hal/pwmio/PWMOut.c b/ports/atmel-samd/common-hal/pwmio/PWMOut.c index fa6a2d3f4780..eaec10463d25 100644 --- a/ports/atmel-samd/common-hal/pwmio/PWMOut.c +++ b/ports/atmel-samd/common-hal/pwmio/PWMOut.c @@ -91,7 +91,7 @@ static uint8_t tcc_channel(const pin_timer_t *t) { return t->wave_output % tcc_cc_num[t->index]; } -bool channel_ok(const pin_timer_t *t) { +STATIC bool channel_ok(const pin_timer_t *t) { uint8_t channel_bit = 1 << tcc_channel(t); return (!t->is_tc && ((tcc_channels[t->index] & channel_bit) == 0)) || t->is_tc; diff --git a/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c b/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c index dc9cf653340e..856fe04dbc86 100644 --- a/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -25,6 +25,7 @@ */ #include "common-hal/rotaryio/IncrementalEncoder.h" +#include "shared-bindings/rotaryio/IncrementalEncoder.h" #include "shared-module/rotaryio/IncrementalEncoder.h" #include "atmel_start_pins.h" diff --git a/ports/atmel-samd/common-hal/rtc/RTC.c b/ports/atmel-samd/common-hal/rtc/RTC.c index 65d7d942200e..e2a67bd17448 100644 --- a/ports/atmel-samd/common-hal/rtc/RTC.c +++ b/ports/atmel-samd/common-hal/rtc/RTC.c @@ -35,6 +35,7 @@ #include "py/runtime.h" #include "shared/timeutils/timeutils.h" #include "shared-bindings/rtc/__init__.h" +#include "shared-bindings/rtc/RTC.h" #include "supervisor/port.h" #include "supervisor/shared/translate.h" diff --git a/ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c b/ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c index 329242887cbb..2091b7d302f8 100644 --- a/ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c +++ b/ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c @@ -50,7 +50,7 @@ mp_float_t common_hal_watchdog_get_timeout(watchdog_watchdogtimer_obj_t *self) { return self->timeout; } -void setup_wdt(watchdog_watchdogtimer_obj_t *self, int setting) { +STATIC void setup_wdt(watchdog_watchdogtimer_obj_t *self, int setting) { OSC32KCTRL->OSCULP32K.bit.EN1K = 1; // Enable out 1K (for WDT) // disable watchdog for config diff --git a/ports/atmel-samd/supervisor/internal_flash.c b/ports/atmel-samd/supervisor/internal_flash.c index afac00123278..3e57e21d9148 100644 --- a/ports/atmel-samd/supervisor/internal_flash.c +++ b/ports/atmel-samd/supervisor/internal_flash.c @@ -78,10 +78,6 @@ void port_internal_flash_flush(void) { void supervisor_flash_release_cache(void) { } -void flash_flush(void) { - supervisor_flash_flush(); -} - static int32_t convert_block_to_flash_addr(uint32_t block) { if (0 <= block && block < INTERNAL_FLASH_PART1_NUM_BLOCKS) { // a block in partition 1 @@ -91,7 +87,7 @@ static int32_t convert_block_to_flash_addr(uint32_t block) { return -1; } -bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) { +STATIC bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) { // non-MBR block, get data from flash memory int32_t src = convert_block_to_flash_addr(block); if (src == -1) { @@ -102,7 +98,7 @@ bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) { return error_code == ERR_NONE; } -bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) { +STATIC bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) { // non-MBR block, copy to cache int32_t dest = convert_block_to_flash_addr(block); if (dest == -1) { diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 5038d2550c99..ccff352443e5 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -109,6 +109,7 @@ #include "shared-bindings/rtc/__init__.h" #include "shared_timers.h" #include "reset.h" +#include "common-hal/pulseio/PulseIn.h" #include "supervisor/background_callback.h" #include "supervisor/shared/safe_mode.h" diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 9a928b40f4c7..7a034c9d2a3b 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -150,7 +150,7 @@ endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) -CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) +CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes ifeq ($(IDF_TARGET_ARCH),xtensa) CFLAGS += -mlongcalls diff --git a/ports/espressif/background.c b/ports/espressif/background.c index 80b60bebe350..37fe3d5be0f8 100644 --- a/ports/espressif/background.c +++ b/ports/espressif/background.c @@ -26,6 +26,7 @@ #include "py/runtime.h" #include "supervisor/filesystem.h" +#include "supervisor/port.h" #include "supervisor/shared/stack.h" #include "freertos/FreeRTOS.h" diff --git a/ports/espressif/bindings/espidf/__init__.c b/ports/espressif/bindings/espidf/__init__.c index 9076294d5304..4f7da39540bb 100644 --- a/ports/espressif/bindings/espidf/__init__.c +++ b/ports/espressif/bindings/espidf/__init__.c @@ -82,15 +82,7 @@ STATIC mp_obj_t espidf_erase_nvs(void) { MP_DEFINE_CONST_FUN_OBJ_0(espidf_erase_nvs_obj, espidf_erase_nvs); -//| class IDFError(OSError): -//| """Raised for certain generic ESP IDF errors.""" -//| ... -//| -NORETURN void mp_raise_espidf_IDFError(void) { - nlr_raise(mp_obj_new_exception(&mp_type_espidf_IDFError)); -} - -void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) { +STATIC void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) { mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS; bool is_subclass = kind & PRINT_EXC_SUBCLASS; if (!is_subclass && (k == PRINT_EXC)) { diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c index 3d392892e30f..820228ef98f8 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c @@ -26,6 +26,7 @@ */ #include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/board.h" void board_init(void) { @@ -51,6 +52,3 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } - -void board_deinit(void) { -} diff --git a/ports/espressif/boards/microdev_micro_c3/board.c b/ports/espressif/boards/microdev_micro_c3/board.c index 183740a7c3ae..7ffd406cfee0 100644 --- a/ports/espressif/boards/microdev_micro_c3/board.c +++ b/ports/espressif/boards/microdev_micro_c3/board.c @@ -25,6 +25,7 @@ */ #include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/board.h" void board_init(void) { // USB @@ -54,5 +55,7 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } +#if CIRCUITPY_ALARM void board_deinit(void) { } +#endif diff --git a/ports/espressif/cam.c b/ports/espressif/cam.c index e435993c6dd8..146df43a41b7 100644 --- a/ports/espressif/cam.c +++ b/ports/espressif/cam.c @@ -69,7 +69,7 @@ typedef struct { static cam_obj_t *cam_obj = NULL; -void IRAM_ATTR cam_isr(void *arg) { +static void IRAM_ATTR cam_isr(void *arg) { cam_event_t cam_event = {0}; BaseType_t HPTaskAwoken = pdFALSE; typeof(I2S0.int_st) int_st = I2S0.int_st; @@ -85,7 +85,7 @@ void IRAM_ATTR cam_isr(void *arg) { } } -void IRAM_ATTR cam_vsync_isr(void *arg) { +static void IRAM_ATTR cam_vsync_isr(void *arg) { cam_event_t cam_event = {0}; BaseType_t HPTaskAwoken = pdFALSE; /*!< filter */ @@ -392,7 +392,7 @@ void cam_give(uint8_t *buffer) { } } -void cam_dma_config(const cam_config_t *config) { +static void cam_dma_config(const cam_config_t *config) { int cnt = 0; if (config->mode.jpeg) { diff --git a/ports/espressif/common-hal/alarm/SleepMemory.c b/ports/espressif/common-hal/alarm/SleepMemory.c index b25bf28d2511..764125ddb200 100644 --- a/ports/espressif/common-hal/alarm/SleepMemory.c +++ b/ports/espressif/common-hal/alarm/SleepMemory.c @@ -29,6 +29,7 @@ #include "py/runtime.h" #include "common-hal/alarm/SleepMemory.h" +#include "shared-bindings/alarm/SleepMemory.h" #include "esp_log.h" #include "esp_sleep.h" diff --git a/ports/espressif/common-hal/alarm/pin/PinAlarm.c b/ports/espressif/common-hal/alarm/pin/PinAlarm.c index 970094783e7f..754902f67821 100644 --- a/ports/espressif/common-hal/alarm/pin/PinAlarm.c +++ b/ports/espressif/common-hal/alarm/pin/PinAlarm.c @@ -72,7 +72,7 @@ gpio_isr_handle_t gpio_interrupt_handle; // Low and high are relative to pin number. 32+ is high. <32 is low. static volatile uint32_t pin_31_0_status = 0; static volatile uint32_t pin_63_32_status = 0; -void gpio_interrupt(void *arg) { +STATIC void gpio_interrupt(void *arg) { (void)arg; gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t *)&pin_31_0_status); diff --git a/ports/espressif/common-hal/alarm/time/TimeAlarm.c b/ports/espressif/common-hal/alarm/time/TimeAlarm.c index 0fb29a3ed47d..256d96a75fb8 100644 --- a/ports/espressif/common-hal/alarm/time/TimeAlarm.c +++ b/ports/espressif/common-hal/alarm/time/TimeAlarm.c @@ -63,7 +63,7 @@ esp_timer_handle_t pretend_sleep_timer; STATIC bool woke_up = false; // This is run in the timer task. We use it to wake the main CircuitPython task. -void timer_callback(void *arg) { +STATIC void timer_callback(void *arg) { (void)arg; woke_up = true; xTaskNotifyGive(circuitpython_task); diff --git a/ports/espressif/common-hal/alarm/touch/TouchAlarm.c b/ports/espressif/common-hal/alarm/touch/TouchAlarm.c index e005999ee545..6ae2421e4cd2 100644 --- a/ports/espressif/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/espressif/common-hal/alarm/touch/TouchAlarm.c @@ -75,7 +75,7 @@ mp_obj_t alarm_touch_touchalarm_create_wakeup_alarm(void) { } // This is used to wake the main CircuitPython task. -void touch_interrupt(void *arg) { +STATIC void touch_interrupt(void *arg) { (void)arg; woke_up = true; BaseType_t task_wakeup; diff --git a/ports/espressif/common-hal/analogio/AnalogIn.c b/ports/espressif/common-hal/analogio/AnalogIn.c index add4c3e14eb1..df39b30c6359 100644 --- a/ports/espressif/common-hal/analogio/AnalogIn.c +++ b/ports/espressif/common-hal/analogio/AnalogIn.c @@ -25,6 +25,7 @@ */ #include "common-hal/analogio/AnalogIn.h" +#include "shared-bindings/analogio/AnalogIn.h" #include "py/mperrno.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" diff --git a/ports/espressif/common-hal/canio/CAN.c b/ports/espressif/common-hal/canio/CAN.c index 720034755b11..eebf064f448e 100644 --- a/ports/espressif/common-hal/canio/CAN.c +++ b/ports/espressif/common-hal/canio/CAN.c @@ -38,7 +38,7 @@ STATIC bool reserved_can; -twai_timing_config_t get_t_config(int baudrate) { +STATIC twai_timing_config_t get_t_config(int baudrate) { switch (baudrate) { case 1000000: { // TWAI_TIMING_CONFIG_abc expands to a C designated initializer list @@ -204,7 +204,7 @@ static void can_restart(void) { } while (port_get_raw_ticks(NULL) < deadline && (info.state == TWAI_STATE_BUS_OFF || info.state == TWAI_STATE_RECOVERING)); } -void canio_maybe_auto_restart(canio_can_obj_t *self) { +STATIC void canio_maybe_auto_restart(canio_can_obj_t *self) { if (self->auto_restart) { can_restart(); } diff --git a/ports/espressif/common-hal/canio/Listener.c b/ports/espressif/common-hal/canio/Listener.c index 810026174381..eccddf6243e4 100644 --- a/ports/espressif/common-hal/canio/Listener.c +++ b/ports/espressif/common-hal/canio/Listener.c @@ -78,7 +78,7 @@ STATIC void install_all_match_filter(canio_listener_obj_t *self) { } __attribute__((noinline,optimize("O0"))) -void set_filters(canio_listener_obj_t *self, size_t nmatch, canio_match_obj_t **matches) { +STATIC void set_filters(canio_listener_obj_t *self, size_t nmatch, canio_match_obj_t **matches) { twai_ll_enter_reset_mode(&TWAI); if (!nmatch) { diff --git a/ports/espressif/common-hal/countio/Counter.c b/ports/espressif/common-hal/countio/Counter.c index bdc8b290fec0..418a8ae4d4fa 100644 --- a/ports/espressif/common-hal/countio/Counter.c +++ b/ports/espressif/common-hal/countio/Counter.c @@ -25,6 +25,7 @@ */ #include "common-hal/countio/Counter.h" +#include "shared-bindings/countio/Counter.h" #include "common-hal/microcontroller/Pin.h" #include "py/runtime.h" diff --git a/ports/espressif/common-hal/microcontroller/Processor.c b/ports/espressif/common-hal/microcontroller/Processor.c index 5f956b4412f6..c50c6fbf7a25 100644 --- a/ports/espressif/common-hal/microcontroller/Processor.c +++ b/ports/espressif/common-hal/microcontroller/Processor.c @@ -31,6 +31,7 @@ #include "py/runtime.h" #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" #include "supervisor/shared/translate.h" diff --git a/ports/espressif/common-hal/nvm/ByteArray.c b/ports/espressif/common-hal/nvm/ByteArray.c index 6eeed72e2eaf..a17e36824978 100644 --- a/ports/espressif/common-hal/nvm/ByteArray.c +++ b/ports/espressif/common-hal/nvm/ByteArray.c @@ -27,13 +27,14 @@ #include #include "common-hal/nvm/ByteArray.h" +#include "shared-bindings/nvm/ByteArray.h" #include "bindings/espidf/__init__.h" #include "py/runtime.h" #include "py/gc.h" #include "nvs_flash.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; } @@ -75,7 +76,7 @@ static esp_err_t get_bytes(nvs_handle_t handle, uint8_t **buf_out) { return result; } -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) { // start nvs @@ -122,7 +123,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) { // start nvs diff --git a/ports/espressif/common-hal/os/__init__.c b/ports/espressif/common-hal/os/__init__.c index b77898016f4b..1dcd3e46e017 100644 --- a/ports/espressif/common-hal/os/__init__.c +++ b/ports/espressif/common-hal/os/__init__.c @@ -30,6 +30,8 @@ #include "py/objtuple.h" #include "py/qstr.h" +#include "shared-bindings/os/__init__.h" + #include "esp_system.h" STATIC const qstr os_uname_info_fields[] = { diff --git a/ports/espressif/common-hal/ps2io/Ps2.c b/ports/espressif/common-hal/ps2io/Ps2.c index f4845b0fa865..2b6dc529674c 100644 --- a/ports/espressif/common-hal/ps2io/Ps2.c +++ b/ports/espressif/common-hal/ps2io/Ps2.c @@ -25,6 +25,7 @@ */ #include "common-hal/ps2io/Ps2.h" +#include "shared-bindings/ps2io/Ps2.h" #include "supervisor/port.h" #include "shared-bindings/microcontroller/__init__.h" diff --git a/ports/espressif/common-hal/pulseio/PulseIn.c b/ports/espressif/common-hal/pulseio/PulseIn.c index 4b314e2f8dbc..3f5457f84bcd 100644 --- a/ports/espressif/common-hal/pulseio/PulseIn.c +++ b/ports/espressif/common-hal/pulseio/PulseIn.c @@ -25,6 +25,7 @@ */ #include "common-hal/pulseio/PulseIn.h" +#include "shared-bindings/pulseio/PulseIn.h" #include "shared-bindings/microcontroller/__init__.h" #include "py/runtime.h" diff --git a/ports/espressif/common-hal/pulseio/PulseOut.c b/ports/espressif/common-hal/pulseio/PulseOut.c index 1cb02089e76e..993fd9452cc2 100644 --- a/ports/espressif/common-hal/pulseio/PulseOut.c +++ b/ports/espressif/common-hal/pulseio/PulseOut.c @@ -25,6 +25,7 @@ */ #include "common-hal/pulseio/PulseOut.h" +#include "shared-bindings/pulseio/PulseOut.h" #include "shared-bindings/pwmio/PWMOut.h" #include "py/runtime.h" diff --git a/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c b/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c index b36c79b4f638..676e99289dcb 100644 --- a/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c @@ -25,6 +25,7 @@ */ #include "common-hal/rotaryio/IncrementalEncoder.h" +#include "shared-bindings/rotaryio/IncrementalEncoder.h" #include "common-hal/microcontroller/Pin.h" #include "py/runtime.h" diff --git a/ports/espressif/common-hal/ssl/__init__.c b/ports/espressif/common-hal/ssl/__init__.c index a0886adda719..61ea32f395a0 100644 --- a/ports/espressif/common-hal/ssl/__init__.c +++ b/ports/espressif/common-hal/ssl/__init__.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "shared-bindings/ssl/__init__.h" #include "shared-bindings/ssl/SSLContext.h" #include "components/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h" diff --git a/ports/espressif/common-hal/watchdog/WatchDogTimer.c b/ports/espressif/common-hal/watchdog/WatchDogTimer.c index 729ab5815a38..159c99458f5f 100644 --- a/ports/espressif/common-hal/watchdog/WatchDogTimer.c +++ b/ports/espressif/common-hal/watchdog/WatchDogTimer.c @@ -32,6 +32,7 @@ #include "esp_task_wdt.h" +extern void esp_task_wdt_isr_user_handler(void); void esp_task_wdt_isr_user_handler(void) { mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&mp_watchdog_timeout_exception)); MP_STATE_THREAD(mp_pending_exception) = &mp_watchdog_timeout_exception; diff --git a/ports/espressif/common-hal/wifi/__init__.c b/ports/espressif/common-hal/wifi/__init__.c index 8d19a91cb224..a39103ce0ab9 100644 --- a/ports/espressif/common-hal/wifi/__init__.c +++ b/ports/espressif/common-hal/wifi/__init__.c @@ -25,6 +25,7 @@ */ #include "common-hal/wifi/__init__.h" +#include "shared-bindings/wifi/__init__.h" #include "shared-bindings/ipaddress/IPv4Address.h" #include "shared-bindings/wifi/Radio.h" diff --git a/ports/espressif/modules/none.c b/ports/espressif/modules/none.c index 9b5433bd9d78..aa751bf3f402 100644 --- a/ports/espressif/modules/none.c +++ b/ports/espressif/modules/none.c @@ -24,5 +24,7 @@ * THE SOFTWARE. */ +#include "modules/module.h" + void never_reset_module_internal_pins(void) { } diff --git a/ports/espressif/mphalport.c b/ports/espressif/mphalport.c index 632e18039a6d..f22856f0a475 100644 --- a/ports/espressif/mphalport.c +++ b/ports/espressif/mphalport.c @@ -39,6 +39,8 @@ #include "components/esp_rom/include/esp32s2/rom/ets_sys.h" #endif +#include "supervisor/cpu.h" + void mp_hal_delay_us(mp_uint_t delay) { ets_delay_us(delay); } @@ -48,7 +50,7 @@ void mp_hal_delay_us(mp_uint_t delay) { extern void xthal_window_spill(void); #endif -mp_uint_t cpu_get_regs_and_sp(mp_uint_t *regs, uint8_t reg_count) { +mp_uint_t cpu_get_regs_and_sp(mp_uint_t *regs) { // xtensa has more registers than an instruction can address. The 16 that // can be addressed are called the "window". When a function is called or // returns the window rotates. This allows for more efficient function calls diff --git a/ports/espressif/supervisor/internal_flash.c b/ports/espressif/supervisor/internal_flash.c index 8f3d9177655b..2f17b48f0c0d 100644 --- a/ports/espressif/supervisor/internal_flash.c +++ b/ports/espressif/supervisor/internal_flash.c @@ -39,6 +39,7 @@ #include "components/spi_flash/include/esp_partition.h" +#include "supervisor/flash.h" #include "supervisor/usb.h" STATIC const esp_partition_t *_partition; diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 7425bb615eb2..30106075e719 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -93,7 +93,7 @@ TaskHandle_t circuitpython_task = NULL; extern void esp_restart(void) NORETURN; -void tick_timer_cb(void *arg) { +STATIC void tick_timer_cb(void *arg) { supervisor_tick(); // CircuitPython's VM is run in a separate FreeRTOS task from timer callbacks. So, we have to @@ -360,6 +360,7 @@ void port_idle_until_interrupt(void) { // Wrap main in app_main that the IDF expects. extern void main(void); +extern void app_main(void); void app_main(void) { main(); } diff --git a/ports/espressif/supervisor/usb.c b/ports/espressif/supervisor/usb.c index fa9d09fa441a..2137a7b0a4fc 100644 --- a/ports/espressif/supervisor/usb.c +++ b/ports/espressif/supervisor/usb.c @@ -62,7 +62,7 @@ StaticTask_t usb_device_taskdef; // USB Device Driver task // This top level thread process all usb events and invoke callbacks -void usb_device_task(void *param) { +STATIC void usb_device_task(void *param) { (void)param; // RTOS forever loop diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index acd150929732..04a648a4e2c4 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -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)) \ diff --git a/ports/nrf/background.c b/ports/nrf/background.c index f4d6b0f79fea..f0822de52103 100644 --- a/ports/nrf/background.c +++ b/ports/nrf/background.c @@ -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" diff --git a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c index d45bd89f3d22..df389df0f81c 100644 --- a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c @@ -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) { diff --git a/ports/nrf/common-hal/_bleio/UUID.c b/ports/nrf/common-hal/_bleio/UUID.c index a55d874f22ac..2d94b4c0ce48 100644 --- a/ports/nrf/common-hal/_bleio/UUID.c +++ b/ports/nrf/common-hal/_bleio/UUID.c @@ -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" diff --git a/ports/nrf/common-hal/_bleio/bonding.h b/ports/nrf/common-hal/_bleio/bonding.h index 228082ec30b0..0884fe8c1343 100644 --- a/ports/nrf/common-hal/_bleio/bonding.h +++ b/ports/nrf/common-hal/_bleio/bonding.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 diff --git a/ports/nrf/common-hal/alarm/SleepMemory.c b/ports/nrf/common-hal/alarm/SleepMemory.c index 40ce1f1a75c6..c63cbb7af5ea 100644 --- a/ports/nrf/common-hal/alarm/SleepMemory.c +++ b/ports/nrf/common-hal/alarm/SleepMemory.c @@ -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]; diff --git a/ports/nrf/common-hal/alarm/__init__.c b/ports/nrf/common-hal/alarm/__init__.c index 5006d726f07b..92dac1c7895f 100644 --- a/ports/nrf/common-hal/alarm/__init__.c +++ b/ports/nrf/common-hal/alarm/__init__.c @@ -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; diff --git a/ports/nrf/common-hal/analogio/AnalogIn.c b/ports/nrf/common-hal/analogio/AnalogIn.c index 2f7bede165b9..c64e51ec094c 100644 --- a/ports/nrf/common-hal/analogio/AnalogIn.c +++ b/ports/nrf/common-hal/analogio/AnalogIn.c @@ -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" diff --git a/ports/nrf/common-hal/audiobusio/I2SOut.c b/ports/nrf/common-hal/audiobusio/I2SOut.c index 8626ce714d45..6e68583a035d 100644 --- a/ports/nrf/common-hal/audiobusio/I2SOut.c +++ b/ports/nrf/common-hal/audiobusio/I2SOut.c @@ -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 diff --git a/ports/nrf/common-hal/audiobusio/PDMIn.c b/ports/nrf/common-hal/audiobusio/PDMIn.c index c34a4ebba91e..9c9afbcb506a 100644 --- a/ports/nrf/common-hal/audiobusio/PDMIn.c +++ b/ports/nrf/common-hal/audiobusio/PDMIn.c @@ -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" diff --git a/ports/nrf/common-hal/countio/Counter.c b/ports/nrf/common-hal/countio/Counter.c index 452c9d9c8322..b2296a7dcce6 100644 --- a/ports/nrf/common-hal/countio/Counter.c +++ b/ports/nrf/common-hal/countio/Counter.c @@ -1,5 +1,6 @@ #include "common-hal/countio/Counter.h" +#include "shared-bindings/countio/Counter.h" #include "py/runtime.h" diff --git a/ports/nrf/common-hal/microcontroller/Processor.c b/ports/nrf/common-hal/microcontroller/Processor.c index f01b22fb4708..fa2dfad6a49c 100644 --- a/ports/nrf/common-hal/microcontroller/Processor.c +++ b/ports/nrf/common-hal/microcontroller/Processor.c @@ -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" diff --git a/ports/nrf/common-hal/neopixel_write/__init__.c b/ports/nrf/common-hal/neopixel_write/__init__.c index c8aa44cd12c9..6f012fa35b2f 100644 --- a/ports/nrf/common-hal/neopixel_write/__init__.c +++ b/ports/nrf/common-hal/neopixel_write/__init__.c @@ -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" diff --git a/ports/nrf/common-hal/nvm/ByteArray.c b/ports/nrf/common-hal/nvm/ByteArray.c index 5af2cc563631..539f66a5b170 100644 --- a/ports/nrf/common-hal/nvm/ByteArray.c +++ b/ports/nrf/common-hal/nvm/ByteArray.c @@ -26,13 +26,14 @@ #include "py/runtime.h" #include "common-hal/nvm/ByteArray.h" +#include "shared-bindings/nvm/ByteArray.h" #include #include #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); } diff --git a/ports/nrf/common-hal/os/__init__.c b/ports/nrf/common-hal/os/__init__.c index 5a0f10596cea..caddcdc2e24f 100644 --- a/ports/nrf/common-hal/os/__init__.c +++ b/ports/nrf/common-hal/os/__init__.c @@ -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); diff --git a/ports/nrf/common-hal/pwmio/PWMOut.c b/ports/nrf/common-hal/pwmio/PWMOut.c index 6dd4a153b8e4..76c8c4e6d419 100644 --- a/ports/nrf/common-hal/pwmio/PWMOut.c +++ b/ports/nrf/common-hal/pwmio/PWMOut.c @@ -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; diff --git a/ports/nrf/common-hal/rotaryio/IncrementalEncoder.c b/ports/nrf/common-hal/rotaryio/IncrementalEncoder.c index 425da9e6de3e..51e83b56af0e 100644 --- a/ports/nrf/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/nrf/common-hal/rotaryio/IncrementalEncoder.c @@ -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" diff --git a/ports/nrf/common-hal/rtc/RTC.c b/ports/nrf/common-hal/rtc/RTC.c index 074079cd6b53..0b7115a14f75 100644 --- a/ports/nrf/common-hal/rtc/RTC.c +++ b/ports/nrf/common-hal/rtc/RTC.c @@ -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" diff --git a/ports/nrf/device/nrf52/startup_nrf52833.c b/ports/nrf/device/nrf52/startup_nrf52833.c index ad608395208a..67abf71ce4ed 100644 --- a/ports/nrf/device/nrf52/startup_nrf52833.c +++ b/ports/nrf/device/nrf52/startup_nrf52833.c @@ -39,6 +39,8 @@ typedef void (*func)(void); extern void _start(void) __attribute__((noreturn)); extern void SystemInit(void); +extern void Default_Handler(void); +extern void Reset_Handler(void); void Default_Handler(void) { while (1) { diff --git a/ports/nrf/device/nrf52/startup_nrf52840.c b/ports/nrf/device/nrf52/startup_nrf52840.c index 67380303d65d..b6ef3c54ab4f 100644 --- a/ports/nrf/device/nrf52/startup_nrf52840.c +++ b/ports/nrf/device/nrf52/startup_nrf52840.c @@ -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; diff --git a/ports/nrf/fatfs_port.c b/ports/nrf/fatfs_port.c index 5882864bbebf..38c2d923b80b 100644 --- a/ports/nrf/fatfs_port.c +++ b/ports/nrf/fatfs_port.c @@ -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) { diff --git a/ports/nrf/peripherals/nrf/cache.c b/ports/nrf/peripherals/nrf/cache.c index 02e11c4613a4..6eb590d770cd 100644 --- a/ports/nrf/peripherals/nrf/cache.c +++ b/ports/nrf/peripherals/nrf/cache.c @@ -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) { diff --git a/ports/nrf/peripherals/nrf/nrf52840/power.c b/ports/nrf/peripherals/nrf/nrf52840/power.c index 192a49acca35..e1573bd60234 100644 --- a/ports/nrf/peripherals/nrf/nrf52840/power.c +++ b/ports/nrf/peripherals/nrf/nrf52840/power.c @@ -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 diff --git a/ports/nrf/sd_mutex.c b/ports/nrf/sd_mutex.c index 2ae490288dac..f94feb951b04 100644 --- a/ports/nrf/sd_mutex.c +++ b/ports/nrf/sd_mutex.c @@ -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); diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 17e9817b5c65..a1eb973b8363 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -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) { diff --git a/ports/nrf/supervisor/qspi_flash.c b/ports/nrf/supervisor/qspi_flash.c index 632fe4d21270..df80671e6469 100644 --- a/ports/nrf/supervisor/qspi_flash.c +++ b/ports/nrf/supervisor/qspi_flash.c @@ -26,6 +26,7 @@ */ #include "supervisor/spi_flash_api.h" +#include "supervisor/qspi_flash.h" #include #include @@ -69,7 +70,7 @@ void qspi_disable(void) { } } -void qspi_enable(void) { +STATIC void qspi_enable(void) { if (NRF_QSPI->ENABLE) { return; } diff --git a/ports/nrf/supervisor/qspi_flash.h b/ports/nrf/supervisor/qspi_flash.h index 527f3cec397a..185a155be060 100644 --- a/ports/nrf/supervisor/qspi_flash.h +++ b/ports/nrf/supervisor/qspi_flash.h @@ -1,2 +1,3 @@ extern void qspi_flash_enter_sleep(void); extern void qspi_flash_exit_sleep(void); +extern void qspi_disable(void); diff --git a/ports/nrf/supervisor/usb.c b/ports/nrf/supervisor/usb.c index 6031cced5024..8651b008f0a5 100644 --- a/ports/nrf/supervisor/usb.c +++ b/ports/nrf/supervisor/usb.c @@ -91,6 +91,7 @@ void init_usb_hardware(void) { } } +extern void USBD_IRQHandler(void); void USBD_IRQHandler(void) { usb_irq_handler(); } diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 2739bf654795..b63b26d58d61 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -132,7 +132,7 @@ endif # Remove -Wno-stringop-overflow after we can test with CI's GCC 10. Mac's looks weird. DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-unused-function -Wno-unused-variable -Wno-strict-overflow -Wno-cast-align -Wno-strict-prototypes -Wno-nested-externs -Wno-double-promotion -Wno-sign-compare -CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) +CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes CFLAGS += \ -march=armv6-m \ @@ -187,6 +187,7 @@ SRC_SDK := \ src/rp2_common/pico_unique_id/unique_id.c \ SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) +$(patsubst %.c,$(BUILD)/%.o,$(SRC_SDK)): CFLAGS += -Wno-missing-prototypes SRC_C += \ boards/$(BOARD)/board.c \ diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index 39b975ff8d7f..61e526b226da 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -617,7 +617,7 @@ const mp_obj_type_t rp2pio_statemachine_type = { .locals_dict = (mp_obj_dict_t *)&rp2pio_statemachine_locals_dict, }; -rp2pio_statemachine_obj_t *validate_obj_is_statemachine(mp_obj_t obj) { +static rp2pio_statemachine_obj_t *validate_obj_is_statemachine(mp_obj_t obj) { if (!mp_obj_is_type(obj, &rp2pio_statemachine_type)) { mp_raise_TypeError_varg(translate("Expected a %q"), rp2pio_statemachine_type.name); } diff --git a/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c b/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c index 1e16629f303a..2d452244f734 100644 --- a/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c @@ -31,6 +31,7 @@ #include "shared-bindings/busio/SPI.h" #include "shared-bindings/microcontroller/Pin.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" +#include "supervisor/board.h" #include "supervisor/shared/board.h" displayio_fourwire_obj_t board_display_obj; diff --git a/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c b/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c index 57866b00ab4b..831bf96cdfc6 100644 --- a/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c @@ -28,6 +28,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" +#include "supervisor/board.h" void board_init(void) { } diff --git a/ports/raspberrypi/common-hal/alarm/SleepMemory.c b/ports/raspberrypi/common-hal/alarm/SleepMemory.c index b8fcdfbccf91..c1765296dcd3 100644 --- a/ports/raspberrypi/common-hal/alarm/SleepMemory.c +++ b/ports/raspberrypi/common-hal/alarm/SleepMemory.c @@ -28,6 +28,7 @@ #include "py/runtime.h" #include "common-hal/alarm/SleepMemory.h" +#include "shared-bindings/alarm/SleepMemory.h" void alarm_sleep_memory_reset(void) { } diff --git a/ports/raspberrypi/common-hal/alarm/pin/PinAlarm.c b/ports/raspberrypi/common-hal/alarm/pin/PinAlarm.c index 276e2e409a94..53cbfca57b18 100644 --- a/ports/raspberrypi/common-hal/alarm/pin/PinAlarm.c +++ b/ports/raspberrypi/common-hal/alarm/pin/PinAlarm.c @@ -42,7 +42,7 @@ STATIC bool _pinalarm_set = false; #define GPIO_IRQ_ALL_EVENTS 0x15u -void gpio_callback(uint gpio, uint32_t events) { +STATIC void gpio_callback(uint gpio, uint32_t events) { alarm_triggered_pins |= (1 << gpio); woke_up = true; diff --git a/ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c b/ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c index 65c2b680d880..16ac8fc31e0b 100644 --- a/ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c +++ b/ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c @@ -37,7 +37,7 @@ STATIC bool woke_up = false; STATIC bool _timealarm_set = false; -void timer_callback(void) { +STATIC void timer_callback(void) { woke_up = true; } diff --git a/ports/raspberrypi/common-hal/analogio/AnalogIn.c b/ports/raspberrypi/common-hal/analogio/AnalogIn.c index 7db2956b03c3..1d7763006397 100644 --- a/ports/raspberrypi/common-hal/analogio/AnalogIn.c +++ b/ports/raspberrypi/common-hal/analogio/AnalogIn.c @@ -25,6 +25,7 @@ */ #include "common-hal/analogio/AnalogIn.h" +#include "shared-bindings/analogio/AnalogIn.h" #include "py/runtime.h" #include "supervisor/shared/translate.h" diff --git a/ports/raspberrypi/common-hal/audiobusio/PDMIn.c b/ports/raspberrypi/common-hal/audiobusio/PDMIn.c index 323a3dfbc8ed..f2775c254359 100644 --- a/ports/raspberrypi/common-hal/audiobusio/PDMIn.c +++ b/ports/raspberrypi/common-hal/audiobusio/PDMIn.c @@ -171,7 +171,3 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t *se return output_count; } - -void common_hal_audiobusio_pdmin_record_to_file(audiobusio_pdmin_obj_t *self, uint8_t *buffer, uint32_t length) { - -} diff --git a/ports/raspberrypi/common-hal/countio/Counter.c b/ports/raspberrypi/common-hal/countio/Counter.c index 3d2d291b9939..bbf71f996ee6 100644 --- a/ports/raspberrypi/common-hal/countio/Counter.c +++ b/ports/raspberrypi/common-hal/countio/Counter.c @@ -95,7 +95,7 @@ void common_hal_countio_counter_reset(countio_counter_obj_t *self) { self->count = 0; } -void counter_interrupt_handler() { +void counter_interrupt_handler(void) { uint32_t mask = pwm_get_irq_status_mask(); uint8_t i = 1, pos = 1; diff --git a/ports/raspberrypi/common-hal/countio/Counter.h b/ports/raspberrypi/common-hal/countio/Counter.h index 78e00e0dd234..7469dd2d0009 100644 --- a/ports/raspberrypi/common-hal/countio/Counter.h +++ b/ports/raspberrypi/common-hal/countio/Counter.h @@ -14,7 +14,7 @@ typedef struct { } countio_counter_obj_t; -void counter_interrupt_handler(); +void counter_interrupt_handler(void); void reset_countio(void); diff --git a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c index 280c87e2348b..9eabc9f9676d 100644 --- a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c +++ b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c @@ -68,7 +68,7 @@ /* .wrap */ \ } -mcu_pin_obj_t *pin_from_number(uint8_t number) { +STATIC mcu_pin_obj_t *pin_from_number(uint8_t number) { const mp_map_t *mcu_map = &mcu_pin_globals.map; for (uint8_t i = 0; i < mcu_map->alloc; i++) { mp_obj_t val = mcu_map->table[i].value; diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.c b/ports/raspberrypi/common-hal/microcontroller/Processor.c index 68518d75b3c9..8c5bc7ba7526 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Processor.c +++ b/ports/raspberrypi/common-hal/microcontroller/Processor.c @@ -29,6 +29,7 @@ #include "py/mphal.h" #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" #include "src/rp2_common/hardware_adc/include/hardware/adc.h" diff --git a/ports/raspberrypi/common-hal/nvm/ByteArray.c b/ports/raspberrypi/common-hal/nvm/ByteArray.c index 94d98d686f37..6908cbeabf14 100644 --- a/ports/raspberrypi/common-hal/nvm/ByteArray.c +++ b/ports/raspberrypi/common-hal/nvm/ByteArray.c @@ -25,6 +25,7 @@ */ #include "common-hal/nvm/ByteArray.h" +#include "shared-bindings/nvm/ByteArray.h" #include @@ -36,7 +37,7 @@ static const uint32_t flash_binary_start = (uint32_t)&__flash_binary_start; #define RMV_OFFSET(addr) addr - flash_binary_start -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; } @@ -63,12 +64,12 @@ static void erase_and_write_sector(uint32_t address, uint32_t len, uint8_t *byte flash_range_program(RMV_OFFSET(CIRCUITPY_INTERNAL_NVM_START_ADDR), buffer, FLASH_SECTOR_SIZE); } -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); } -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) { uint8_t values_in[len]; common_hal_nvm_bytearray_get_bytes(self, start_index, len, values_in); diff --git a/ports/raspberrypi/common-hal/os/__init__.c b/ports/raspberrypi/common-hal/os/__init__.c index 25fe317abeb9..805418288a8c 100644 --- a/ports/raspberrypi/common-hal/os/__init__.c +++ b/ports/raspberrypi/common-hal/os/__init__.c @@ -30,6 +30,8 @@ #include "py/objtuple.h" #include "py/qstr.h" +#include "shared-bindings/os/__init__.h" + #include "lib/crypto-algorithms/sha256.h" #include "hardware/structs/rosc.h" @@ -104,7 +106,7 @@ static void get_random_bits(BYTE out[SHA256_BLOCK_SIZE]) { sha256_final(&context, out); } -bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) { +bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) { #define ROSC_POWER_SAVE (1) // assume ROSC is not necessarily active all the time #if ROSC_POWER_SAVE uint32_t old_rosc_ctrl = rosc_hw->ctrl; diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.c b/ports/raspberrypi/common-hal/pulseio/PulseIn.c index 53dfa008b8a7..9d3f61498742 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.c @@ -121,7 +121,8 @@ void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) { self->level_count = 0; self->buf_index = 0; } -void common_hal_pulseio_pulsein_interrupt(pulseio_pulsein_obj_t *self) { +void common_hal_pulseio_pulsein_interrupt(void *self_in) { + pulseio_pulsein_obj_t *self = self_in; uint32_t rxfifo = 0; diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.h b/ports/raspberrypi/common-hal/pulseio/PulseIn.h index 53862209112e..f2c4fc0d0676 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.h +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.h @@ -48,6 +48,6 @@ typedef struct { } pulseio_pulsein_obj_t; void pulsein_reset(void); -void common_hal_pulseio_pulsein_interrupt(); +void common_hal_pulseio_pulsein_interrupt(void *); #endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PULSEIN_H diff --git a/ports/raspberrypi/common-hal/pulseio/PulseOut.c b/ports/raspberrypi/common-hal/pulseio/PulseOut.c index 2b4ab7185c7c..7704fdff6f2c 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseOut.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseOut.c @@ -41,7 +41,7 @@ volatile alarm_id_t cur_alarm = 0; -void pulse_finish(pulseio_pulseout_obj_t *self) { +static void pulse_finish(pulseio_pulseout_obj_t *self) { self->pulse_index++; // Turn pwm pin off by switching the GPIO mux to SIO (the cpu manual // control). diff --git a/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c b/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c index 649c9421e0a8..1105d357c51e 100644 --- a/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c @@ -28,6 +28,7 @@ #include #include "common-hal/rotaryio/IncrementalEncoder.h" +#include "shared-bindings/rotaryio/IncrementalEncoder.h" #include "shared-module/rotaryio/IncrementalEncoder.h" #include "bindings/rp2pio/__init__.h" #include "bindings/rp2pio/StateMachine.h" diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index 27672f0de070..4479006d4e61 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -70,7 +70,7 @@ static void rp2pio_statemachine_set_pull(uint32_t pull_pin_up, uint32_t pull_pin } } -void _reset_statemachine(PIO pio, uint8_t sm, bool leave_pins) { +STATIC void _reset_statemachine(PIO pio, uint8_t sm, bool leave_pins) { uint8_t pio_index = pio_get_index(pio); uint32_t program_id = _current_program_id[pio_index][sm]; if (program_id == 0) { @@ -587,7 +587,7 @@ bool common_hal_rp2pio_statemachine_deinited(rp2pio_statemachine_obj_t *self) { return self->state_machine == NUM_PIO_STATE_MACHINES; } -enum dma_channel_transfer_size _stride_to_dma_size(uint8_t stride) { +STATIC enum dma_channel_transfer_size _stride_to_dma_size(uint8_t stride) { switch (stride) { case 4: return DMA_SIZE_32; diff --git a/ports/raspberrypi/common-hal/rtc/RTC.c b/ports/raspberrypi/common-hal/rtc/RTC.c index 8647fc246cef..9bd10abf70f4 100644 --- a/ports/raspberrypi/common-hal/rtc/RTC.c +++ b/ports/raspberrypi/common-hal/rtc/RTC.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ #include "shared-bindings/rtc/RTC.h" +#include "common-hal/rtc/RTC.h" #include diff --git a/ports/raspberrypi/stage2.c.jinja b/ports/raspberrypi/stage2.c.jinja index 13de7bff9fdb..4c001525dcc2 100644 --- a/ports/raspberrypi/stage2.c.jinja +++ b/ports/raspberrypi/stage2.c.jinja @@ -46,6 +46,7 @@ static uint8_t read_flash_sreg(uint8_t status_command); // This must be the first defined function so that it is placed at the start of // memory where the bootloader jumps to! +extern void _stage2_boot(void); void __attribute__((section(".entry._stage2_boot"), used)) _stage2_boot(void) { uint32_t lr; asm ("MOV %0, LR\n" : "=r" (lr) ); diff --git a/ports/raspberrypi/supervisor/internal_flash.c b/ports/raspberrypi/supervisor/internal_flash.c index fa18f24fe0fb..c128cb74b2e2 100644 --- a/ports/raspberrypi/supervisor/internal_flash.c +++ b/ports/raspberrypi/supervisor/internal_flash.c @@ -39,6 +39,7 @@ #include "lib/oofatfs/ff.h" #include "shared-bindings/microcontroller/__init__.h" +#include "supervisor/flash.h" #include "supervisor/usb.h" #include "src/rp2040/hardware_structs/include/hardware/structs/sio.h" diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index fca6d6554c41..5041250c0a07 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -248,6 +248,7 @@ void port_idle_until_interrupt(void) { /** * \brief Default interrupt handler for unused IRQs. */ +extern void HardFault_Handler(void); // provide a prototype to avoid a missing-prototypes diagnostic __attribute__((used)) void HardFault_Handler(void) { #ifdef ENABLE_MICRO_TRACE_BUFFER // Turn off the micro trace buffer so we don't fill it up in the infinite diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index c258317d1838..d4980d78fe09 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -635,7 +635,7 @@ ifeq ($(CIRCUITPY_RGBMATRIX),1) SRC_MOD += $(addprefix lib/protomatter/src/, \ core.c \ ) -$(BUILD)/lib/protomatter/src/core.o: CFLAGS += -include "shared-module/rgbmatrix/allocator.h" -DCIRCUITPY -Wno-missing-braces +$(BUILD)/lib/protomatter/src/core.o: CFLAGS += -include "shared-module/rgbmatrix/allocator.h" -DCIRCUITPY -Wno-missing-braces -Wno-missing-prototypes endif # All possible sources are listed here, and are filtered by SRC_PATTERNS. @@ -685,6 +685,7 @@ $(addprefix lib/,\ libm/wf_tgamma.c \ ) endif +$(patsubst %.c,$(BUILD)/%.o,$(SRC_LIBM)): CFLAGS += -Wno-missing-prototypes endif SRC_CIRCUITPY_COMMON = \ diff --git a/shared-bindings/_bleio/CharacteristicBuffer.h b/shared-bindings/_bleio/CharacteristicBuffer.h index 1fd9dd838c0c..de85f019bcbe 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.h +++ b/shared-bindings/_bleio/CharacteristicBuffer.h @@ -44,7 +44,7 @@ uint32_t common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer uint32_t common_hal_bleio_characteristic_buffer_rx_characters_available(bleio_characteristic_buffer_obj_t *self); void common_hal_bleio_characteristic_buffer_clear_rx_buffer(bleio_characteristic_buffer_obj_t *self); bool common_hal_bleio_characteristic_buffer_deinited(bleio_characteristic_buffer_obj_t *self); -int common_hal_bleio_characteristic_buffer_deinit(bleio_characteristic_buffer_obj_t *self); +void common_hal_bleio_characteristic_buffer_deinit(bleio_characteristic_buffer_obj_t *self); bool common_hal_bleio_characteristic_buffer_connected(bleio_characteristic_buffer_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTICBUFFER_H diff --git a/shared-bindings/_bleio/ScanEntry.h b/shared-bindings/_bleio/ScanEntry.h index 35473fd50eca..b3764330274f 100644 --- a/shared-bindings/_bleio/ScanEntry.h +++ b/shared-bindings/_bleio/ScanEntry.h @@ -39,6 +39,6 @@ mp_obj_t common_hal_bleio_scanentry_get_advertisement_bytes(bleio_scanentry_obj_ mp_int_t common_hal_bleio_scanentry_get_rssi(bleio_scanentry_obj_t *self); bool common_hal_bleio_scanentry_get_connectable(bleio_scanentry_obj_t *self); bool common_hal_bleio_scanentry_get_scan_response(bleio_scanentry_obj_t *self); -bool common_hal_bleio_scanentry_matches(bleio_scanentry_obj_t *self, uint8_t *prefixes, size_t prefixes_len, bool match_all); +bool common_hal_bleio_scanentry_matches(bleio_scanentry_obj_t *self, const uint8_t *prefixes, size_t prefixes_len, bool match_all); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANENTRY_H diff --git a/shared-bindings/_eve/__init__.h b/shared-bindings/_eve/__init__.h index 883b1a15bfba..96a10f010bf3 100644 --- a/shared-bindings/_eve/__init__.h +++ b/shared-bindings/_eve/__init__.h @@ -27,6 +27,8 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS__EVE___INIT___H #define MICROPY_INCLUDED_SHARED_BINDINGS__EVE___INIT___H +#include "shared-module/_eve/__init__.h" + void common_hal__eve_flush(common_hal__eve_t *eve); void common_hal__eve_add(common_hal__eve_t *eve, size_t len, void *buf); void common_hal__eve_Vertex2f(common_hal__eve_t *eve, mp_float_t x, mp_float_t y); diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 5d3c1a15f0a2..4160f6a33426 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -70,7 +70,7 @@ // wake_alarm is implemented as a dictionary entry, so there's no code here. -void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { +STATIC void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { for (size_t i = 0; i < n_args; i++) { if (mp_obj_is_type(objs[i], &alarm_pin_pinalarm_type) || mp_obj_is_type(objs[i], &alarm_time_timealarm_type) || diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 2fdd6218bb36..bd7502e891ed 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -29,8 +29,9 @@ #include "py/objproperty.h" #include "py/runtime.h" -#include "shared-bindings/time/__init__.h" #include "shared-bindings/alarm/time/TimeAlarm.h" +#include "shared-bindings/rtc/__init__.h" +#include "shared-bindings/time/__init__.h" #include "supervisor/shared/translate.h" diff --git a/shared-bindings/board/__init__.h b/shared-bindings/board/__init__.h index 837608fa9e08..bc4d7df61f43 100644 --- a/shared-bindings/board/__init__.h +++ b/shared-bindings/board/__init__.h @@ -47,6 +47,10 @@ mp_obj_t common_hal_board_get_uart(void); mp_obj_t common_hal_board_create_uart(void); MP_DECLARE_CONST_FUN_OBJ_0(board_uart_obj); +mp_obj_t board_i2c(void); +mp_obj_t board_spi(void); +mp_obj_t board_uart(void); + #define CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS \ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_board) }, \ { MP_ROM_QSTR(MP_QSTR_board_id), MP_ROM_PTR(&board_module_id_obj) }, diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index a46ab6826e58..90cd7c3aa656 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -152,7 +152,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, si #if CIRCUITPY_BUSIO_UART // Helper to ensure we have the native super class instead of a subclass. -busio_uart_obj_t *native_uart(mp_obj_t uart_obj) { +STATIC busio_uart_obj_t *native_uart(mp_obj_t uart_obj) { mp_obj_t native_uart = mp_obj_cast_to_native_base(uart_obj, &busio_uart_type); if (native_uart == MP_OBJ_NULL) { mp_raise_ValueError_varg(translate("Must be a %q subclass."), MP_QSTR_UART); diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index fc246582fddb..02efd41988ee 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -68,7 +68,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); //| """Change current directory.""" //| ... //| -mp_obj_t os_chdir(mp_obj_t path_in) { +STATIC mp_obj_t os_chdir(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); common_hal_os_chdir(path); return mp_const_none; @@ -79,7 +79,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir); //| """Get the current directory.""" //| ... //| -mp_obj_t os_getcwd(void) { +STATIC mp_obj_t os_getcwd(void) { return common_hal_os_getcwd(); } MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); @@ -88,7 +88,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); //| """With no argument, list the current directory. Otherwise list the given directory.""" //| ... //| -mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) { const char *path; if (n_args == 1) { path = mp_obj_str_get_str(args[0]); @@ -103,7 +103,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir); //| """Create a new directory.""" //| ... //| -mp_obj_t os_mkdir(mp_obj_t path_in) { +STATIC mp_obj_t os_mkdir(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); common_hal_os_mkdir(path); return mp_const_none; @@ -114,7 +114,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir); //| """Remove a file.""" //| ... //| -mp_obj_t os_remove(mp_obj_t path_in) { +STATIC mp_obj_t os_remove(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); common_hal_os_remove(path); return mp_const_none; @@ -125,7 +125,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove); //| """Remove a directory.""" //| ... //| -mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { +STATIC mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { const char *old_path = mp_obj_str_get_str(old_path_in); const char *new_path = mp_obj_str_get_str(new_path_in); common_hal_os_rename(old_path, new_path); @@ -137,7 +137,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename); //| """Rename a file.""" //| ... //| -mp_obj_t os_rmdir(mp_obj_t path_in) { +STATIC mp_obj_t os_rmdir(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); common_hal_os_rmdir(path); return mp_const_none; @@ -153,7 +153,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir); //| which is the number of seconds corresponding to 1999-12-31.""" //| ... //| -mp_obj_t os_stat(mp_obj_t path_in) { +STATIC mp_obj_t os_stat(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); return common_hal_os_stat(path); } @@ -180,7 +180,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); //| in a port-specific implementation.""" //| ... //| -mp_obj_t os_statvfs(mp_obj_t path_in) { +STATIC mp_obj_t os_statvfs(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); return common_hal_os_statvfs(path); } diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 14cf5f5b0dda..757a1b8532f7 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -106,7 +106,7 @@ STATIC mp_obj_t sdcardio_sdcard_make_new(const mp_obj_type_t *type, size_t n_arg //| //| :return: The number of 512-byte blocks, as a number""" //| -mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) { +STATIC mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) { sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t *)self_in; return mp_obj_new_int_from_ull(common_hal_sdcardio_sdcard_get_blockcount(self)); } @@ -117,7 +117,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_count_obj, sdcardio_sdcard_count); //| //| :return: None""" //| -mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) { +STATIC mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) { sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t *)self_in; common_hal_sdcardio_sdcard_deinit(self); return mp_const_none; @@ -135,7 +135,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); //| :return: None""" //| -mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { +STATIC mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE); @@ -154,7 +154,7 @@ MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_readblocks_obj, sdcardio_sdcard_readbl //| //| :return: None""" //| ... -mp_obj_t sdcardio_sdcard_sync(mp_obj_t self_in) { +STATIC mp_obj_t sdcardio_sdcard_sync(mp_obj_t self_in) { sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t *)self_in; int result = common_hal_sdcardio_sdcard_sync(self); if (result < 0) { @@ -176,7 +176,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_sync_obj, sdcardio_sdcard_sync); //| :return: None""" //| -mp_obj_t sdcardio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { +STATIC mp_obj_t sdcardio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index e03d180d7a97..ba45af45769e 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -168,7 +168,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count); //| :param ~_typing.WriteableBuffer buf: The buffer to write into. Length must be multiple of 512. //| //| :return: None""" -mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { +STATIC mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE); @@ -191,7 +191,7 @@ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks //| //| :return: None""" //| -mp_obj_t sdioio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { +STATIC mp_obj_t sdioio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index c5769b56b58e..3c957468da45 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -54,7 +54,7 @@ //| """ //| ... //| -mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_filesystem, ARG_mount_path, ARG_readonly }; static const mp_arg_t allowed_args[] = { { MP_QSTR_filesystem, MP_ARG_OBJ | MP_ARG_REQUIRED }, @@ -91,7 +91,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 0, storage_mount); //| This is the CircuitPython analog to the UNIX ``umount`` command.""" //| ... //| -mp_obj_t storage_umount(mp_obj_t mnt_in) { +STATIC mp_obj_t storage_umount(mp_obj_t mnt_in) { if (mp_obj_is_str(mnt_in)) { common_hal_storage_umount_path(mp_obj_str_get_str(mnt_in)); } else { @@ -113,7 +113,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount); //| filesystem will be corrupted.""" //| ... //| -mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_mount_path, ARG_readonly, ARG_disable_concurrent_write_protection }; static const mp_arg_t allowed_args[] = { { MP_QSTR_mount_path, MP_ARG_OBJ | MP_ARG_REQUIRED }, @@ -136,7 +136,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 0, storage_remount); //| """Retrieves the mount object associated with the mount path""" //| ... //| -mp_obj_t storage_getmount(const mp_obj_t mnt_in) { +STATIC mp_obj_t storage_getmount(const mp_obj_t mnt_in) { return common_hal_storage_getmount(mp_obj_str_get_str(mnt_in)); } MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); @@ -156,7 +156,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); //| ... //| -mp_obj_t storage_erase_filesystem(void) { +STATIC mp_obj_t storage_erase_filesystem(void) { common_hal_storage_erase_filesystem(); return mp_const_none; } diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 971d381ede68..4b090fc34e0c 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -93,7 +93,7 @@ STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) { MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep); #if MICROPY_PY_COLLECTIONS -mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { +STATIC mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); size_t len; mp_obj_t *items; diff --git a/shared-module/_bleio/ScanEntry.c b/shared-module/_bleio/ScanEntry.c index 065d23d4f473..7a57d8aedc3c 100644 --- a/shared-module/_bleio/ScanEntry.c +++ b/shared-module/_bleio/ScanEntry.c @@ -29,6 +29,7 @@ #include #include "shared-bindings/_bleio/Address.h" +#include "shared-bindings/_bleio/ScanEntry.h" #include "shared-module/_bleio/Address.h" #include "shared-module/_bleio/ScanEntry.h" diff --git a/shared-module/_eve/__init__.c b/shared-module/_eve/__init__.c index 0df77b65cbde..a39e6f9ee8ec 100644 --- a/shared-module/_eve/__init__.c +++ b/shared-module/_eve/__init__.c @@ -27,6 +27,7 @@ #include #include #include "py/runtime.h" +#include "shared-bindings/_eve/__init__.h" #include "shared-module/_eve/__init__.h" STATIC void write(common_hal__eve_t *eve, size_t len, void *buf) { diff --git a/shared-module/adafruit_pixelbuf/PixelBuf.c b/shared-module/adafruit_pixelbuf/PixelBuf.c index 378efbfde55a..bfeab4ae04fe 100644 --- a/shared-module/adafruit_pixelbuf/PixelBuf.c +++ b/shared-module/adafruit_pixelbuf/PixelBuf.c @@ -140,7 +140,7 @@ void common_hal_adafruit_pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_f } } -uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) { +STATIC uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) { if (mp_obj_is_small_int(obj)) { return MP_OBJ_SMALL_INT_VALUE(obj); } else if (mp_obj_is_int(obj)) { @@ -152,7 +152,7 @@ uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) { translate("can't convert %q to %q"), mp_obj_get_type_qstr(obj), MP_QSTR_int); } -void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w) { +STATIC void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w) { pixelbuf_byteorder_details_t *byteorder = &self->byteorder; // w is shared between white in NeoPixels and brightness in dotstars (so that DotStars can have // per-pixel brightness). Set the defaults here in case it isn't set below. @@ -197,7 +197,7 @@ void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, uint8_ } } -void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { +STATIC void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { // DotStars don't have white, instead they have 5 bit brightness so pack it into w. Shift right // by three to leave the top five bits. if (self->bytes_per_pixel == 4 && self->byteorder.is_dotstar) { @@ -235,7 +235,7 @@ void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, uint } } -void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t *self, size_t index, mp_obj_t value) { +STATIC void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t *self, size_t index, mp_obj_t value) { uint8_t r; uint8_t g; uint8_t b; diff --git a/shared-module/audiocore/WaveFile.c b/shared-module/audiocore/WaveFile.c index 14c92ca4110a..0cceb979a66c 100644 --- a/shared-module/audiocore/WaveFile.c +++ b/shared-module/audiocore/WaveFile.c @@ -160,14 +160,6 @@ uint8_t common_hal_audioio_wavefile_get_channel_count(audioio_wavefile_obj_t *se return self->channel_count; } -bool audioio_wavefile_samples_signed(audioio_wavefile_obj_t *self) { - return self->bits_per_sample > 8; -} - -uint32_t audioio_wavefile_max_buffer_length(audioio_wavefile_obj_t *self) { - return 512; -} - void audioio_wavefile_reset_buffer(audioio_wavefile_obj_t *self, bool single_channel_output, uint8_t channel) { diff --git a/shared-module/audiomixer/MixerVoice.c b/shared-module/audiomixer/MixerVoice.c index 34fa907a5b52..bb58b0c11117 100644 --- a/shared-module/audiomixer/MixerVoice.c +++ b/shared-module/audiomixer/MixerVoice.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ #include "shared-bindings/audiomixer/Mixer.h" +#include "shared-bindings/audiomixer/MixerVoice.h" #include "shared-module/audiomixer/MixerVoice.h" #include diff --git a/shared-module/audiomp3/MP3Decoder.c b/shared-module/audiomp3/MP3Decoder.c index cc755d7d2fe5..5e1bce5924fe 100644 --- a/shared-module/audiomp3/MP3Decoder.c +++ b/shared-module/audiomp3/MP3Decoder.c @@ -290,10 +290,6 @@ uint8_t common_hal_audiomp3_mp3file_get_channel_count(audiomp3_mp3file_obj_t *se return self->channel_count; } -bool audiomp3_mp3file_samples_signed(audiomp3_mp3file_obj_t *self) { - return true; -} - void audiomp3_mp3file_reset_buffer(audiomp3_mp3file_obj_t *self, bool single_channel_output, uint8_t channel) { diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index a9cb3ae97812..0c577f019480 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -219,17 +219,6 @@ void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16 } } -int16_t constrain(int16_t input, int16_t min, int16_t max) { - // constrain the input between the min and max values - if (input < min) { - return min; - } - if (input > max) { - return max; - } - return input; -} - void common_hal_bitmaptools_fill_region(displayio_bitmap_t *destination, int16_t x1, int16_t y1, int16_t x2, int16_t y2, diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 05900040d803..19d9e7ece0d8 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -24,7 +24,9 @@ * THE SOFTWARE. */ +#include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/board/__init__.h" #include "supervisor/shared/translate.h" #include "mpconfigboard.h" #include "py/runtime.h" diff --git a/shared-module/canio/Match.c b/shared-module/canio/Match.c index b4e8616e9b71..ae8fd40893d1 100644 --- a/shared-module/canio/Match.c +++ b/shared-module/canio/Match.c @@ -25,6 +25,7 @@ */ #include "shared-module/canio/Match.h" +#include "shared-bindings/canio/Match.h" void common_hal_canio_match_construct(canio_match_obj_t *self, int id, int mask, bool extended) { self->id = id; diff --git a/shared-module/canio/Message.c b/shared-module/canio/Message.c index 08e4d9fda7da..7c0dcf739a3f 100644 --- a/shared-module/canio/Message.c +++ b/shared-module/canio/Message.c @@ -25,6 +25,7 @@ */ #include "shared-module/canio/Message.h" +#include "shared-bindings/canio/Message.h" #include diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 675691ed004a..7d8fc0d26d0d 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -103,7 +103,7 @@ bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self return displayio_display_core_show(&self->core, root_group); } -const displayio_area_t *displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) { +STATIC const displayio_area_t *displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) { if (self->core.full_refresh) { self->core.area.next = NULL; return &self->core.area; @@ -172,7 +172,7 @@ void displayio_epaperdisplay_change_refresh_mode_parameters(displayio_epaperdisp self->milliseconds_per_frame = seconds_per_frame * 1000; } -void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t *self) { +STATIC void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t *self) { // run start sequence self->core.bus_reset(self->core.bus); @@ -192,7 +192,7 @@ uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaper return self->milliseconds_per_frame - elapsed_time; } -void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t *self) { +STATIC void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t *self) { // Actually refresh the display now that all pixel RAM has been updated. displayio_display_core_begin_transaction(&self->core); self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, &self->refresh_display_command, 1); @@ -230,7 +230,7 @@ uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay } -bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t *area) { +STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t *area) { uint16_t buffer_size = 128; // In uint32_ts displayio_area_t clipped; diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 430cbc84096f..044674f4153e 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -104,7 +104,7 @@ bool displayio_tilegrid_get_previous_area(displayio_tilegrid_t *self, displayio_ return true; } -void _update_current_x(displayio_tilegrid_t *self) { +STATIC void _update_current_x(displayio_tilegrid_t *self) { uint16_t width; if (self->transpose_xy) { width = self->pixel_height; @@ -137,7 +137,7 @@ void _update_current_x(displayio_tilegrid_t *self) { } } -void _update_current_y(displayio_tilegrid_t *self) { +STATIC void _update_current_y(displayio_tilegrid_t *self) { uint16_t height; if (self->transpose_xy) { height = self->pixel_width; diff --git a/shared-module/gamepadshift/GamePadShift.c b/shared-module/gamepadshift/GamePadShift.c index 6efa0ea5cf09..0fb7d1e8d35a 100644 --- a/shared-module/gamepadshift/GamePadShift.c +++ b/shared-module/gamepadshift/GamePadShift.c @@ -26,6 +26,7 @@ #include "py/mpstate.h" #include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/gamepadshift/GamePadShift.h" #include "shared-module/gamepadshift/GamePadShift.h" #include "supervisor/shared/tick.h" diff --git a/shared-module/keypad/EventQueue.c b/shared-module/keypad/EventQueue.c index ddd1cd0e8748..eeeceb78cfcf 100644 --- a/shared-module/keypad/EventQueue.c +++ b/shared-module/keypad/EventQueue.c @@ -25,6 +25,7 @@ */ #include "shared-bindings/keypad/Event.h" +#include "shared-bindings/keypad/EventQueue.h" #include "shared-bindings/supervisor/__init__.h" #include "shared-module/keypad/EventQueue.h" diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 1e865385d7d8..7a6892c51f50 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -38,6 +38,8 @@ #include "supervisor/shared/translate.h" #include "shared-bindings/msgpack/ExtType.h" +#include "shared-bindings/msgpack/__init__.h" +#include "shared-module/msgpack/__init__.h" //////////////////////////////////////////////////////////////// // stream management diff --git a/shared-module/random/__init__.c b/shared-module/random/__init__.c index 95ac3bc65993..438eb24696e5 100644 --- a/shared-module/random/__init__.c +++ b/shared-module/random/__init__.c @@ -30,6 +30,7 @@ #include "py/runtime.h" #include "shared-bindings/os/__init__.h" +#include "shared-bindings/random/__init__.h" #include "shared-bindings/time/__init__.h" // Yasmarang random number generator diff --git a/shared-module/rotaryio/IncrementalEncoder.c b/shared-module/rotaryio/IncrementalEncoder.c index 89dea01cfe00..27b9cdb64d99 100644 --- a/shared-module/rotaryio/IncrementalEncoder.c +++ b/shared-module/rotaryio/IncrementalEncoder.c @@ -25,6 +25,7 @@ */ #if CIRCUITPY_ROTARYIO && CIRCUITPY_ROTARYIO_SOFTENCODER +#include "shared-bindings/rotaryio/IncrementalEncoder.h" #include "shared-module/rotaryio/IncrementalEncoder.h" #include "common-hal/rotaryio/IncrementalEncoder.h" diff --git a/shared-module/sdcardio/SDCard.c b/shared-module/sdcardio/SDCard.c index f5ab97ebe554..9cbbf40819c8 100644 --- a/shared-module/sdcardio/SDCard.c +++ b/shared-module/sdcardio/SDCard.c @@ -28,6 +28,7 @@ #include "shared-bindings/busio/SPI.h" #include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/sdcardio/SDCard.h" #include "shared-bindings/time/__init__.h" #include "shared-bindings/util.h" #include "shared-module/sdcardio/SDCard.h" @@ -325,7 +326,7 @@ void common_hal_sdcardio_sdcard_deinit(sdcardio_sdcard_obj_t *self) { common_hal_digitalio_digitalinout_deinit(&self->cs); } -void common_hal_sdcardio_check_for_deinit(sdcardio_sdcard_obj_t *self) { +STATIC void common_hal_sdcardio_check_for_deinit(sdcardio_sdcard_obj_t *self) { if (!self->bus) { raise_deinited_error(); } @@ -336,7 +337,7 @@ int common_hal_sdcardio_sdcard_get_blockcount(sdcardio_sdcard_obj_t *self) { return self->sectors; } -int readinto(sdcardio_sdcard_obj_t *self, void *buf, size_t size) { +STATIC int readinto(sdcardio_sdcard_obj_t *self, void *buf, size_t size) { uint8_t aux[2] = {0, 0}; while (aux[0] != 0xfe) { common_hal_busio_spi_read(self->bus, aux, 1, 0xff); @@ -349,7 +350,7 @@ int readinto(sdcardio_sdcard_obj_t *self, void *buf, size_t size) { return 0; } -int readblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf) { +STATIC int readblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf) { uint32_t nblocks = buf->len / 512; if (nblocks == 1) { // Use CMD17 to read a single block diff --git a/shared-module/sharpdisplay/SharpMemoryFramebuffer.c b/shared-module/sharpdisplay/SharpMemoryFramebuffer.c index 14f490822295..9012a5ac8943 100644 --- a/shared-module/sharpdisplay/SharpMemoryFramebuffer.c +++ b/shared-module/sharpdisplay/SharpMemoryFramebuffer.c @@ -53,19 +53,19 @@ int common_hal_sharpdisplay_framebuffer_get_height(sharpdisplay_framebuffer_obj_ return self->height; } -int common_hal_sharpdisplay_framebuffer_get_row_stride(sharpdisplay_framebuffer_obj_t *self) { +STATIC int common_hal_sharpdisplay_framebuffer_get_row_stride(sharpdisplay_framebuffer_obj_t *self) { return (self->width + 7) / 8 + 2; } -int common_hal_sharpdisplay_framebuffer_get_first_pixel_offset(sharpdisplay_framebuffer_obj_t *self) { +STATIC int common_hal_sharpdisplay_framebuffer_get_first_pixel_offset(sharpdisplay_framebuffer_obj_t *self) { return 2; } -bool common_hal_sharpdisplay_framebuffer_get_reverse_pixels_in_byte(sharpdisplay_framebuffer_obj_t *self) { +STATIC bool common_hal_sharpdisplay_framebuffer_get_reverse_pixels_in_byte(sharpdisplay_framebuffer_obj_t *self) { return true; } -bool common_hal_sharpdisplay_framebuffer_get_pixels_in_byte_share_row(sharpdisplay_framebuffer_obj_t *self) { +STATIC bool common_hal_sharpdisplay_framebuffer_get_pixels_in_byte_share_row(sharpdisplay_framebuffer_obj_t *self) { return true; } @@ -143,7 +143,7 @@ void common_hal_sharpdisplay_framebuffer_construct(sharpdisplay_framebuffer_obj_ common_hal_sharpdisplay_framebuffer_get_bufinfo(self, NULL); } -void common_hal_sharpdisplay_framebuffer_swapbuffers(sharpdisplay_framebuffer_obj_t *self, uint8_t *dirty_row_bitmask) { +STATIC void common_hal_sharpdisplay_framebuffer_swapbuffers(sharpdisplay_framebuffer_obj_t *self, uint8_t *dirty_row_bitmask) { // claim SPI bus if (!common_hal_busio_spi_try_lock(self->bus)) { return; diff --git a/shared-module/struct/__init__.c b/shared-module/struct/__init__.c index b3b00961747c..a0abd16408db 100644 --- a/shared-module/struct/__init__.c +++ b/shared-module/struct/__init__.c @@ -32,8 +32,9 @@ #include "py/binary.h" #include "py/parsenum.h" #include "supervisor/shared/translate.h" +#include "shared-bindings/struct/__init__.h" -void struct_validate_format(char fmt) { +STATIC void struct_validate_format(char fmt) { #if MICROPY_NONSTANDARD_TYPECODES if (fmt == 'S' || fmt == 'O') { mp_raise_RuntimeError(translate("'S' and 'O' are not supported format types")); @@ -41,7 +42,7 @@ void struct_validate_format(char fmt) { #endif } -char get_fmt_type(const char **fmt) { +STATIC char get_fmt_type(const char **fmt) { char t = **fmt; switch (t) { case '!': @@ -60,7 +61,7 @@ char get_fmt_type(const char **fmt) { return t; } -mp_uint_t get_fmt_num(const char **p) { +STATIC mp_uint_t get_fmt_num(const char **p) { const char *num = *p; uint len = 1; while (unichar_isdigit(*++num)) { @@ -71,7 +72,7 @@ mp_uint_t get_fmt_num(const char **p) { return val; } -mp_uint_t calcsize_items(const char *fmt) { +STATIC mp_uint_t calcsize_items(const char *fmt) { mp_uint_t cnt = 0; while (*fmt) { int num = 1; diff --git a/shared-module/terminalio/Terminal.c b/shared-module/terminalio/Terminal.c index 48010aa6508a..f0a69bde39fc 100644 --- a/shared-module/terminalio/Terminal.c +++ b/shared-module/terminalio/Terminal.c @@ -28,6 +28,7 @@ #include "shared-module/fontio/BuiltinFont.h" #include "shared-bindings/displayio/TileGrid.h" +#include "shared-bindings/terminalio/Terminal.h" void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self, displayio_tilegrid_t *tilegrid, const fontio_builtinfont_t *font) { self->cursor_x = 0; diff --git a/shared-module/time/__init__.c b/shared-module/time/__init__.c index c79a5f3ae7af..b4575b18a2cf 100644 --- a/shared-module/time/__init__.c +++ b/shared-module/time/__init__.c @@ -27,6 +27,7 @@ #include "py/mphal.h" #include "supervisor/port.h" #include "supervisor/shared/tick.h" +#include "shared-bindings/time/__init__.h" uint64_t common_hal_time_monotonic_ms(void) { return supervisor_ticks_ms64(); diff --git a/shared-module/vectorio/Rectangle.c b/shared-module/vectorio/Rectangle.c index 2471daa60846..bcaa0092f868 100644 --- a/shared-module/vectorio/Rectangle.c +++ b/shared-module/vectorio/Rectangle.c @@ -28,11 +28,6 @@ void common_hal_vectorio_rectangle_get_area(void *rectangle, displayio_area_t *o } -uint32_t common_hal_vectorio_rectangle_get_height(void *rectangle) { - vectorio_rectangle_t *self = rectangle; - return self->height; -} - mp_obj_t common_hal_vectorio_rectangle_get_draw_protocol(void *rectangle) { vectorio_rectangle_t *self = rectangle; return self->draw_protocol_instance; diff --git a/shared/runtime/interrupt_char.c b/shared/runtime/interrupt_char.c index 4ac099f41e93..21e5a06358ad 100644 --- a/shared/runtime/interrupt_char.c +++ b/shared/runtime/interrupt_char.c @@ -26,6 +26,7 @@ #include "py/obj.h" #include "py/mpstate.h" +#include "shared/runtime/interrupt_char.h" #if MICROPY_KBD_EXCEPTION diff --git a/shared/runtime/sys_stdio_mphal.c b/shared/runtime/sys_stdio_mphal.c index 228529ce3d40..580d97f614af 100644 --- a/shared/runtime/sys_stdio_mphal.c +++ b/shared/runtime/sys_stdio_mphal.c @@ -52,7 +52,7 @@ typedef struct _sys_stdio_obj_t { STATIC const sys_stdio_obj_t stdio_buffer_obj; #endif -void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +STATIC void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "", self->fd); } diff --git a/supervisor/shared/bluetooth/file_transfer.c b/supervisor/shared/bluetooth/file_transfer.c index d1841c87d0ca..bf423262757f 100644 --- a/supervisor/shared/bluetooth/file_transfer.c +++ b/supervisor/shared/bluetooth/file_transfer.c @@ -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); diff --git a/supervisor/shared/bluetooth/serial.c b/supervisor/shared/bluetooth/serial.c index 018acd5f4a59..2edf3c784f18 100644 --- a/supervisor/shared/bluetooth/serial.c +++ b/supervisor/shared/bluetooth/serial.c @@ -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" diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 6789ab32ea29..3270f76ed14d 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -137,6 +137,9 @@ else endif endif +SRC_TINYUSB = $(filter lib/tinyusb/%.c, $(SRC_SUPERVISOR)) +$(patsubst %.c,$(BUILD)/%.o,$(SRC_TINYUSB)): CFLAGS += -Wno-missing-prototypes + SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) ifeq ($(CIRCUITPY_DISPLAYIO), 1)