Merge pull request #5563 from jepler/enable-error-missing-prototypes

Additional missing-prototypes fixes
This commit is contained in:
Dan Halbert 2021-11-11 11:57:43 -05:00 committed by GitHub
commit adac5ee596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
143 changed files with 252 additions and 175 deletions

View File

@ -33,6 +33,7 @@
#include "shared-bindings/_bleio/__init__.h" #include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Connection.h" #include "shared-bindings/_bleio/Connection.h"
#include "shared-bindings/_bleio/CharacteristicBuffer.h"
#include "supervisor/shared/tick.h" #include "supervisor/shared/tick.h"
#include "common-hal/_bleio/CharacteristicBuffer.h" #include "common-hal/_bleio/CharacteristicBuffer.h"

View File

@ -85,5 +85,6 @@ typedef struct {
uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self); 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); 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); 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 #endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_CONNECTION_H

View File

@ -1,6 +1,12 @@
// Derived from ArduinoBLE. // Derived from ArduinoBLE.
// Copyright 2020 Dan Halbert for Adafruit Industries // 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. This file is part of the ArduinoBLE library.
Copyright (c) 2018 Arduino SA. All rights reserved. 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 __packed req {
struct bt_att_hdr h; struct bt_att_hdr h;
struct bt_att_find_info_req r; 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; 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); 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 { typedef struct __packed {
struct bt_att_hdr h; 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 { typedef struct __packed {
struct bt_att_hdr h; struct bt_att_hdr h;
struct bt_att_read_type_req r; 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? // 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; const compressed_string_t *msg = NULL;
switch (err) { switch (err) {
case 0: case 0:

View File

@ -291,7 +291,7 @@ $(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sdhc/hpl_sdhc.o: CFLAGS += -Wno-cast-align -Wno
endif endif
SRC_ASF := $(addprefix asf4/$(CHIP_FAMILY)/, $(SRC_ASF)) 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 := \ SRC_PERIPHERALS := \
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \ peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \
@ -310,7 +310,7 @@ SRC_PERIPHERALS := \
peripherals/samd/sercom.c \ peripherals/samd/sercom.c \
peripherals/samd/timers.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 += \ SRC_C += \
audio_dma.c \ audio_dma.c \
@ -328,6 +328,8 @@ SRC_C += \
timer_handler.c \ timer_handler.c \
$(SRC_PERIPHERALS) \ $(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 # This is an OR because it filters to any 1s and then checks to see if it is not
# empty. # empty.
ifneq (,$(filter 1,$(CIRCUITPY_PWMIO) $(CIRCUITPY_AUDIOIO) $(CIRCUITPY_RGBMATRIX))) ifneq (,$(filter 1,$(CIRCUITPY_PWMIO) $(CIRCUITPY_AUDIOIO) $(CIRCUITPY_RGBMATRIX)))

View File

@ -50,7 +50,7 @@ typedef struct {
#define DELAY 0x80 #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; const uint32_t *ptr = UF2_BINFO->config_data;
if (!ptr || (((uint32_t)ptr) & 3) || *ptr != CFG_MAGIC0) { if (!ptr || (((uint32_t)ptr) & 3) || *ptr != CFG_MAGIC0) {
// no config data! // no config data!

View File

@ -28,6 +28,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "common-hal/alarm/SleepMemory.h" #include "common-hal/alarm/SleepMemory.h"
#include "shared-bindings/alarm/SleepMemory.h"
#include "shared-bindings/nvm/ByteArray.h" #include "shared-bindings/nvm/ByteArray.h"
void alarm_sleep_memory_reset(void) { void alarm_sleep_memory_reset(void) {

View File

@ -485,6 +485,3 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
return values_output; return values_output;
} }
void common_hal_audiobusio_pdmin_record_to_file(audiobusio_pdmin_obj_t* self, uint8_t* buffer, uint32_t length) {
}

View File

@ -25,6 +25,7 @@
*/ */
#include "samd/sercom.h" #include "samd/sercom.h"
#include "common-hal/busio/__init__.h"
static bool never_reset_sercoms[SERCOM_INST_NUM]; static bool never_reset_sercoms[SERCOM_INST_NUM];

View File

@ -195,7 +195,7 @@ STATIC void install_extended_filter(CanMramXidfe *extended, int id1, int id2, in
#define NO_ID (-1) #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; int fifo = self->fifo_idx;
if (!nmatch) { if (!nmatch) {

View File

@ -1,5 +1,6 @@
#include "common-hal/countio/Counter.h" #include "common-hal/countio/Counter.h"
#include "shared-bindings/countio/Counter.h"
#include "atmel_start_pins.h" #include "atmel_start_pins.h"

View File

@ -65,6 +65,7 @@
#include "py/mphal.h" #include "py/mphal.h"
#include "common-hal/microcontroller/Processor.h" #include "common-hal/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/ResetReason.h" #include "shared-bindings/microcontroller/ResetReason.h"
#include "samd/adc.h" #include "samd/adc.h"

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/nvm/ByteArray.h" #include "common-hal/nvm/ByteArray.h"
#include "shared-bindings/nvm/ByteArray.h"
#include "hal_flash.h" #include "hal_flash.h"
@ -33,11 +34,11 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.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; 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) { 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 // 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. // 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. // 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) { uint32_t start_index, uint32_t len, uint8_t *values) {
memcpy(values, self->start_address + start_index, len); memcpy(values, self->start_address + start_index, len);
} }

View File

@ -30,6 +30,8 @@
#include "py/objtuple.h" #include "py/objtuple.h"
#include "py/qstr.h" #include "py/qstr.h"
#include "shared-bindings/os/__init__.h"
#ifdef SAM_D5X_E5X #ifdef SAM_D5X_E5X
#include "hal/include/hal_rand_sync.h" #include "hal/include/hal_rand_sync.h"
#endif #endif
@ -66,7 +68,7 @@ mp_obj_t common_hal_os_uname(void) {
return (mp_obj_t)&os_uname_info_obj; 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 #ifdef SAM_D5X_E5X
hri_mclk_set_APBCMASK_TRNG_bit(MCLK); hri_mclk_set_APBCMASK_TRNG_bit(MCLK);
struct rand_sync_desc random; struct rand_sync_desc random;

View File

@ -26,6 +26,7 @@
*/ */
#include "common-hal/ps2io/Ps2.h" #include "common-hal/ps2io/Ps2.h"
#include "shared-bindings/ps2io/Ps2.h"
#include <stdint.h> #include <stdint.h>
@ -302,11 +303,6 @@ uint16_t common_hal_ps2io_ps2_get_len(ps2io_ps2_obj_t *self) {
return self->bufcount; 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) { int16_t common_hal_ps2io_ps2_popleft(ps2io_ps2_obj_t *self) {
common_hal_mcu_disable_interrupts(); common_hal_mcu_disable_interrupts();
if (self->bufcount <= 0) { if (self->bufcount <= 0) {

View File

@ -59,7 +59,7 @@ static void turn_off(__IO PORT_PINCFG_Type *pincfg) {
pincfg->reg = PORT_PINCFG_RESETVALUE; pincfg->reg = PORT_PINCFG_RESETVALUE;
} }
void pulse_finish(void) { STATIC void pulse_finish(void) {
pulse_index++; pulse_index++;
if (active_pincfg == NULL) { if (active_pincfg == NULL) {

View File

@ -91,7 +91,7 @@ static uint8_t tcc_channel(const pin_timer_t *t) {
return t->wave_output % tcc_cc_num[t->index]; 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); uint8_t channel_bit = 1 << tcc_channel(t);
return (!t->is_tc && ((tcc_channels[t->index] & channel_bit) == 0)) || return (!t->is_tc && ((tcc_channels[t->index] & channel_bit) == 0)) ||
t->is_tc; t->is_tc;

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/rotaryio/IncrementalEncoder.h" #include "common-hal/rotaryio/IncrementalEncoder.h"
#include "shared-bindings/rotaryio/IncrementalEncoder.h"
#include "shared-module/rotaryio/IncrementalEncoder.h" #include "shared-module/rotaryio/IncrementalEncoder.h"
#include "atmel_start_pins.h" #include "atmel_start_pins.h"

View File

@ -35,6 +35,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "shared/timeutils/timeutils.h" #include "shared/timeutils/timeutils.h"
#include "shared-bindings/rtc/__init__.h" #include "shared-bindings/rtc/__init__.h"
#include "shared-bindings/rtc/RTC.h"
#include "supervisor/port.h" #include "supervisor/port.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"

View File

@ -50,7 +50,7 @@ mp_float_t common_hal_watchdog_get_timeout(watchdog_watchdogtimer_obj_t *self) {
return self->timeout; 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) OSC32KCTRL->OSCULP32K.bit.EN1K = 1; // Enable out 1K (for WDT)
// disable watchdog for config // disable watchdog for config

View File

@ -78,10 +78,6 @@ void port_internal_flash_flush(void) {
void supervisor_flash_release_cache(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) { static int32_t convert_block_to_flash_addr(uint32_t block) {
if (0 <= block && block < INTERNAL_FLASH_PART1_NUM_BLOCKS) { if (0 <= block && block < INTERNAL_FLASH_PART1_NUM_BLOCKS) {
// a block in partition 1 // a block in partition 1
@ -91,7 +87,7 @@ static int32_t convert_block_to_flash_addr(uint32_t block) {
return -1; 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 // non-MBR block, get data from flash memory
int32_t src = convert_block_to_flash_addr(block); int32_t src = convert_block_to_flash_addr(block);
if (src == -1) { if (src == -1) {
@ -102,7 +98,7 @@ bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) {
return error_code == ERR_NONE; 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 // non-MBR block, copy to cache
int32_t dest = convert_block_to_flash_addr(block); int32_t dest = convert_block_to_flash_addr(block);
if (dest == -1) { if (dest == -1) {

View File

@ -109,6 +109,7 @@
#include "shared-bindings/rtc/__init__.h" #include "shared-bindings/rtc/__init__.h"
#include "shared_timers.h" #include "shared_timers.h"
#include "reset.h" #include "reset.h"
#include "common-hal/pulseio/PulseIn.h"
#include "supervisor/background_callback.h" #include "supervisor/background_callback.h"
#include "supervisor/shared/safe_mode.h" #include "supervisor/shared/safe_mode.h"

View File

@ -150,7 +150,7 @@ endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS) 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) ifeq ($(IDF_TARGET_ARCH),xtensa)
CFLAGS += -mlongcalls CFLAGS += -mlongcalls

View File

@ -26,6 +26,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/filesystem.h" #include "supervisor/filesystem.h"
#include "supervisor/port.h"
#include "supervisor/shared/stack.h" #include "supervisor/shared/stack.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"

View File

@ -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); MP_DEFINE_CONST_FUN_OBJ_0(espidf_erase_nvs_obj, espidf_erase_nvs);
//| class IDFError(OSError): STATIC void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
//| """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) {
mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS; mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS;
bool is_subclass = kind & PRINT_EXC_SUBCLASS; bool is_subclass = kind & PRINT_EXC_SUBCLASS;
if (!is_subclass && (k == PRINT_EXC)) { if (!is_subclass && (k == PRINT_EXC)) {

View File

@ -26,6 +26,7 @@
*/ */
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/board.h"
void board_init(void) { void board_init(void) {
@ -51,6 +52,3 @@ bool board_requests_safe_mode(void) {
void reset_board(void) { void reset_board(void) {
} }
void board_deinit(void) {
}

View File

@ -25,6 +25,7 @@
*/ */
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/board.h"
void board_init(void) { void board_init(void) {
// USB // USB
@ -54,5 +55,7 @@ bool board_requests_safe_mode(void) {
void reset_board(void) { void reset_board(void) {
} }
#if CIRCUITPY_ALARM
void board_deinit(void) { void board_deinit(void) {
} }
#endif

View File

@ -69,7 +69,7 @@ typedef struct {
static cam_obj_t *cam_obj = NULL; 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}; cam_event_t cam_event = {0};
BaseType_t HPTaskAwoken = pdFALSE; BaseType_t HPTaskAwoken = pdFALSE;
typeof(I2S0.int_st) int_st = I2S0.int_st; 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}; cam_event_t cam_event = {0};
BaseType_t HPTaskAwoken = pdFALSE; BaseType_t HPTaskAwoken = pdFALSE;
/*!< filter */ /*!< 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; int cnt = 0;
if (config->mode.jpeg) { if (config->mode.jpeg) {

View File

@ -29,6 +29,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "common-hal/alarm/SleepMemory.h" #include "common-hal/alarm/SleepMemory.h"
#include "shared-bindings/alarm/SleepMemory.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_sleep.h" #include "esp_sleep.h"

View File

@ -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. // 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_31_0_status = 0;
static volatile uint32_t pin_63_32_status = 0; static volatile uint32_t pin_63_32_status = 0;
void gpio_interrupt(void *arg) { STATIC void gpio_interrupt(void *arg) {
(void)arg; (void)arg;
gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t *)&pin_31_0_status); gpio_ll_get_intr_status(&GPIO, xPortGetCoreID(), (uint32_t *)&pin_31_0_status);

View File

@ -63,7 +63,7 @@ esp_timer_handle_t pretend_sleep_timer;
STATIC bool woke_up = false; STATIC bool woke_up = false;
// This is run in the timer task. We use it to wake the main CircuitPython task. // 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; (void)arg;
woke_up = true; woke_up = true;
xTaskNotifyGive(circuitpython_task); xTaskNotifyGive(circuitpython_task);

View File

@ -75,7 +75,7 @@ mp_obj_t alarm_touch_touchalarm_create_wakeup_alarm(void) {
} }
// This is used to wake the main CircuitPython task. // This is used to wake the main CircuitPython task.
void touch_interrupt(void *arg) { STATIC void touch_interrupt(void *arg) {
(void)arg; (void)arg;
woke_up = true; woke_up = true;
BaseType_t task_wakeup; BaseType_t task_wakeup;

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/analogio/AnalogIn.h" #include "common-hal/analogio/AnalogIn.h"
#include "shared-bindings/analogio/AnalogIn.h"
#include "py/mperrno.h" #include "py/mperrno.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"

View File

@ -38,7 +38,7 @@
STATIC bool reserved_can; 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) { switch (baudrate) {
case 1000000: { case 1000000: {
// TWAI_TIMING_CONFIG_abc expands to a C designated initializer list // 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)); } 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) { if (self->auto_restart) {
can_restart(); can_restart();
} }

View File

@ -78,7 +78,7 @@ STATIC void install_all_match_filter(canio_listener_obj_t *self) {
} }
__attribute__((noinline,optimize("O0"))) __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); twai_ll_enter_reset_mode(&TWAI);
if (!nmatch) { if (!nmatch) {

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/countio/Counter.h" #include "common-hal/countio/Counter.h"
#include "shared-bindings/countio/Counter.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "py/runtime.h" #include "py/runtime.h"

View File

@ -31,6 +31,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "common-hal/microcontroller/Processor.h" #include "common-hal/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/ResetReason.h" #include "shared-bindings/microcontroller/ResetReason.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"

View File

@ -27,13 +27,14 @@
#include <string.h> #include <string.h>
#include "common-hal/nvm/ByteArray.h" #include "common-hal/nvm/ByteArray.h"
#include "shared-bindings/nvm/ByteArray.h"
#include "bindings/espidf/__init__.h" #include "bindings/espidf/__init__.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "py/gc.h" #include "py/gc.h"
#include "nvs_flash.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; return self->len;
} }
@ -75,7 +76,7 @@ static esp_err_t get_bytes(nvs_handle_t handle, uint8_t **buf_out) {
return result; 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) { uint32_t start_index, uint8_t *values, uint32_t len) {
// start nvs // start nvs
@ -122,7 +123,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
return true; 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) { uint32_t start_index, uint32_t len, uint8_t *values) {
// start nvs // start nvs

View File

@ -30,6 +30,8 @@
#include "py/objtuple.h" #include "py/objtuple.h"
#include "py/qstr.h" #include "py/qstr.h"
#include "shared-bindings/os/__init__.h"
#include "esp_system.h" #include "esp_system.h"
STATIC const qstr os_uname_info_fields[] = { STATIC const qstr os_uname_info_fields[] = {

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/ps2io/Ps2.h" #include "common-hal/ps2io/Ps2.h"
#include "shared-bindings/ps2io/Ps2.h"
#include "supervisor/port.h" #include "supervisor/port.h"
#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/__init__.h"

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/pulseio/PulseIn.h" #include "common-hal/pulseio/PulseIn.h"
#include "shared-bindings/pulseio/PulseIn.h"
#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/__init__.h"
#include "py/runtime.h" #include "py/runtime.h"

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/pulseio/PulseOut.h" #include "common-hal/pulseio/PulseOut.h"
#include "shared-bindings/pulseio/PulseOut.h"
#include "shared-bindings/pwmio/PWMOut.h" #include "shared-bindings/pwmio/PWMOut.h"
#include "py/runtime.h" #include "py/runtime.h"

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/rotaryio/IncrementalEncoder.h" #include "common-hal/rotaryio/IncrementalEncoder.h"
#include "shared-bindings/rotaryio/IncrementalEncoder.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "py/runtime.h" #include "py/runtime.h"

View File

@ -24,6 +24,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "shared-bindings/ssl/__init__.h"
#include "shared-bindings/ssl/SSLContext.h" #include "shared-bindings/ssl/SSLContext.h"
#include "components/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h" #include "components/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h"

View File

@ -32,6 +32,7 @@
#include "esp_task_wdt.h" #include "esp_task_wdt.h"
extern void esp_task_wdt_isr_user_handler(void);
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_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&mp_watchdog_timeout_exception));
MP_STATE_THREAD(mp_pending_exception) = &mp_watchdog_timeout_exception; MP_STATE_THREAD(mp_pending_exception) = &mp_watchdog_timeout_exception;

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/wifi/__init__.h" #include "common-hal/wifi/__init__.h"
#include "shared-bindings/wifi/__init__.h"
#include "shared-bindings/ipaddress/IPv4Address.h" #include "shared-bindings/ipaddress/IPv4Address.h"
#include "shared-bindings/wifi/Radio.h" #include "shared-bindings/wifi/Radio.h"

View File

@ -24,5 +24,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "modules/module.h"
void never_reset_module_internal_pins(void) { void never_reset_module_internal_pins(void) {
} }

View File

@ -39,6 +39,8 @@
#include "components/esp_rom/include/esp32s2/rom/ets_sys.h" #include "components/esp_rom/include/esp32s2/rom/ets_sys.h"
#endif #endif
#include "supervisor/cpu.h"
void mp_hal_delay_us(mp_uint_t delay) { void mp_hal_delay_us(mp_uint_t delay) {
ets_delay_us(delay); ets_delay_us(delay);
} }
@ -48,7 +50,7 @@ void mp_hal_delay_us(mp_uint_t delay) {
extern void xthal_window_spill(void); extern void xthal_window_spill(void);
#endif #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 // 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 // can be addressed are called the "window". When a function is called or
// returns the window rotates. This allows for more efficient function calls // returns the window rotates. This allows for more efficient function calls

View File

@ -39,6 +39,7 @@
#include "components/spi_flash/include/esp_partition.h" #include "components/spi_flash/include/esp_partition.h"
#include "supervisor/flash.h"
#include "supervisor/usb.h" #include "supervisor/usb.h"
STATIC const esp_partition_t *_partition; STATIC const esp_partition_t *_partition;

View File

@ -93,7 +93,7 @@ TaskHandle_t circuitpython_task = NULL;
extern void esp_restart(void) NORETURN; extern void esp_restart(void) NORETURN;
void tick_timer_cb(void *arg) { STATIC void tick_timer_cb(void *arg) {
supervisor_tick(); supervisor_tick();
// CircuitPython's VM is run in a separate FreeRTOS task from timer callbacks. So, we have to // 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. // Wrap main in app_main that the IDF expects.
extern void main(void); extern void main(void);
extern void app_main(void);
void app_main(void) { void app_main(void) {
main(); main();
} }

View File

@ -62,7 +62,7 @@ StaticTask_t usb_device_taskdef;
// USB Device Driver task // USB Device Driver task
// This top level thread process all usb events and invoke callbacks // 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; (void)param;
// RTOS forever loop // RTOS forever loop

View File

@ -101,7 +101,7 @@ endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS) 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 # Nordic Softdevice SDK header files contains inline assembler that has
# broken constraints. As a result the IPA-modref pass, introduced in gcc-11, # broken constraints. As a result the IPA-modref pass, introduced in gcc-11,
@ -173,25 +173,32 @@ SRC_C += \
bluetooth/ble_drv.c \ bluetooth/ble_drv.c \
common-hal/_bleio/bonding.c \ common-hal/_bleio/bonding.c \
nrfx/mdk/system_$(MCU_SUB_VARIANT).c \ nrfx/mdk/system_$(MCU_SUB_VARIANT).c \
sd_mutex.c \
SRC_PERIPHERALS := \
peripherals/nrf/cache.c \ peripherals/nrf/cache.c \
peripherals/nrf/clocks.c \ peripherals/nrf/clocks.c \
peripherals/nrf/$(MCU_CHIP)/pins.c \ peripherals/nrf/$(MCU_CHIP)/pins.c \
peripherals/nrf/$(MCU_CHIP)/power.c \ peripherals/nrf/$(MCU_CHIP)/power.c \
peripherals/nrf/nvm.c \ peripherals/nrf/nvm.c \
peripherals/nrf/timers.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) ifneq ($(CIRCUITPY_USB),0)
# USB source files for nrf52840 # USB source files for nrf52840
ifeq ($(MCU_SUB_VARIANT),nrf52840) ifeq ($(MCU_SUB_VARIANT),nrf52840)
SRC_C += \ SRC_DCD = \
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c
endif endif
ifeq ($(MCU_SUB_VARIANT),nrf52833) ifeq ($(MCU_SUB_VARIANT),nrf52833)
SRC_C += \ SRC_DCD += \
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c
endif endif
SRC_C += $(SRC_DCD)
$(patsubst %.c,$(BUILD)/%.o,$(SRC_DCD)): CFLAGS += -Wno-missing-prototypes
endif # CIRCUITPY_USB endif # CIRCUITPY_USB
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \

View File

@ -26,8 +26,9 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/filesystem.h" #include "supervisor/filesystem.h"
#include "supervisor/usb.h" #include "supervisor/port.h"
#include "supervisor/shared/stack.h" #include "supervisor/shared/stack.h"
#include "supervisor/usb.h"
#if CIRCUITPY_DISPLAYIO #if CIRCUITPY_DISPLAYIO
#include "shared-module/displayio/__init__.h" #include "shared-module/displayio/__init__.h"

View File

@ -39,6 +39,7 @@
#include "shared-bindings/_bleio/Connection.h" #include "shared-bindings/_bleio/Connection.h"
#include "supervisor/shared/tick.h" #include "supervisor/shared/tick.h"
#include "common-hal/_bleio/CharacteristicBuffer.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. // 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) { STATIC void write_to_ringbuf(bleio_characteristic_buffer_obj_t *self, uint8_t *data, uint16_t len) {

View File

@ -30,6 +30,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "common-hal/_bleio/UUID.h" #include "common-hal/_bleio/UUID.h"
#include "shared-bindings/_bleio/UUID.h"
#include "shared-bindings/_bleio/__init__.h" #include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Adapter.h" #include "shared-bindings/_bleio/Adapter.h"

View File

@ -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_load_identities(bool is_central, const ble_gap_id_key_t **keys, size_t max_length);
size_t bonding_peripheral_bond_count(void); 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 #endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_BONDING_H

View File

@ -28,6 +28,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "common-hal/alarm/__init__.h" #include "common-hal/alarm/__init__.h"
#include "common-hal/alarm/SleepMemory.h" #include "common-hal/alarm/SleepMemory.h"
#include "shared-bindings/alarm/SleepMemory.h"
#include "nrf_power.h" #include "nrf_power.h"
__attribute__((section(".uninitialized"))) static uint8_t _sleepmem[SLEEP_MEMORY_LENGTH]; __attribute__((section(".uninitialized"))) static uint8_t _sleepmem[SLEEP_MEMORY_LENGTH];

View File

@ -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. // 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 // revise to extract all parts essential to enabling sleep wakeup, but leave the
// alarm/non-alarm sorting to the existing main loop. // 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; bool have_timeout = false;
uint64_t start_tick = 0, end_tick = 0; uint64_t start_tick = 0, end_tick = 0;
int64_t tickdiff; int64_t tickdiff;

View File

@ -26,6 +26,7 @@
*/ */
#include "common-hal/analogio/AnalogIn.h" #include "common-hal/analogio/AnalogIn.h"
#include "shared-bindings/analogio/AnalogIn.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"

View File

@ -91,7 +91,7 @@ static void calculate_ratio_info(uint32_t target_sample_rate, struct frequency_i
/ target_sample_rate; / 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}; struct frequency_info best = {0, 0, 0, 1.0};
for (size_t ri = 0; ri < sizeof(ratios) / sizeof(ratios[0]); ri++) { for (size_t ri = 0; ri < sizeof(ratios) / sizeof(ratios[0]); ri++) {
if (NRF_I2S->CONFIG.SWIDTH == I2S_CONFIG_SWIDTH_SWIDTH_16Bit if (NRF_I2S->CONFIG.SWIDTH == I2S_CONFIG_SWIDTH_SWIDTH_16Bit

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/audiobusio/PDMIn.h" #include "common-hal/audiobusio/PDMIn.h"
#include "shared-bindings/audiobusio/PDMIn.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "py/runtime.h" #include "py/runtime.h"

View File

@ -1,5 +1,6 @@
#include "common-hal/countio/Counter.h" #include "common-hal/countio/Counter.h"
#include "shared-bindings/countio/Counter.h"
#include "py/runtime.h" #include "py/runtime.h"

View File

@ -27,6 +27,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "common-hal/microcontroller/Processor.h" #include "common-hal/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "common-hal/alarm/__init__.h" #include "common-hal/alarm/__init__.h"
#include "shared-bindings/microcontroller/ResetReason.h" #include "shared-bindings/microcontroller/ResetReason.h"

View File

@ -27,6 +27,7 @@
#include "py/mphal.h" #include "py/mphal.h"
#include "py/mpstate.h" #include "py/mpstate.h"
#include "shared-bindings/neopixel_write/__init__.h" #include "shared-bindings/neopixel_write/__init__.h"
#include "common-hal/neopixel_write/__init__.h"
#include "supervisor/port.h" #include "supervisor/port.h"
#include "nrf_pwm.h" #include "nrf_pwm.h"

View File

@ -26,13 +26,14 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "common-hal/nvm/ByteArray.h" #include "common-hal/nvm/ByteArray.h"
#include "shared-bindings/nvm/ByteArray.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "peripherals/nrf/nvm.h" #include "peripherals/nrf/nvm.h"
uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) { uint32_t common_hal_nvm_bytearray_get_length(const nvm_bytearray_obj_t *self) {
return self->len; 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 start_index, uint8_t *values, uint32_t len) {
uint32_t address = (uint32_t)self->start_address + start_index; 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; 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) { uint32_t start_index, uint32_t len, uint8_t *values) {
memcpy(values, self->start_address + start_index, len); memcpy(values, self->start_address + start_index, len);
} }

View File

@ -29,6 +29,8 @@
#include "py/objstr.h" #include "py/objstr.h"
#include "py/objtuple.h" #include "py/objtuple.h"
#include "shared-bindings/os/__init__.h"
#ifdef BLUETOOTH_SD #ifdef BLUETOOTH_SD
#include "nrf_sdm.h" #include "nrf_sdm.h"
#endif #endif
@ -61,7 +63,7 @@ mp_obj_t common_hal_os_uname(void) {
return (mp_obj_t)&os_uname_info_obj; 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 #ifdef BLUETOOTH_SD
uint8_t sd_en = 0; uint8_t sd_en = 0;
(void)sd_softdevice_is_enabled(&sd_en); (void)sd_softdevice_is_enabled(&sd_en);

View File

@ -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]; NRF_PWM_Type *pwm = pwms[i];
pwm->ENABLE = 0; 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. // Find the smallest prescaler value that will allow the divisor to be in range.
// This allows the most accuracy. // 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; uint32_t divisor = 1;
// Use a 32-bit number so we don't overflow the uint16_t; // Use a 32-bit number so we don't overflow the uint16_t;
uint32_t tentative_countertop; uint32_t tentative_countertop;

View File

@ -26,6 +26,7 @@
#include "common-hal/rotaryio/IncrementalEncoder.h" #include "common-hal/rotaryio/IncrementalEncoder.h"
#include "shared-module/rotaryio/IncrementalEncoder.h" #include "shared-module/rotaryio/IncrementalEncoder.h"
#include "shared-bindings/rotaryio/IncrementalEncoder.h"
#include "nrfx_gpiote.h" #include "nrfx_gpiote.h"
#include "py/runtime.h" #include "py/runtime.h"

View File

@ -30,6 +30,8 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "shared/timeutils/timeutils.h" #include "shared/timeutils/timeutils.h"
#include "shared-bindings/rtc/__init__.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/port.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"

View File

@ -39,6 +39,8 @@ typedef void (*func)(void);
extern void _start(void) __attribute__((noreturn)); extern void _start(void) __attribute__((noreturn));
extern void SystemInit(void); extern void SystemInit(void);
extern void Default_Handler(void);
extern void Reset_Handler(void);
void Default_Handler(void) { void Default_Handler(void) {
while (1) { while (1) {

View File

@ -40,12 +40,14 @@ typedef void (*func)(void);
extern void _start(void) __attribute__((noreturn)); extern void _start(void) __attribute__((noreturn));
extern void SystemInit(void); extern void SystemInit(void);
extern void Default_Handler(void);
void Default_Handler(void) { void Default_Handler(void) {
while (1) { while (1) {
; ;
} }
} }
extern void Reset_Handler(void);
void Reset_Handler(void) { void Reset_Handler(void) {
uint32_t *p_src = &_sidata; uint32_t *p_src = &_sidata;
uint32_t *p_dest = &_sdata; uint32_t *p_dest = &_sdata;

View File

@ -29,6 +29,7 @@
#include "shared/timeutils/timeutils.h" #include "shared/timeutils/timeutils.h"
#include "shared-bindings/rtc/RTC.h" #include "shared-bindings/rtc/RTC.h"
#include "shared-bindings/time/__init__.h" #include "shared-bindings/time/__init__.h"
#include "supervisor/fatfs_port.h"
DWORD _time_override = 0; DWORD _time_override = 0;
DWORD get_fattime(void) { DWORD get_fattime(void) {

View File

@ -25,6 +25,7 @@
*/ */
#include "nrfx.h" #include "nrfx.h"
#include "peripherals/nrf/cache.h"
// Turn off cache and invalidate all data in it. // Turn off cache and invalidate all data in it.
void nrf_peripherals_disable_and_clear_cache(void) { void nrf_peripherals_disable_and_clear_cache(void) {

View File

@ -26,6 +26,7 @@
#include "nrfx.h" #include "nrfx.h"
#include "hal/nrf_nvmc.h" #include "hal/nrf_nvmc.h"
#include "peripherals/nrf/power.h"
void nrf_peripherals_power_init(void) { void nrf_peripherals_power_init(void) {
// Set GPIO reference voltage to 3.3V if it isn't already. REGOUT0 will get reset to 0xfffffff // Set GPIO reference voltage to 3.3V if it isn't already. REGOUT0 will get reset to 0xfffffff

View File

@ -27,6 +27,7 @@
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "nrf_soc.h" #include "nrf_soc.h"
#include "sd_mutex.h"
void sd_mutex_acquire_check(nrf_mutex_t *p_mutex) { void sd_mutex_acquire_check(nrf_mutex_t *p_mutex) {
uint32_t err_code = sd_mutex_acquire(p_mutex); uint32_t err_code = sd_mutex_acquire(p_mutex);

View File

@ -46,6 +46,7 @@
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "common-hal/_bleio/__init__.h" #include "common-hal/_bleio/__init__.h"
#include "common-hal/alarm/time/TimeAlarm.h"
#include "common-hal/analogio/AnalogIn.h" #include "common-hal/analogio/AnalogIn.h"
#include "common-hal/busio/I2C.h" #include "common-hal/busio/I2C.h"
#include "common-hal/busio/SPI.h" #include "common-hal/busio/SPI.h"
@ -97,7 +98,7 @@ static volatile struct {
uint32_t suffix; uint32_t suffix;
} overflow_tracker __attribute__((section(".uninitialized"))); } 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) { 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 // Our RTC is 24 bits and we're clocking it at 32.768khz which is 32 (2 ** 5) subticks per
// tick. // 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)) { if (!nrf_clock_lf_is_running(NRF_CLOCK)) {
nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_LFCLKSTART); 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_counter_clear(&rtc_instance);
nrfx_rtc_disable(&rtc_instance); nrfx_rtc_disable(&rtc_instance);
nrfx_rtc_uninit(&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) { void HardFault_Handler(void) {
reset_into_safe_mode(HARD_CRASH); reset_into_safe_mode(HARD_CRASH);
while (true) { while (true) {

View File

@ -26,6 +26,7 @@
*/ */
#include "supervisor/spi_flash_api.h" #include "supervisor/spi_flash_api.h"
#include "supervisor/qspi_flash.h"
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@ -69,7 +70,7 @@ void qspi_disable(void) {
} }
} }
void qspi_enable(void) { STATIC void qspi_enable(void) {
if (NRF_QSPI->ENABLE) { if (NRF_QSPI->ENABLE) {
return; return;
} }

View File

@ -1,2 +1,3 @@
extern void qspi_flash_enter_sleep(void); extern void qspi_flash_enter_sleep(void);
extern void qspi_flash_exit_sleep(void); extern void qspi_flash_exit_sleep(void);
extern void qspi_disable(void);

View File

@ -91,6 +91,7 @@ void init_usb_hardware(void) {
} }
} }
extern void USBD_IRQHandler(void);
void USBD_IRQHandler(void) { void USBD_IRQHandler(void) {
usb_irq_handler(); usb_irq_handler();
} }

View File

@ -132,7 +132,7 @@ endif
# Remove -Wno-stringop-overflow after we can test with CI's GCC 10. Mac's looks weird. # 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 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 += \ CFLAGS += \
-march=armv6-m \ -march=armv6-m \
@ -187,6 +187,7 @@ SRC_SDK := \
src/rp2_common/pico_unique_id/unique_id.c \ src/rp2_common/pico_unique_id/unique_id.c \
SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) SRC_SDK := $(addprefix sdk/, $(SRC_SDK))
$(patsubst %.c,$(BUILD)/%.o,$(SRC_SDK)): CFLAGS += -Wno-missing-prototypes
SRC_C += \ SRC_C += \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \

View File

@ -617,7 +617,7 @@ const mp_obj_type_t rp2pio_statemachine_type = {
.locals_dict = (mp_obj_dict_t *)&rp2pio_statemachine_locals_dict, .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)) { if (!mp_obj_is_type(obj, &rp2pio_statemachine_type)) {
mp_raise_TypeError_varg(translate("Expected a %q"), rp2pio_statemachine_type.name); mp_raise_TypeError_varg(translate("Expected a %q"), rp2pio_statemachine_type.name);
} }

View File

@ -31,6 +31,7 @@
#include "shared-bindings/busio/SPI.h" #include "shared-bindings/busio/SPI.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
#include "supervisor/board.h"
#include "supervisor/shared/board.h" #include "supervisor/shared/board.h"
displayio_fourwire_obj_t board_display_obj; displayio_fourwire_obj_t board_display_obj;

View File

@ -28,6 +28,7 @@
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
#include "supervisor/shared/board.h" #include "supervisor/shared/board.h"
#include "supervisor/board.h"
void board_init(void) { void board_init(void) {
} }

View File

@ -28,6 +28,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "common-hal/alarm/SleepMemory.h" #include "common-hal/alarm/SleepMemory.h"
#include "shared-bindings/alarm/SleepMemory.h"
void alarm_sleep_memory_reset(void) { void alarm_sleep_memory_reset(void) {
} }

View File

@ -42,7 +42,7 @@ STATIC bool _pinalarm_set = false;
#define GPIO_IRQ_ALL_EVENTS 0x15u #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); alarm_triggered_pins |= (1 << gpio);
woke_up = true; woke_up = true;

View File

@ -37,7 +37,7 @@
STATIC bool woke_up = false; STATIC bool woke_up = false;
STATIC bool _timealarm_set = false; STATIC bool _timealarm_set = false;
void timer_callback(void) { STATIC void timer_callback(void) {
woke_up = true; woke_up = true;
} }

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/analogio/AnalogIn.h" #include "common-hal/analogio/AnalogIn.h"
#include "shared-bindings/analogio/AnalogIn.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"

View File

@ -171,7 +171,3 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t *se
return output_count; return output_count;
} }
void common_hal_audiobusio_pdmin_record_to_file(audiobusio_pdmin_obj_t *self, uint8_t *buffer, uint32_t length) {
}

View File

@ -95,7 +95,7 @@ void common_hal_countio_counter_reset(countio_counter_obj_t *self) {
self->count = 0; self->count = 0;
} }
void counter_interrupt_handler() { void counter_interrupt_handler(void) {
uint32_t mask = pwm_get_irq_status_mask(); uint32_t mask = pwm_get_irq_status_mask();
uint8_t i = 1, pos = 1; uint8_t i = 1, pos = 1;

View File

@ -14,7 +14,7 @@ typedef struct {
} countio_counter_obj_t; } countio_counter_obj_t;
void counter_interrupt_handler(); void counter_interrupt_handler(void);
void reset_countio(void); void reset_countio(void);

View File

@ -68,7 +68,7 @@
/* .wrap */ \ /* .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; const mp_map_t *mcu_map = &mcu_pin_globals.map;
for (uint8_t i = 0; i < mcu_map->alloc; i++) { for (uint8_t i = 0; i < mcu_map->alloc; i++) {
mp_obj_t val = mcu_map->table[i].value; mp_obj_t val = mcu_map->table[i].value;

View File

@ -29,6 +29,7 @@
#include "py/mphal.h" #include "py/mphal.h"
#include "common-hal/microcontroller/Processor.h" #include "common-hal/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/ResetReason.h" #include "shared-bindings/microcontroller/ResetReason.h"
#include "src/rp2_common/hardware_adc/include/hardware/adc.h" #include "src/rp2_common/hardware_adc/include/hardware/adc.h"

View File

@ -25,6 +25,7 @@
*/ */
#include "common-hal/nvm/ByteArray.h" #include "common-hal/nvm/ByteArray.h"
#include "shared-bindings/nvm/ByteArray.h"
#include <string.h> #include <string.h>
@ -36,7 +37,7 @@ static const uint32_t flash_binary_start = (uint32_t)&__flash_binary_start;
#define RMV_OFFSET(addr) addr - 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; 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); 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) { uint32_t start_index, uint32_t len, uint8_t *values) {
memcpy(values, self->start_address + start_index, len); 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) { uint32_t start_index, uint8_t *values, uint32_t len) {
uint8_t values_in[len]; uint8_t values_in[len];
common_hal_nvm_bytearray_get_bytes(self, start_index, len, values_in); common_hal_nvm_bytearray_get_bytes(self, start_index, len, values_in);

View File

@ -30,6 +30,8 @@
#include "py/objtuple.h" #include "py/objtuple.h"
#include "py/qstr.h" #include "py/qstr.h"
#include "shared-bindings/os/__init__.h"
#include "lib/crypto-algorithms/sha256.h" #include "lib/crypto-algorithms/sha256.h"
#include "hardware/structs/rosc.h" #include "hardware/structs/rosc.h"
@ -104,7 +106,7 @@ static void get_random_bits(BYTE out[SHA256_BLOCK_SIZE]) {
sha256_final(&context, out); 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 #define ROSC_POWER_SAVE (1) // assume ROSC is not necessarily active all the time
#if ROSC_POWER_SAVE #if ROSC_POWER_SAVE
uint32_t old_rosc_ctrl = rosc_hw->ctrl; uint32_t old_rosc_ctrl = rosc_hw->ctrl;

View File

@ -121,7 +121,8 @@ void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) {
self->level_count = 0; self->level_count = 0;
self->buf_index = 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; uint32_t rxfifo = 0;

View File

@ -48,6 +48,6 @@ typedef struct {
} pulseio_pulsein_obj_t; } pulseio_pulsein_obj_t;
void pulsein_reset(void); 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 #endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PULSEIN_H

View File

@ -41,7 +41,7 @@
volatile alarm_id_t cur_alarm = 0; 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++; self->pulse_index++;
// Turn pwm pin off by switching the GPIO mux to SIO (the cpu manual // Turn pwm pin off by switching the GPIO mux to SIO (the cpu manual
// control). // control).

View File

@ -28,6 +28,7 @@
#include <hardware/regs/pio.h> #include <hardware/regs/pio.h>
#include "common-hal/rotaryio/IncrementalEncoder.h" #include "common-hal/rotaryio/IncrementalEncoder.h"
#include "shared-bindings/rotaryio/IncrementalEncoder.h"
#include "shared-module/rotaryio/IncrementalEncoder.h" #include "shared-module/rotaryio/IncrementalEncoder.h"
#include "bindings/rp2pio/__init__.h" #include "bindings/rp2pio/__init__.h"
#include "bindings/rp2pio/StateMachine.h" #include "bindings/rp2pio/StateMachine.h"

View File

@ -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); uint8_t pio_index = pio_get_index(pio);
uint32_t program_id = _current_program_id[pio_index][sm]; uint32_t program_id = _current_program_id[pio_index][sm];
if (program_id == 0) { 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; 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) { switch (stride) {
case 4: case 4:
return DMA_SIZE_32; return DMA_SIZE_32;

View File

@ -24,6 +24,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "shared-bindings/rtc/RTC.h" #include "shared-bindings/rtc/RTC.h"
#include "common-hal/rtc/RTC.h"
#include <sys/time.h> #include <sys/time.h>

View File

@ -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 // This must be the first defined function so that it is placed at the start of
// memory where the bootloader jumps to! // memory where the bootloader jumps to!
extern void _stage2_boot(void);
void __attribute__((section(".entry._stage2_boot"), used)) _stage2_boot(void) { void __attribute__((section(".entry._stage2_boot"), used)) _stage2_boot(void) {
uint32_t lr; uint32_t lr;
asm ("MOV %0, LR\n" : "=r" (lr) ); asm ("MOV %0, LR\n" : "=r" (lr) );

Some files were not shown because too many files have changed in this diff Show More