Conditionalize LTO
This commit is contained in:
parent
c676253834
commit
9d10a3da66
@ -44,6 +44,7 @@
|
|||||||
#include "shared-bindings/_bleio/Service.h"
|
#include "shared-bindings/_bleio/Service.h"
|
||||||
#include "shared-bindings/_bleio/UUID.h"
|
#include "shared-bindings/_bleio/UUID.h"
|
||||||
#include "supervisor/shared/tick.h"
|
#include "supervisor/shared/tick.h"
|
||||||
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
STATIC uint16_t max_mtu = BT_ATT_DEFAULT_LE_MTU; // 23
|
STATIC uint16_t max_mtu = BT_ATT_DEFAULT_LE_MTU; // 23
|
||||||
STATIC unsigned long timeout = 5000;
|
STATIC unsigned long timeout = 5000;
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include "shared-bindings/supervisor/__init__.h"
|
#include "shared-bindings/supervisor/__init__.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_UASYNCIO
|
#if MICROPY_PY_UASYNCIO
|
||||||
|
|
||||||
// Used when task cannot be guaranteed to be non-NULL.
|
// Used when task cannot be guaranteed to be non-NULL.
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/binary.h"
|
#include "py/binary.h"
|
||||||
|
|
||||||
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
static void check_not_unicode(const mp_obj_t arg) {
|
static void check_not_unicode(const mp_obj_t arg) {
|
||||||
#if MICROPY_CPYTHON_COMPAT
|
#if MICROPY_CPYTHON_COMPAT
|
||||||
if (mp_obj_is_str(arg)) {
|
if (mp_obj_is_str(arg)) {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "py/objtuple.h"
|
#include "py/objtuple.h"
|
||||||
#include "py/binary.h"
|
#include "py/binary.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_UCTYPES
|
#if MICROPY_PY_UCTYPES
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_UHASHLIB
|
#if MICROPY_PY_UHASHLIB
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "py/objlist.h"
|
#include "py/objlist.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_UHEAPQ
|
#if MICROPY_PY_UHEAPQ
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_UJSON
|
#if MICROPY_PY_UJSON
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/smallint.h"
|
#include "py/smallint.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_UTIMEQ
|
#if MICROPY_PY_UTIMEQ
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_UZLIB
|
#if MICROPY_PY_UZLIB
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "extmod/vfs_fat.h"
|
#include "extmod/vfs_fat.h"
|
||||||
#include "shared/timeutils/timeutils.h"
|
#include "shared/timeutils/timeutils.h"
|
||||||
#include "supervisor/filesystem.h"
|
#include "supervisor/filesystem.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if FF_MAX_SS == FF_MIN_SS
|
#if FF_MAX_SS == FF_MIN_SS
|
||||||
#define SECSIZE(fs) (FF_MIN_SS)
|
#define SECSIZE(fs) (FF_MIN_SS)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "extmod/vfs_posix.h"
|
#include "extmod/vfs_posix.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if (defined(MICROPY_VFS_POSIX) && MICROPY_VFS_POSIX) || (defined(MICROPY_VFS_POSIX_FILE) && MICROPY_VFS_POSIX_FILE)
|
#if (defined(MICROPY_VFS_POSIX) && MICROPY_VFS_POSIX) || (defined(MICROPY_VFS_POSIX_FILE) && MICROPY_VFS_POSIX_FILE)
|
||||||
|
|
||||||
|
2
main.c
2
main.c
@ -58,7 +58,7 @@
|
|||||||
#include "supervisor/shared/status_leds.h"
|
#include "supervisor/shared/status_leds.h"
|
||||||
#include "supervisor/shared/tick.h"
|
#include "supervisor/shared/tick.h"
|
||||||
#include "supervisor/shared/traceback.h"
|
#include "supervisor/shared/traceback.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "supervisor/shared/workflow.h"
|
#include "supervisor/shared/workflow.h"
|
||||||
#include "supervisor/usb.h"
|
#include "supervisor/usb.h"
|
||||||
#include "supervisor/workflow.h"
|
#include "supervisor/workflow.h"
|
||||||
|
@ -123,8 +123,6 @@ $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
|
|||||||
#Debugging/Optimization
|
#Debugging/Optimization
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
CFLAGS += -ggdb3 -Og -Os
|
CFLAGS += -ggdb3 -Og -Os
|
||||||
# You may want to disable -flto if it interferes with debugging.
|
|
||||||
CFLAGS += -flto -flto-partition=one
|
|
||||||
# You may want to enable these flags to make setting breakpoints easier.
|
# You may want to enable these flags to make setting breakpoints easier.
|
||||||
# CFLAGS += -fno-inline -fno-ipa-sra
|
# CFLAGS += -fno-inline -fno-ipa-sra
|
||||||
ifeq ($(CHIP_FAMILY), samd21)
|
ifeq ($(CHIP_FAMILY), samd21)
|
||||||
@ -147,11 +145,8 @@ else
|
|||||||
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
|
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -flto
|
|
||||||
|
|
||||||
ifeq ($(CIRCUITPY_FULL_BUILD),0)
|
ifeq ($(CIRCUITPY_FULL_BUILD),0)
|
||||||
CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20
|
CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20
|
||||||
CFLAGS += -flto-partition=one
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CFLAGS_BOARD
|
ifdef CFLAGS_BOARD
|
||||||
@ -168,8 +163,7 @@ CFLAGS += \
|
|||||||
-mcpu=cortex-m0plus \
|
-mcpu=cortex-m0plus \
|
||||||
-msoft-float \
|
-msoft-float \
|
||||||
-mfloat-abi=soft \
|
-mfloat-abi=soft \
|
||||||
-DSAMD21 \
|
-DSAMD21
|
||||||
-flto-partition=one
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(CHIP_FAMILY), samd51)
|
ifeq ($(CHIP_FAMILY), samd51)
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
@ -206,7 +200,6 @@ endif
|
|||||||
CFLAGS += -Wno-stringop-overread -Wno-stringop-overflow
|
CFLAGS += -Wno-stringop-overread -Wno-stringop-overflow
|
||||||
|
|
||||||
LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
|
LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
|
||||||
LDFLAGS += -flto=$(shell $(NPROC))
|
|
||||||
LIBS := -lgcc -lc
|
LIBS := -lgcc -lc
|
||||||
|
|
||||||
# Use toolchain libm if we're not using our own.
|
# Use toolchain libm if we're not using our own.
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "shared-bindings/util.h"
|
#include "shared-bindings/util.h"
|
||||||
#include "samd/timers.h"
|
#include "samd/timers.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "timer_handler.h"
|
#include "timer_handler.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "samd/adc.h"
|
#include "samd/adc.h"
|
||||||
#include "shared-bindings/analogio/AnalogIn.h"
|
#include "shared-bindings/analogio/AnalogIn.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "atmel_start_pins.h"
|
#include "atmel_start_pins.h"
|
||||||
#include "hal/include/hal_adc_sync.h"
|
#include "hal/include/hal_adc_sync.h"
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "shared-bindings/analogio/AnalogOut.h"
|
#include "shared-bindings/analogio/AnalogOut.h"
|
||||||
#include "shared-bindings/audioio/AudioOut.h"
|
#include "shared-bindings/audioio/AudioOut.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "atmel_start_pins.h"
|
#include "atmel_start_pins.h"
|
||||||
#include "hal/include/hal_dac_sync.h"
|
#include "hal/include/hal_dac_sync.h"
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "shared-bindings/audiobusio/I2SOut.h"
|
#include "shared-bindings/audiobusio/I2SOut.h"
|
||||||
#include "shared-bindings/audiocore/RawSample.h"
|
#include "shared-bindings/audiocore/RawSample.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "atmel_start_pins.h"
|
#include "atmel_start_pins.h"
|
||||||
#include "hal/include/hal_gpio.h"
|
#include "hal/include/hal_gpio.h"
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "shared-bindings/audiobusio/PDMIn.h"
|
#include "shared-bindings/audiobusio/PDMIn.h"
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "atmel_start_pins.h"
|
#include "atmel_start_pins.h"
|
||||||
#include "hal/include/hal_gpio.h"
|
#include "hal/include/hal_gpio.h"
|
||||||
@ -58,11 +58,11 @@
|
|||||||
#define MIN_MIC_CLOCK 1000000
|
#define MIN_MIC_CLOCK 1000000
|
||||||
|
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
#define SERCTRL(name) I2S_SERCTRL_ ## name
|
#define SERCTRL(name) I2S_SERCTRL_##name
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
#define SERCTRL(name) I2S_RXCTRL_ ## name
|
#define SERCTRL(name) I2S_RXCTRL_##name
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set by interrupt handler when DMA block has finished transferring.
|
// Set by interrupt handler when DMA block has finished transferring.
|
||||||
@ -80,102 +80,104 @@ void pdmin_reset(void) {
|
|||||||
pdmin_dma_block_done = false;
|
pdmin_dma_block_done = false;
|
||||||
pdmin_event_channel = EVSYS_SYNCH_NUM;
|
pdmin_event_channel = EVSYS_SYNCH_NUM;
|
||||||
|
|
||||||
while (I2S->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) {}
|
while (I2S->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) {
|
||||||
|
}
|
||||||
I2S->INTENCLR.reg = I2S_INTENCLR_MASK;
|
I2S->INTENCLR.reg = I2S_INTENCLR_MASK;
|
||||||
I2S->INTFLAG.reg = I2S_INTFLAG_MASK;
|
I2S->INTFLAG.reg = I2S_INTFLAG_MASK;
|
||||||
I2S->CTRLA.reg &= ~I2S_SYNCBUSY_ENABLE;
|
I2S->CTRLA.reg &= ~I2S_SYNCBUSY_ENABLE;
|
||||||
while (I2S->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) {}
|
while (I2S->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) {
|
||||||
|
}
|
||||||
I2S->CTRLA.reg = I2S_CTRLA_SWRST;
|
I2S->CTRLA.reg = I2S_CTRLA_SWRST;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caller validates that pins are free.
|
// Caller validates that pins are free.
|
||||||
void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
|
void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t *self,
|
||||||
const mcu_pin_obj_t* clock_pin,
|
const mcu_pin_obj_t *clock_pin,
|
||||||
const mcu_pin_obj_t* data_pin,
|
const mcu_pin_obj_t *data_pin,
|
||||||
uint32_t sample_rate,
|
uint32_t sample_rate,
|
||||||
uint8_t bit_depth,
|
uint8_t bit_depth,
|
||||||
bool mono,
|
bool mono,
|
||||||
uint8_t oversample) {
|
uint8_t oversample) {
|
||||||
self->clock_pin = clock_pin; // PA10, PA20 -> SCK0, PB11 -> SCK1
|
self->clock_pin = clock_pin; // PA10, PA20 -> SCK0, PB11 -> SCK1
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
if (clock_pin == &pin_PA10
|
if (clock_pin == &pin_PA10
|
||||||
#if defined(PIN_PA20) && !defined(IGNORE_PIN_PA20)
|
#if defined(PIN_PA20) && !defined(IGNORE_PIN_PA20)
|
||||||
|| clock_pin == &pin_PA20
|
|| clock_pin == &pin_PA20
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
self->clock_unit = 0;
|
|
||||||
#if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11)
|
|
||||||
} else if (clock_pin == &pin_PB11) {
|
|
||||||
self->clock_unit = 1;
|
|
||||||
#endif
|
#endif
|
||||||
|
) {
|
||||||
|
self->clock_unit = 0;
|
||||||
|
#if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11)
|
||||||
|
} else if (clock_pin == &pin_PB11) {
|
||||||
|
self->clock_unit = 1;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
if (clock_pin == &pin_PA10 || clock_pin == &pin_PB16) {
|
if (clock_pin == &pin_PA10 || clock_pin == &pin_PB16) {
|
||||||
self->clock_unit = 0;
|
self->clock_unit = 0;
|
||||||
} else if (clock_pin == &pin_PB12
|
} else if (clock_pin == &pin_PB12
|
||||||
#if defined(PIN_PB28) && !defined(IGNORE_PIN_PB28)
|
#if defined(PIN_PB28) && !defined(IGNORE_PIN_PB28)
|
||||||
|| data_pin == &pin_PB28) {
|
|| data_pin == &pin_PB28) {
|
||||||
#else
|
#else
|
||||||
) {
|
) {
|
||||||
#endif
|
#endif
|
||||||
self->clock_unit = 1;
|
self->clock_unit = 1;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
raise_ValueError_invalid_pin_name(MP_QSTR_clock);
|
raise_ValueError_invalid_pin_name(MP_QSTR_clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->data_pin = data_pin; // PA07, PA19 -> SD0, PA08, PB16 -> SD1
|
self->data_pin = data_pin; // PA07, PA19 -> SD0, PA08, PB16 -> SD1
|
||||||
|
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
if (false
|
if (false
|
||||||
#if defined(PIN_PA07) && !defined(IGNORE_PIN_PA07)
|
#if defined(PIN_PA07) && !defined(IGNORE_PIN_PA07)
|
||||||
|| data_pin == &pin_PA07
|
|| data_pin == &pin_PA07
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIN_PA19) && !defined(IGNORE_PIN_PA19)
|
#if defined(PIN_PA19) && !defined(IGNORE_PIN_PA19)
|
||||||
|| data_pin == &pin_PA19
|
|| data_pin == &pin_PA19
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
self->serializer = 0;
|
self->serializer = 0;
|
||||||
}
|
} else if (false
|
||||||
else if (false
|
|
||||||
#if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08)
|
#if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08)
|
||||||
|| data_pin == &pin_PA08
|
|| data_pin == &pin_PA08
|
||||||
#endif
|
#endif
|
||||||
#if defined (PIN_PB16) && !defined(IGNORE_PIN_PB16)
|
#if defined(PIN_PB16) && !defined(IGNORE_PIN_PB16)
|
||||||
|| data_pin == &pin_PB16
|
|| data_pin == &pin_PB16
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
self->serializer = 1;
|
self->serializer = 1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
if (data_pin == &pin_PB10 || data_pin == &pin_PA22) {
|
if (data_pin == &pin_PB10 || data_pin == &pin_PA22) {
|
||||||
self->serializer = 1;
|
self->serializer = 1;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
}else {
|
||||||
raise_ValueError_invalid_pin_name(MP_QSTR_data);
|
raise_ValueError_invalid_pin_name(MP_QSTR_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(bit_depth == 16 || bit_depth == 8) || !mono || oversample != OVERSAMPLING) {
|
if (!(bit_depth == 16 || bit_depth == 8) || !mono || oversample != OVERSAMPLING) {
|
||||||
mp_raise_NotImplementedError(translate("Only 8 or 16 bit mono with " MP_STRINGIFY(OVERSAMPLING) "x oversampling is supported."));
|
mp_raise_NotImplementedError(translate("Only 8 or 16 bit mono with " MP_STRINGIFY(OVERSAMPLING) "x oversampling is supported."));
|
||||||
}
|
}
|
||||||
|
|
||||||
turn_on_i2s();
|
turn_on_i2s();
|
||||||
|
|
||||||
if (I2S->CTRLA.bit.ENABLE == 0) {
|
if (I2S->CTRLA.bit.ENABLE == 0) {
|
||||||
I2S->CTRLA.bit.SWRST = 1;
|
I2S->CTRLA.bit.SWRST = 1;
|
||||||
while (I2S->CTRLA.bit.SWRST == 1) {}
|
while (I2S->CTRLA.bit.SWRST == 1) {
|
||||||
} else {
|
|
||||||
#ifdef SAMD21
|
|
||||||
if ((I2S->CTRLA.vec.SEREN & (1 << self->serializer)) != 0) {
|
|
||||||
mp_raise_RuntimeError(translate("Serializer in use"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef SAM_D5X_E5X
|
|
||||||
if (I2S->CTRLA.bit.RXEN == 1) {
|
|
||||||
mp_raise_RuntimeError(translate("Serializer in use"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
#ifdef SAMD21
|
||||||
|
if ((I2S->CTRLA.vec.SEREN & (1 << self->serializer)) != 0) {
|
||||||
|
mp_raise_RuntimeError(translate("Serializer in use"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef SAM_D5X_E5X
|
||||||
|
if (I2S->CTRLA.bit.RXEN == 1) {
|
||||||
|
mp_raise_RuntimeError(translate("Serializer in use"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
#define GPIO_I2S_FUNCTION GPIO_PIN_FUNCTION_J
|
#define GPIO_I2S_FUNCTION GPIO_PIN_FUNCTION_J
|
||||||
#endif
|
#endif
|
||||||
@ -183,69 +185,69 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
|
|||||||
#define GPIO_I2S_FUNCTION GPIO_PIN_FUNCTION_G
|
#define GPIO_I2S_FUNCTION GPIO_PIN_FUNCTION_G
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t clock_divisor = (uint32_t) roundf( 48000000.0f / sample_rate / oversample);
|
uint32_t clock_divisor = (uint32_t)roundf(48000000.0f / sample_rate / oversample);
|
||||||
float mic_clock_freq = 48000000.0f / clock_divisor;
|
float mic_clock_freq = 48000000.0f / clock_divisor;
|
||||||
self->sample_rate = mic_clock_freq / oversample;
|
self->sample_rate = mic_clock_freq / oversample;
|
||||||
if (mic_clock_freq < MIN_MIC_CLOCK || clock_divisor == 0) {
|
if (mic_clock_freq < MIN_MIC_CLOCK || clock_divisor == 0) {
|
||||||
mp_raise_ValueError(translate("sampling rate out of range"));
|
mp_raise_ValueError(translate("sampling rate out of range"));
|
||||||
}
|
}
|
||||||
// Find a free GCLK to generate the MCLK signal.
|
// Find a free GCLK to generate the MCLK signal.
|
||||||
uint8_t gclk = find_free_gclk(clock_divisor);
|
uint8_t gclk = find_free_gclk(clock_divisor);
|
||||||
if (gclk > GCLK_GEN_NUM) {
|
if (gclk > GCLK_GEN_NUM) {
|
||||||
mp_raise_RuntimeError(translate("Unable to find free GCLK"));
|
mp_raise_RuntimeError(translate("Unable to find free GCLK"));
|
||||||
}
|
}
|
||||||
self->gclk = gclk;
|
self->gclk = gclk;
|
||||||
|
|
||||||
enable_clock_generator(self->gclk, CLOCK_48MHZ, clock_divisor);
|
enable_clock_generator(self->gclk, CLOCK_48MHZ, clock_divisor);
|
||||||
connect_gclk_to_peripheral(self->gclk, I2S_GCLK_ID_0 + self->clock_unit);
|
connect_gclk_to_peripheral(self->gclk, I2S_GCLK_ID_0 + self->clock_unit);
|
||||||
|
|
||||||
// Clock unit configuration
|
// Clock unit configuration
|
||||||
|
|
||||||
uint32_t clkctrl = I2S_CLKCTRL_MCKSEL_GCLK |
|
uint32_t clkctrl = I2S_CLKCTRL_MCKSEL_GCLK |
|
||||||
I2S_CLKCTRL_NBSLOTS(2) |
|
I2S_CLKCTRL_NBSLOTS(2) |
|
||||||
I2S_CLKCTRL_FSWIDTH_SLOT |
|
I2S_CLKCTRL_FSWIDTH_SLOT |
|
||||||
I2S_CLKCTRL_SLOTSIZE_16;
|
I2S_CLKCTRL_SLOTSIZE_16;
|
||||||
|
|
||||||
// Serializer configuration
|
// Serializer configuration
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
uint32_t serctrl = (self->clock_unit << I2S_SERCTRL_CLKSEL_Pos) | SERCTRL(SERMODE_PDM2) | SERCTRL(DATASIZE_32);
|
uint32_t serctrl = (self->clock_unit << I2S_SERCTRL_CLKSEL_Pos) | SERCTRL(SERMODE_PDM2) | SERCTRL(DATASIZE_32);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
uint32_t serctrl = (self->clock_unit << I2S_RXCTRL_CLKSEL_Pos) | SERCTRL(SERMODE_PDM2) | SERCTRL(DATASIZE_32);
|
uint32_t serctrl = (self->clock_unit << I2S_RXCTRL_CLKSEL_Pos) | SERCTRL(SERMODE_PDM2) | SERCTRL(DATASIZE_32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Configure the I2S peripheral
|
// Configure the I2S peripheral
|
||||||
i2s_set_enable(false);
|
i2s_set_enable(false);
|
||||||
|
|
||||||
I2S->CLKCTRL[self->clock_unit].reg = clkctrl;
|
I2S->CLKCTRL[self->clock_unit].reg = clkctrl;
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
I2S->SERCTRL[self->serializer].reg = serctrl;
|
I2S->SERCTRL[self->serializer].reg = serctrl;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
I2S->RXCTRL.reg = serctrl;
|
I2S->RXCTRL.reg = serctrl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i2s_set_enable(true);
|
i2s_set_enable(true);
|
||||||
|
|
||||||
// Run the clock all the time. This eliminates startup delay for the microphone,
|
// Run the clock all the time. This eliminates startup delay for the microphone,
|
||||||
// which can be 10-100ms. Turn serializer on as needed.
|
// which can be 10-100ms. Turn serializer on as needed.
|
||||||
i2s_set_clock_unit_enable(self->clock_unit, true);
|
i2s_set_clock_unit_enable(self->clock_unit, true);
|
||||||
|
|
||||||
claim_pin(clock_pin);
|
claim_pin(clock_pin);
|
||||||
claim_pin(data_pin);
|
claim_pin(data_pin);
|
||||||
|
|
||||||
gpio_set_pin_function(self->clock_pin->number, GPIO_I2S_FUNCTION);
|
gpio_set_pin_function(self->clock_pin->number, GPIO_I2S_FUNCTION);
|
||||||
gpio_set_pin_function(self->data_pin->number, GPIO_I2S_FUNCTION);
|
gpio_set_pin_function(self->data_pin->number, GPIO_I2S_FUNCTION);
|
||||||
|
|
||||||
self->bytes_per_sample = oversample >> 3;
|
self->bytes_per_sample = oversample >> 3;
|
||||||
self->bit_depth = bit_depth;
|
self->bit_depth = bit_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool common_hal_audiobusio_pdmin_deinited(audiobusio_pdmin_obj_t* self) {
|
bool common_hal_audiobusio_pdmin_deinited(audiobusio_pdmin_obj_t *self) {
|
||||||
return self->clock_pin == NULL;
|
return self->clock_pin == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) {
|
void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t *self) {
|
||||||
if (common_hal_audiobusio_pdmin_deinited(self)) {
|
if (common_hal_audiobusio_pdmin_deinited(self)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -264,24 +266,24 @@ void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) {
|
|||||||
self->data_pin = NULL;
|
self->data_pin = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t* self) {
|
uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t *self) {
|
||||||
return self->bit_depth;
|
return self->bit_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t common_hal_audiobusio_pdmin_get_sample_rate(audiobusio_pdmin_obj_t* self) {
|
uint32_t common_hal_audiobusio_pdmin_get_sample_rate(audiobusio_pdmin_obj_t *self) {
|
||||||
return self->sample_rate;
|
return self->sample_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length,
|
static void setup_dma(audiobusio_pdmin_obj_t *self, uint32_t length,
|
||||||
DmacDescriptor* descriptor,
|
DmacDescriptor *descriptor,
|
||||||
DmacDescriptor* second_descriptor,
|
DmacDescriptor *second_descriptor,
|
||||||
uint32_t words_per_buffer, uint8_t words_per_sample,
|
uint32_t words_per_buffer, uint8_t words_per_sample,
|
||||||
uint32_t* first_buffer, uint32_t* second_buffer) {
|
uint32_t *first_buffer, uint32_t *second_buffer) {
|
||||||
descriptor->BTCTRL.reg = DMAC_BTCTRL_VALID |
|
descriptor->BTCTRL.reg = DMAC_BTCTRL_VALID |
|
||||||
DMAC_BTCTRL_BLOCKACT_NOACT |
|
DMAC_BTCTRL_BLOCKACT_NOACT |
|
||||||
DMAC_BTCTRL_EVOSEL_BLOCK |
|
DMAC_BTCTRL_EVOSEL_BLOCK |
|
||||||
DMAC_BTCTRL_DSTINC |
|
DMAC_BTCTRL_DSTINC |
|
||||||
DMAC_BTCTRL_BEATSIZE_WORD;
|
DMAC_BTCTRL_BEATSIZE_WORD;
|
||||||
|
|
||||||
// Block transfer count is the number of beats per block (aka descriptor).
|
// Block transfer count is the number of beats per block (aka descriptor).
|
||||||
// In this case there are two bytes per beat so divide the length by two.
|
// In this case there are two bytes per beat so divide the length by two.
|
||||||
@ -291,7 +293,7 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
descriptor->BTCNT.reg = block_transfer_count;
|
descriptor->BTCNT.reg = block_transfer_count;
|
||||||
descriptor->DSTADDR.reg = ((uint32_t) first_buffer + sizeof(uint32_t) * block_transfer_count);
|
descriptor->DSTADDR.reg = ((uint32_t)first_buffer + sizeof(uint32_t) * block_transfer_count);
|
||||||
descriptor->DESCADDR.reg = 0;
|
descriptor->DESCADDR.reg = 0;
|
||||||
if (length * words_per_sample > words_per_buffer) {
|
if (length * words_per_sample > words_per_buffer) {
|
||||||
descriptor->DESCADDR.reg = ((uint32_t)second_descriptor);
|
descriptor->DESCADDR.reg = ((uint32_t)second_descriptor);
|
||||||
@ -314,7 +316,7 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length,
|
|||||||
block_transfer_count = length * words_per_sample - words_per_buffer;
|
block_transfer_count = length * words_per_sample - words_per_buffer;
|
||||||
second_descriptor->DESCADDR.reg = 0;
|
second_descriptor->DESCADDR.reg = 0;
|
||||||
}
|
}
|
||||||
second_descriptor->DSTADDR.reg = ((uint32_t) second_buffer + sizeof(uint32_t) * block_transfer_count);
|
second_descriptor->DSTADDR.reg = ((uint32_t)second_buffer + sizeof(uint32_t) * block_transfer_count);
|
||||||
|
|
||||||
second_descriptor->BTCNT.reg = block_transfer_count;
|
second_descriptor->BTCNT.reg = block_transfer_count;
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
@ -324,10 +326,10 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length,
|
|||||||
second_descriptor->SRCADDR.reg = (uint32_t)&I2S->RXDATA;
|
second_descriptor->SRCADDR.reg = (uint32_t)&I2S->RXDATA;
|
||||||
#endif
|
#endif
|
||||||
second_descriptor->BTCTRL.reg = DMAC_BTCTRL_VALID |
|
second_descriptor->BTCTRL.reg = DMAC_BTCTRL_VALID |
|
||||||
DMAC_BTCTRL_BLOCKACT_NOACT |
|
DMAC_BTCTRL_BLOCKACT_NOACT |
|
||||||
DMAC_BTCTRL_EVOSEL_BLOCK |
|
DMAC_BTCTRL_EVOSEL_BLOCK |
|
||||||
DMAC_BTCTRL_DSTINC |
|
DMAC_BTCTRL_DSTINC |
|
||||||
DMAC_BTCTRL_BEATSIZE_WORD;
|
DMAC_BTCTRL_BEATSIZE_WORD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +343,7 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length,
|
|||||||
// higher sample rate than specified. Then after the audio is
|
// higher sample rate than specified. Then after the audio is
|
||||||
// recorded, a more expensive filter non-real-time filter could be
|
// recorded, a more expensive filter non-real-time filter could be
|
||||||
// used to down-sample and low-pass.
|
// used to down-sample and low-pass.
|
||||||
const uint16_t sinc_filter [OVERSAMPLING] = {
|
const uint16_t sinc_filter[OVERSAMPLING] = {
|
||||||
0, 2, 9, 21, 39, 63, 94, 132,
|
0, 2, 9, 21, 39, 63, 94, 132,
|
||||||
179, 236, 302, 379, 467, 565, 674, 792,
|
179, 236, 302, 379, 467, 565, 674, 792,
|
||||||
920, 1055, 1196, 1341, 1487, 1633, 1776, 1913,
|
920, 1055, 1196, 1341, 1487, 1633, 1776, 1913,
|
||||||
@ -353,26 +355,26 @@ const uint16_t sinc_filter [OVERSAMPLING] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
#define REPEAT_16_TIMES(X) do { for(uint8_t j=0; j<4; j++) { X X X X } } while (0)
|
#define REPEAT_16_TIMES(X) do { for (uint8_t j = 0; j < 4; j++) { X X X X } } while (0)
|
||||||
#else
|
#else
|
||||||
#define REPEAT_16_TIMES(X) do { X X X X X X X X X X X X X X X X } while(0)
|
#define REPEAT_16_TIMES(X) do { X X X X X X X X X X X X X X X X } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint16_t filter_sample(uint32_t pdm_samples[4]) {
|
static uint16_t filter_sample(uint32_t pdm_samples[4]) {
|
||||||
uint16_t running_sum = 0;
|
uint16_t running_sum = 0;
|
||||||
const uint16_t *filter_ptr = sinc_filter;
|
const uint16_t *filter_ptr = sinc_filter;
|
||||||
for (uint8_t i = 0; i < OVERSAMPLING/16; i++) {
|
for (uint8_t i = 0; i < OVERSAMPLING / 16; i++) {
|
||||||
// The sample is 16-bits right channel in the upper two bytes and 16-bits left channel
|
// The sample is 16-bits right channel in the upper two bytes and 16-bits left channel
|
||||||
// in the lower two bytes.
|
// in the lower two bytes.
|
||||||
// We just ignore the upper bits
|
// We just ignore the upper bits
|
||||||
uint32_t pdm_sample = pdm_samples[i];
|
uint32_t pdm_sample = pdm_samples[i];
|
||||||
REPEAT_16_TIMES( {
|
REPEAT_16_TIMES({
|
||||||
if (pdm_sample & 0x8000) {
|
if (pdm_sample & 0x8000) {
|
||||||
running_sum += *filter_ptr;
|
running_sum += *filter_ptr;
|
||||||
}
|
|
||||||
filter_ptr++;
|
|
||||||
pdm_sample <<= 1;
|
|
||||||
}
|
}
|
||||||
|
filter_ptr++;
|
||||||
|
pdm_sample <<= 1;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return running_sum;
|
return running_sum;
|
||||||
@ -380,8 +382,8 @@ static uint16_t filter_sample(uint32_t pdm_samples[4]) {
|
|||||||
|
|
||||||
// output_buffer may be a byte buffer or a halfword buffer.
|
// output_buffer may be a byte buffer or a halfword buffer.
|
||||||
// output_buffer_length is the number of slots, not the number of bytes.
|
// output_buffer_length is the number of slots, not the number of bytes.
|
||||||
uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* self,
|
uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t *self,
|
||||||
uint16_t* output_buffer, uint32_t output_buffer_length) {
|
uint16_t *output_buffer, uint32_t output_buffer_length) {
|
||||||
uint8_t dma_channel = dma_allocate_channel();
|
uint8_t dma_channel = dma_allocate_channel();
|
||||||
pdmin_event_channel = find_sync_event_channel_raise();
|
pdmin_event_channel = find_sync_event_channel_raise();
|
||||||
pdmin_dma_block_done = false;
|
pdmin_dma_block_done = false;
|
||||||
@ -399,7 +401,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
|
|||||||
COMPILER_ALIGNED(16) DmacDescriptor second_descriptor;
|
COMPILER_ALIGNED(16) DmacDescriptor second_descriptor;
|
||||||
|
|
||||||
setup_dma(self, output_buffer_length, dma_descriptor(dma_channel), &second_descriptor,
|
setup_dma(self, output_buffer_length, dma_descriptor(dma_channel), &second_descriptor,
|
||||||
words_per_buffer, words_per_sample, first_buffer, second_buffer);
|
words_per_buffer, words_per_sample, first_buffer, second_buffer);
|
||||||
|
|
||||||
uint8_t trigger_source = I2S_DMAC_ID_RX_0;
|
uint8_t trigger_source = I2S_DMAC_ID_RX_0;
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
@ -444,7 +446,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
|
|||||||
|
|
||||||
// Flip back and forth between processing the first and second buffers.
|
// Flip back and forth between processing the first and second buffers.
|
||||||
uint32_t *buffer = first_buffer;
|
uint32_t *buffer = first_buffer;
|
||||||
DmacDescriptor* descriptor = dma_descriptor(dma_channel);
|
DmacDescriptor *descriptor = dma_descriptor(dma_channel);
|
||||||
if (buffers_processed % 2 == 1) {
|
if (buffers_processed % 2 == 1) {
|
||||||
buffer = second_buffer;
|
buffer = second_buffer;
|
||||||
descriptor = &second_descriptor;
|
descriptor = &second_descriptor;
|
||||||
@ -459,7 +461,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
|
|||||||
uint16_t value = filter_sample(buffer + i * words_per_sample);
|
uint16_t value = filter_sample(buffer + i * words_per_sample);
|
||||||
if (self->bit_depth == 8) {
|
if (self->bit_depth == 8) {
|
||||||
// Truncate to 8 bits.
|
// Truncate to 8 bits.
|
||||||
((uint8_t*) output_buffer)[values_output] = value >> 8;
|
((uint8_t *)output_buffer)[values_output] = value >> 8;
|
||||||
} else {
|
} else {
|
||||||
output_buffer[values_output] = value;
|
output_buffer[values_output] = value;
|
||||||
}
|
}
|
||||||
@ -471,7 +473,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
|
|||||||
// Compute how many more samples we need, and if the last buffer is the last
|
// Compute how many more samples we need, and if the last buffer is the last
|
||||||
// set of samples needed, adjust the DMA count to only fetch as necessary.
|
// set of samples needed, adjust the DMA count to only fetch as necessary.
|
||||||
remaining_samples_needed = output_buffer_length - values_output;
|
remaining_samples_needed = output_buffer_length - values_output;
|
||||||
if (remaining_samples_needed <= samples_per_buffer*2 &&
|
if (remaining_samples_needed <= samples_per_buffer * 2 &&
|
||||||
remaining_samples_needed > samples_per_buffer) {
|
remaining_samples_needed > samples_per_buffer) {
|
||||||
// Adjust the DMA settings for the current buffer, which will be processed
|
// Adjust the DMA settings for the current buffer, which will be processed
|
||||||
// after the other buffer, which is now receiving samples via DMA.
|
// after the other buffer, which is now receiving samples via DMA.
|
||||||
@ -484,7 +486,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
|
|||||||
// Set up to receive the last set of samples (don't include the alternate buffer, now in use).
|
// Set up to receive the last set of samples (don't include the alternate buffer, now in use).
|
||||||
uint32_t samples_needed_for_last_buffer = remaining_samples_needed - samples_per_buffer;
|
uint32_t samples_needed_for_last_buffer = remaining_samples_needed - samples_per_buffer;
|
||||||
descriptor->BTCNT.reg = samples_needed_for_last_buffer * words_per_sample;
|
descriptor->BTCNT.reg = samples_needed_for_last_buffer * words_per_sample;
|
||||||
descriptor->DSTADDR.reg = ((uint32_t) buffer)
|
descriptor->DSTADDR.reg = ((uint32_t)buffer)
|
||||||
+ samples_needed_for_last_buffer * words_per_sample * sizeof(buffer[0]);
|
+ samples_needed_for_last_buffer * words_per_sample * sizeof(buffer[0]);
|
||||||
|
|
||||||
// Break chain to alternate buffer.
|
// Break chain to alternate buffer.
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "shared-bindings/audioio/AudioOut.h"
|
#include "shared-bindings/audioio/AudioOut.h"
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "atmel_start_pins.h"
|
#include "atmel_start_pins.h"
|
||||||
#include "hal/include/hal_gpio.h"
|
#include "hal/include/hal_gpio.h"
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "samd/sercom.h"
|
#include "samd/sercom.h"
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "common-hal/busio/__init__.h"
|
#include "common-hal/busio/__init__.h"
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "peripheral_clk_config.h"
|
#include "peripheral_clk_config.h"
|
||||||
|
|
||||||
#include "supervisor/board.h"
|
#include "supervisor/board.h"
|
||||||
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "common-hal/busio/__init__.h"
|
#include "common-hal/busio/__init__.h"
|
||||||
|
|
||||||
#include "hal/include/hal_gpio.h"
|
#include "hal/include/hal_gpio.h"
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "supervisor/shared/tick.h"
|
#include "supervisor/shared/tick.h"
|
||||||
|
|
||||||
#include "hpl_sercom_config.h"
|
#include "hpl_sercom_config.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "eic_handler.h"
|
#include "eic_handler.h"
|
||||||
#include "samd/external_interrupts.h"
|
#include "samd/external_interrupts.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
void common_hal_countio_counter_construct(countio_counter_obj_t *self,
|
void common_hal_countio_counter_construct(countio_counter_obj_t *self,
|
||||||
const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) {
|
const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) {
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
digitalinout_result_t common_hal_digitalio_digitalinout_construct(
|
digitalinout_result_t common_hal_digitalio_digitalinout_construct(
|
||||||
digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) {
|
digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) {
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/time/__init__.h"
|
#include "shared-bindings/time/__init__.h"
|
||||||
#include "supervisor/shared/tick.h"
|
#include "supervisor/shared/tick.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
#include "hpl/gclk/hpl_gclk_base.h"
|
#include "hpl/gclk/hpl_gclk_base.h"
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "atmel_start_pins.h"
|
#include "atmel_start_pins.h"
|
||||||
#include "hal/include/hal_gpio.h"
|
#include "hal/include/hal_gpio.h"
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/microcontroller/Processor.h"
|
#include "shared-bindings/microcontroller/Processor.h"
|
||||||
#include "supervisor/shared/safe_mode.h"
|
#include "supervisor/shared/safe_mode.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
void common_hal_mcu_delay_us(uint32_t delay) {
|
void common_hal_mcu_delay_us(uint32_t delay) {
|
||||||
mp_hal_delay_us(delay);
|
mp_hal_delay_us(delay);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/ps2io/Ps2.h"
|
#include "shared-bindings/ps2io/Ps2.h"
|
||||||
#include "supervisor/port.h"
|
#include "supervisor/port.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#define STATE_IDLE 0
|
#define STATE_IDLE 0
|
||||||
#define STATE_RECV 1
|
#define STATE_RECV 1
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/pulseio/PulseIn.h"
|
#include "shared-bindings/pulseio/PulseIn.h"
|
||||||
#include "supervisor/shared/tick.h"
|
#include "supervisor/shared/tick.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "supervisor/port.h"
|
#include "supervisor/port.h"
|
||||||
|
|
||||||
// This timer is shared amongst all PulseIn objects as a higher resolution clock.
|
// This timer is shared amongst all PulseIn objects as a higher resolution clock.
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "py/gc.h"
|
#include "py/gc.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "shared-bindings/pulseio/PulseOut.h"
|
#include "shared-bindings/pulseio/PulseOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "timer_handler.h"
|
#include "timer_handler.h"
|
||||||
|
|
||||||
// This timer is shared amongst all PulseOut objects under the assumption that
|
// This timer is shared amongst all PulseOut objects under the assumption that
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "hal/utils/include/utils_repeat_macro.h"
|
#include "hal/utils/include/utils_repeat_macro.h"
|
||||||
#include "samd/pins.h"
|
#include "samd/pins.h"
|
||||||
#include "samd/timers.h"
|
#include "samd/timers.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#undef ENABLE
|
#undef ENABLE
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "eic_handler.h"
|
#include "eic_handler.h"
|
||||||
#include "samd/external_interrupts.h"
|
#include "samd/external_interrupts.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t *self,
|
void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t *self,
|
||||||
const mcu_pin_obj_t *pin_a, const mcu_pin_obj_t *pin_b) {
|
const mcu_pin_obj_t *pin_a, const mcu_pin_obj_t *pin_b) {
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "shared-bindings/rtc/__init__.h"
|
#include "shared-bindings/rtc/__init__.h"
|
||||||
#include "shared-bindings/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/translate.h"
|
||||||
|
|
||||||
// This is the time in seconds since 2000 that the RTC was started.
|
// This is the time in seconds since 2000 that the RTC was started.
|
||||||
// TODO: Change the offset to ticks so that it can be a subsecond adjustment.
|
// TODO: Change the offset to ticks so that it can be a subsecond adjustment.
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "shared-bindings/sdioio/SDCard.h"
|
#include "shared-bindings/sdioio/SDCard.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "genhdr/sdiodata.h"
|
#include "genhdr/sdiodata.h"
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/touchio/TouchIn.h"
|
#include "shared-bindings/touchio/TouchIn.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
// Native touchio only exists for SAMD21
|
// Native touchio only exists for SAMD21
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
|
@ -78,6 +78,8 @@ endif
|
|||||||
SUPEROPT_GC = 0
|
SUPEROPT_GC = 0
|
||||||
SUPEROPT_VM = 0
|
SUPEROPT_VM = 0
|
||||||
|
|
||||||
|
CIRCUITPY_LTO = one
|
||||||
|
|
||||||
ifeq ($(CIRCUITPY_FULL_BUILD),0)
|
ifeq ($(CIRCUITPY_FULL_BUILD),0)
|
||||||
# On the smallest boards, this saves about 180 bytes. On other boards, it may -increase- space used.
|
# On the smallest boards, this saves about 180 bytes. On other boards, it may -increase- space used.
|
||||||
CFLAGS_BOARD = -fweb -frename-registers
|
CFLAGS_BOARD = -fweb -frename-registers
|
||||||
@ -94,6 +96,12 @@ ifeq ($(CHIP_FAMILY),samd51)
|
|||||||
# No native touchio on SAMD51.
|
# No native touchio on SAMD51.
|
||||||
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
|
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
|
||||||
|
|
||||||
|
ifeq ($(CIRCUITPY_FULL_BUILD),1)
|
||||||
|
CIRCUITPY_LTO ?= balanced
|
||||||
|
else
|
||||||
|
CIRCUITPY_LTO ?= one
|
||||||
|
endif
|
||||||
|
|
||||||
# The ?='s allow overriding in mpconfigboard.mk.
|
# The ?='s allow overriding in mpconfigboard.mk.
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "peripherals/broadcom/gpio.h"
|
#include "peripherals/broadcom/gpio.h"
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "supervisor/port.h"
|
#include "supervisor/port.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "peripherals/broadcom/cpu.h"
|
#include "peripherals/broadcom/cpu.h"
|
||||||
#include "peripherals/broadcom/defines.h"
|
#include "peripherals/broadcom/defines.h"
|
||||||
|
@ -165,8 +165,6 @@ else
|
|||||||
# RISC-V is larger than xtensa so do -Os for it
|
# RISC-V is larger than xtensa so do -Os for it
|
||||||
OPTIMIZATION_FLAGS ?= -Os
|
OPTIMIZATION_FLAGS ?= -Os
|
||||||
endif
|
endif
|
||||||
# TODO: Test with -flto
|
|
||||||
### CFLAGS += -flto
|
|
||||||
endif
|
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
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "shared-bindings/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/translate.h"
|
||||||
|
|
||||||
#include "components/driver/include/driver/adc_common.h"
|
#include "components/driver/include/driver/adc_common.h"
|
||||||
#include "components/esp_adc_cal/include/esp_adc_cal.h"
|
#include "components/esp_adc_cal/include/esp_adc_cal.h"
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/analogio/AnalogOut.h"
|
#include "shared-bindings/analogio/AnalogOut.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
||||||
#include "components/driver/include/driver/dac_common.h"
|
#include "components/driver/include/driver/dac_common.h"
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "shared-bindings/audiobusio/I2SOut.h"
|
#include "shared-bindings/audiobusio/I2SOut.h"
|
||||||
#include "shared-bindings/audiocore/RawSample.h"
|
#include "shared-bindings/audiocore/RawSample.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "driver/i2s.h"
|
#include "driver/i2s.h"
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
|
void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
|
||||||
const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) {
|
const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) {
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "supervisor/port.h"
|
#include "supervisor/port.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "supervisor/shared/tick.h"
|
#include "supervisor/shared/tick.h"
|
||||||
|
|
||||||
uint8_t never_reset_uart_mask = 0;
|
uint8_t never_reset_uart_mask = 0;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
void common_hal_countio_counter_construct(countio_counter_obj_t *self,
|
void common_hal_countio_counter_construct(countio_counter_obj_t *self,
|
||||||
const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) {
|
const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "components/driver/include/driver/gpio.h"
|
#include "components/driver/include/driver/gpio.h"
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "common-hal/microcontroller/Processor.h"
|
#include "common-hal/microcontroller/Processor.h"
|
||||||
#include "shared-bindings/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/translate.h"
|
||||||
|
|
||||||
#include "esp_sleep.h"
|
#include "esp_sleep.h"
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
|
@ -81,8 +81,6 @@ ifeq ($(DEBUG), 1)
|
|||||||
else
|
else
|
||||||
CFLAGS += -DNDEBUG -ggdb3
|
CFLAGS += -DNDEBUG -ggdb3
|
||||||
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
# TODO: Test with -flto
|
|
||||||
### CFLAGS += -flto
|
|
||||||
endif
|
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
|
||||||
@ -99,7 +97,7 @@ LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -W
|
|||||||
LIBS := -lgcc -lc
|
LIBS := -lgcc -lc
|
||||||
|
|
||||||
|
|
||||||
LDFLAGS += -flto -ffreestanding -nostartfiles -Wl,--gc-section -Wl,-Bstatic -Wl,-melf32lriscv -nostartfiles \
|
LDFLAGS += -ffreestanding -nostartfiles -Wl,--gc-section -Wl,-Bstatic -Wl,-melf32lriscv -nostartfiles \
|
||||||
-Wl,--no-warn-mismatch \
|
-Wl,--no-warn-mismatch \
|
||||||
-Wl,--build-id=none
|
-Wl,--build-id=none
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "csr.h"
|
#include "csr.h"
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "common-hal/microcontroller/Processor.h"
|
#include "common-hal/microcontroller/Processor.h"
|
||||||
#include "shared-bindings/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/translate.h"
|
||||||
|
|
||||||
#include "csr.h"
|
#include "csr.h"
|
||||||
#include "generated/soc.h"
|
#include "generated/soc.h"
|
||||||
|
@ -75,7 +75,7 @@ INC += \
|
|||||||
|
|
||||||
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
|
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
|
||||||
|
|
||||||
CFLAGS += -Os -ftree-vrp -DNDEBUG -ffreestanding
|
CFLAGS += -ftree-vrp -DNDEBUG
|
||||||
|
|
||||||
# TinyUSB defines
|
# TinyUSB defines
|
||||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024
|
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024
|
||||||
@ -84,12 +84,8 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_
|
|||||||
# Never set -fno-inline because we use inline to move small functions into routines that must be
|
# Never set -fno-inline because we use inline to move small functions into routines that must be
|
||||||
# in RAM. If inlining is disallowed, then we may end up calling a function in flash when we cannot.
|
# in RAM. If inlining is disallowed, then we may end up calling a function in flash when we cannot.
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
# You may want to disable -flto if it interferes with debugging.
|
|
||||||
# CFLAGS += -flto -flto-partition=none
|
|
||||||
# You may want to enable these flags to make setting breakpoints easier.
|
# You may want to enable these flags to make setting breakpoints easier.
|
||||||
CFLAGS += -fno-ipa-sra
|
CFLAGS += -fno-ipa-sra
|
||||||
else
|
|
||||||
#CFLAGS += -flto -flto-partition=none
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += $(INC) -ggdb -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
|
CFLAGS += $(INC) -ggdb -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
|
||||||
@ -105,7 +101,6 @@ CFLAGS += \
|
|||||||
-mfloat-abi=hard \
|
-mfloat-abi=hard \
|
||||||
-mfpu=fpv5-sp-d16 \
|
-mfpu=fpv5-sp-d16 \
|
||||||
-DCPU_$(CHIP_VARIANT) \
|
-DCPU_$(CHIP_VARIANT) \
|
||||||
-DDEBUG \
|
|
||||||
-DIMXRT10XX \
|
-DIMXRT10XX \
|
||||||
-g3 -Wno-unused-parameter \
|
-g3 -Wno-unused-parameter \
|
||||||
-ffunction-sections -fdata-sections -fstack-usage
|
-ffunction-sections -fdata-sections -fstack-usage
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/analogio/AnalogOut.h"
|
#include "shared-bindings/analogio/AnalogOut.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) {
|
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) {
|
||||||
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut);
|
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut);
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#define IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5 5U
|
#define IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5 5U
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/microcontroller/Processor.h"
|
#include "shared-bindings/microcontroller/Processor.h"
|
||||||
#include "supervisor/shared/safe_mode.h"
|
#include "supervisor/shared/safe_mode.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#define DBL_TAP_REG SNVS->LPGPR[3]
|
#define DBL_TAP_REG SNVS->LPGPR[3]
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "fsl_pwm.h"
|
#include "fsl_pwm.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "periph.h"
|
#include "periph.h"
|
||||||
|
|
||||||
// Debug print support set to zero to enable debug printing
|
// Debug print support set to zero to enable debug printing
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "shared-bindings/rtc/__init__.h"
|
#include "shared-bindings/rtc/__init__.h"
|
||||||
#include "shared-bindings/rtc/RTC.h"
|
#include "shared-bindings/rtc/RTC.h"
|
||||||
#include "common-hal/rtc/RTC.h"
|
#include "common-hal/rtc/RTC.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "fsl_snvs_hp.h"
|
#include "fsl_snvs_hp.h"
|
||||||
|
|
||||||
|
@ -84,14 +84,6 @@ INC += -I../../lib/mp-readline
|
|||||||
INC += -I../../lib/tinyusb/src
|
INC += -I../../lib/tinyusb/src
|
||||||
INC += -I../../supervisor/shared/usb
|
INC += -I../../supervisor/shared/usb
|
||||||
|
|
||||||
ifeq ($(MCU_CHIP),nrf52833)
|
|
||||||
OPTIMIZATION_FLAGS ?= -Os -flto -flto-partition=one
|
|
||||||
else
|
|
||||||
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
|
|
||||||
OPTIMIZATION_FLAGS ?= -Os -flto
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#Debugging/Optimization
|
#Debugging/Optimization
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
CFLAGS += -ggdb3
|
CFLAGS += -ggdb3
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "shared-bindings/analogio/AnalogIn.h"
|
#include "shared-bindings/analogio/AnalogIn.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "nrf_saadc.h"
|
#include "nrf_saadc.h"
|
||||||
#include "nrf_gpio.h"
|
#include "nrf_gpio.h"
|
||||||
@ -77,7 +77,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
|||||||
// Something else might have used the ADC in a different way,
|
// Something else might have used the ADC in a different way,
|
||||||
// so we completely re-initialize it.
|
// so we completely re-initialize it.
|
||||||
|
|
||||||
nrf_saadc_value_t value;
|
nrf_saadc_value_t value = -1;
|
||||||
|
|
||||||
const nrf_saadc_channel_config_t config = {
|
const nrf_saadc_channel_config_t config = {
|
||||||
.resistor_p = NRF_SAADC_RESISTOR_DISABLED,
|
.resistor_p = NRF_SAADC_RESISTOR_DISABLED,
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#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/translate.h"
|
||||||
|
|
||||||
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) {
|
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) {
|
||||||
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut);
|
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/tick.h"
|
#include "supervisor/shared/tick.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
// TODO: This should be the same size as PWMOut.c:pwms[], but there's no trivial way to accomplish that
|
// TODO: This should be the same size as PWMOut.c:pwms[], but there's no trivial way to accomplish that
|
||||||
STATIC audiopwmio_pwmaudioout_obj_t *active_audio[4];
|
STATIC audiopwmio_pwmaudioout_obj_t *active_audio[4];
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.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/translate.h"
|
||||||
|
|
||||||
#include "nrfx_twim.h"
|
#include "nrfx_twim.h"
|
||||||
#include "nrfx_spim.h"
|
#include "nrfx_spim.h"
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "nrfx_uarte.h"
|
#include "nrfx_uarte.h"
|
||||||
#include "nrf_gpio.h"
|
#include "nrf_gpio.h"
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "nrf_gpio.h"
|
#include "nrf_gpio.h"
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include "common-hal/alarm/__init__.h"
|
#include "common-hal/alarm/__init__.h"
|
||||||
#include "shared-bindings/microcontroller/ResetReason.h"
|
#include "shared-bindings/microcontroller/ResetReason.h"
|
||||||
#include "supervisor/shared/translate.h"
|
|
||||||
|
|
||||||
#include "nrfx_saadc.h"
|
#include "nrfx_saadc.h"
|
||||||
#ifdef BLUETOOTH_SD
|
#ifdef BLUETOOTH_SD
|
||||||
@ -72,7 +71,7 @@ uint32_t common_hal_mcu_processor_get_frequency(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float common_hal_mcu_processor_get_voltage(void) {
|
float common_hal_mcu_processor_get_voltage(void) {
|
||||||
nrf_saadc_value_t value;
|
nrf_saadc_value_t value = -1;
|
||||||
|
|
||||||
const nrf_saadc_channel_config_t config = {
|
const nrf_saadc_channel_config_t config = {
|
||||||
.resistor_p = NRF_SAADC_RESISTOR_DISABLED,
|
.resistor_p = NRF_SAADC_RESISTOR_DISABLED,
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "shared-bindings/pulseio/PulseOut.h"
|
#include "shared-bindings/pulseio/PulseOut.h"
|
||||||
#include "shared-bindings/pwmio/PWMOut.h"
|
#include "shared-bindings/pwmio/PWMOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
// A single timer is shared amongst all PulseOut objects under the assumption that
|
// A single timer is shared amongst all PulseOut objects under the assumption that
|
||||||
// the code is single threaded.
|
// the code is single threaded.
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "common-hal/pwmio/PWMOut.h"
|
#include "common-hal/pwmio/PWMOut.h"
|
||||||
#include "shared-bindings/pwmio/PWMOut.h"
|
#include "shared-bindings/pwmio/PWMOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "nrf_gpio.h"
|
#include "nrf_gpio.h"
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "common-hal/rtc/RTC.h"
|
#include "common-hal/rtc/RTC.h"
|
||||||
#include "shared-bindings/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/translate.h"
|
||||||
|
|
||||||
// This is the time in seconds since 2000 that the RTC was started.
|
// This is the time in seconds since 2000 that the RTC was started.
|
||||||
__attribute__((section(".uninitialized"))) static uint32_t rtc_offset[3];
|
__attribute__((section(".uninitialized"))) static uint32_t rtc_offset[3];
|
||||||
|
@ -71,6 +71,11 @@ NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
|
|||||||
# Defined here because system_nrf52840.c doesn't #include any of our own include files.
|
# Defined here because system_nrf52840.c doesn't #include any of our own include files.
|
||||||
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
|
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
|
||||||
|
|
||||||
|
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
|
||||||
|
OPTIMIZATION_FLAGS ?= -Os
|
||||||
|
CIRCUITPY_LTO=balanced
|
||||||
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
ifeq ($(MCU_CHIP),nrf52833)
|
ifeq ($(MCU_CHIP),nrf52833)
|
||||||
MCU_SERIES = m4
|
MCU_SERIES = m4
|
||||||
@ -87,5 +92,8 @@ SOFTDEV_VERSION ?= 7.0.1
|
|||||||
BOOT_SETTING_ADDR = 0x7F000
|
BOOT_SETTING_ADDR = 0x7F000
|
||||||
NRF_DEFINES += -DNRF52833_XXAA -DNRF52833
|
NRF_DEFINES += -DNRF52833_XXAA -DNRF52833
|
||||||
|
|
||||||
|
OPTIMIZATION_FLAGS ?= -Os
|
||||||
|
|
||||||
|
CIRCUITPY_LTO=one
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
#include "py/objproperty.h"
|
#include "py/objproperty.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
|
|
||||||
//| class StateMachine:
|
//| class StateMachine:
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "shared-bindings/analogio/AnalogIn.h"
|
#include "shared-bindings/analogio/AnalogIn.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "src/rp2_common/hardware_adc/include/hardware/adc.h"
|
#include "src/rp2_common/hardware_adc/include/hardware/adc.h"
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#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/translate.h"
|
||||||
|
|
||||||
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) {
|
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) {
|
||||||
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut);
|
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-module/audiocore/__init__.h"
|
#include "shared-module/audiocore/__init__.h"
|
||||||
#include "bindings/rp2pio/StateMachine.h"
|
#include "bindings/rp2pio/StateMachine.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
const uint16_t i2s_program[] = {
|
const uint16_t i2s_program[] = {
|
||||||
// ; Load the next set of samples
|
// ; Load the next set of samples
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "shared-bindings/audiobusio/PDMIn.h"
|
#include "shared-bindings/audiobusio/PDMIn.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "audio_dma.h"
|
#include "audio_dma.h"
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/microcontroller/Processor.h"
|
#include "shared-bindings/microcontroller/Processor.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "src/rp2040/hardware_structs/include/hardware/structs/dma.h"
|
#include "src/rp2040/hardware_structs/include/hardware/structs/dma.h"
|
||||||
#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h"
|
#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/mpstate.h"
|
#include "py/mpstate.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "shared-bindings/countio/Edge.h"
|
#include "shared-bindings/countio/Edge.h"
|
||||||
#include "shared-bindings/digitalio/Pull.h"
|
#include "shared-bindings/digitalio/Pull.h"
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
|
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "supervisor/filesystem.h"
|
#include "supervisor/filesystem.h"
|
||||||
#include "supervisor/port.h"
|
#include "supervisor/port.h"
|
||||||
#include "supervisor/shared/safe_mode.h"
|
#include "supervisor/shared/safe_mode.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "src/rp2040/hardware_structs/include/hardware/structs/sio.h"
|
#include "src/rp2040/hardware_structs/include/hardware/structs/sio.h"
|
||||||
#include "src/rp2_common/hardware_sync/include/hardware/sync.h"
|
#include "src/rp2_common/hardware_sync/include/hardware/sync.h"
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/pulseio/PulseIn.h"
|
#include "shared-bindings/pulseio/PulseIn.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "bindings/rp2pio/StateMachine.h"
|
#include "bindings/rp2pio/StateMachine.h"
|
||||||
#include "common-hal/pulseio/PulseIn.h"
|
#include "common-hal/pulseio/PulseIn.h"
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "shared-bindings/pwmio/PWMOut.h"
|
#include "shared-bindings/pwmio/PWMOut.h"
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "common-hal/pwmio/PWMOut.h"
|
#include "common-hal/pwmio/PWMOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "src/rp2040/hardware_structs/include/hardware/structs/pwm.h"
|
#include "src/rp2040/hardware_structs/include/hardware/structs/pwm.h"
|
||||||
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
|
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
|
||||||
#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h"
|
#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h"
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "shared-bindings/pwmio/PWMOut.h"
|
#include "shared-bindings/pwmio/PWMOut.h"
|
||||||
#include "shared-bindings/microcontroller/Processor.h"
|
#include "shared-bindings/microcontroller/Processor.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "src/rp2040/hardware_regs/include/hardware/platform_defs.h"
|
#include "src/rp2040/hardware_regs/include/hardware/platform_defs.h"
|
||||||
#include "src/rp2_common/hardware_clocks/include/hardware/clocks.h"
|
#include "src/rp2_common/hardware_clocks/include/hardware/clocks.h"
|
||||||
|
@ -88,8 +88,6 @@ else
|
|||||||
CFLAGS += -DNDEBUG
|
CFLAGS += -DNDEBUG
|
||||||
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||||
CFLAGS += -ggdb3
|
CFLAGS += -ggdb3
|
||||||
# TODO: Test with -flto
|
|
||||||
# CFLAGS += -flto
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "common-hal/analogio/AnalogIn.h"
|
#include "common-hal/analogio/AnalogIn.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/analogio/AnalogOut.h"
|
#include "shared-bindings/analogio/AnalogOut.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
|
||||||
// I2C timing specs for the H7 and F7
|
// I2C timing specs for the H7 and F7
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "supervisor/board.h"
|
#include "supervisor/board.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
|
||||||
// Note that any bugs introduced in this file can cause crashes at startup
|
// Note that any bugs introduced in this file can cause crashes at startup
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#define ALL_UARTS 0xFFFF
|
#define ALL_UARTS 0xFFFF
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
// The HAL is sparse on obtaining register information, so we use the LLs here.
|
// The HAL is sparse on obtaining register information, so we use the LLs here.
|
||||||
#if (CPY_STM32H7)
|
#if (CPY_STM32H7)
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "common-hal/microcontroller/Processor.h"
|
#include "common-hal/microcontroller/Processor.h"
|
||||||
#include "shared-bindings/microcontroller/ResetReason.h"
|
#include "shared-bindings/microcontroller/ResetReason.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include STM32_HAL_H
|
#include STM32_HAL_H
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "shared-bindings/pulseio/PulseOut.h"
|
#include "shared-bindings/pulseio/PulseOut.h"
|
||||||
#include "shared-bindings/pwmio/PWMOut.h"
|
#include "shared-bindings/pwmio/PWMOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include STM32_HAL_H
|
#include STM32_HAL_H
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "common-hal/pwmio/PWMOut.h"
|
#include "common-hal/pwmio/PWMOut.h"
|
||||||
#include "shared-bindings/pwmio/PWMOut.h"
|
#include "shared-bindings/pwmio/PWMOut.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include STM32_HAL_H
|
#include STM32_HAL_H
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/util.h"
|
#include "shared-bindings/util.h"
|
||||||
#include "supervisor/board.h"
|
#include "supervisor/board.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
#include "common-hal/microcontroller/Pin.h"
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "py/gc.h"
|
#include "py/gc.h"
|
||||||
#include "py/obj.h"
|
#include "py/obj.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#include "shared-bindings/microcontroller/__init__.h"
|
#include "shared-bindings/microcontroller/__init__.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "py/objint.h"
|
#include "py/objint.h"
|
||||||
#include "py/gc.h"
|
#include "py/gc.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* modffi uses character codes to encode a value type, based on "struct"
|
* modffi uses character codes to encode a value type, based on "struct"
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "extmod/machine_signal.h"
|
#include "extmod/machine_signal.h"
|
||||||
#include "extmod/machine_pulse.h"
|
#include "extmod/machine_pulse.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PLAT_DEV_MEM
|
#if MICROPY_PLAT_DEV_MEM
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
void mp_arg_check_num_sig(size_t n_args, size_t n_kw, uint32_t sig) {
|
void mp_arg_check_num_sig(size_t n_args, size_t n_kw, uint32_t sig) {
|
||||||
// TODO maybe take the function name as an argument so we can print nicer error messages
|
// TODO maybe take the function name as an argument so we can print nicer error messages
|
||||||
|
2
py/bc.c
2
py/bc.c
@ -33,7 +33,7 @@
|
|||||||
#include "py/bc0.h"
|
#include "py/bc0.h"
|
||||||
#include "py/bc.h"
|
#include "py/bc.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_DEBUG_VERBOSE // print debugging info
|
#if MICROPY_DEBUG_VERBOSE // print debugging info
|
||||||
#define DEBUG_PRINT (1)
|
#define DEBUG_PRINT (1)
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "py/objint.h"
|
#include "py/objint.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
// Helpers to work with binary-encoded data
|
// Helpers to work with binary-encoded data
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/builtin.h"
|
#include "py/builtin.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_BUILTINS_COMPILE
|
#if MICROPY_PY_BUILTINS_COMPILE
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include "py/mpconfig.h"
|
#include "py/mpconfig.h"
|
||||||
#include "py/objmodule.h"
|
#include "py/objmodule.h"
|
||||||
|
|
||||||
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_PY_BUILTINS_HELP
|
#if MICROPY_PY_BUILTINS_HELP
|
||||||
|
|
||||||
const char mp_help_default_text[] =
|
const char mp_help_default_text[] =
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#include "py/builtin.h"
|
#include "py/builtin.h"
|
||||||
#include "py/frozenmod.h"
|
#include "py/frozenmod.h"
|
||||||
|
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
#if MICROPY_DEBUG_VERBOSE // print debugging info
|
#if MICROPY_DEBUG_VERBOSE // print debugging info
|
||||||
#define DEBUG_PRINT (1)
|
#define DEBUG_PRINT (1)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user