Merge pull request #6440 from tannewt/translate_header

Switch translate() to the header file
This commit is contained in:
Dan Halbert 2022-06-05 23:50:47 -04:00 committed by GitHub
commit ac282b2a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
253 changed files with 1062 additions and 728 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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)) {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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
View File

@ -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"

View File

@ -67,7 +67,7 @@ SRC_C += \
shared/runtime/gchelper_generic.c \ shared/runtime/gchelper_generic.c \
supervisor/stub/safe_mode.c \ supervisor/stub/safe_mode.c \
supervisor/stub/stack.c \ supervisor/stub/stack.c \
supervisor/shared/translate.c supervisor/shared/translate/translate.c
# Add fmode when compiling with mingw gcc # Add fmode when compiling with mingw gcc
COMPILER_TARGET := $(shell $(CC) -dumpmachine) COMPILER_TARGET := $(shell $(CC) -dumpmachine)
@ -78,6 +78,6 @@ endif
OBJ = $(PY_CORE_O) OBJ = $(PY_CORE_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compression.generated.h
include $(TOP)/py/mkrules.mk include $(TOP)/py/mkrules.mk

View File

@ -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.
@ -277,6 +270,9 @@ SRC_ASF += \
hpl/oscctrl/hpl_oscctrl.c \ hpl/oscctrl/hpl_oscctrl.c \
hpl/trng/hpl_trng.c \ hpl/trng/hpl_trng.c \
# Ignore these errors
$(BUILD)/asf4/same54/hpl/sercom/hpl_sercom.o: CFLAGS += -Wno-maybe-uninitialized
else ifeq ($(CHIP_FAMILY), same51) else ifeq ($(CHIP_FAMILY), same51)
SRC_ASF += \ SRC_ASF += \
hal/src/hal_rand_sync.c \ hal/src/hal_rand_sync.c \

View File

@ -12,3 +12,5 @@ LONGINT_IMPL = MPZ
CIRCUITPY__EVE = 1 CIRCUITPY__EVE = 1
CIRCUITPY_CANIO = 1 CIRCUITPY_CANIO = 1
CIRCUITPY_LTO_PARTITION = one

View File

@ -10,6 +10,8 @@ QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ LONGINT_IMPL = MPZ
CIRCUITPY_LTO_PARTITION = one
CIRCUITPY_AESIO = 0 CIRCUITPY_AESIO = 0
CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_ONEWIREIO = 0
CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PARALLELDISPLAY = 0

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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,46 +80,48 @@ 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 #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
#ifdef SAM_D5X_E5X
if (clock_pin == &pin_PA10 || clock_pin == &pin_PB16) {
self->clock_unit = 0;
} else if (clock_pin == &pin_PB12
#if defined(PIN_PB28) && !defined(IGNORE_PIN_PB28)
|| data_pin == &pin_PB28) {
#else
) { ) {
#endif self->clock_unit = 0;
self->clock_unit = 1; #if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11)
} else if (clock_pin == &pin_PB11) {
self->clock_unit = 1;
#endif #endif
#else
#ifdef SAM_D5X_E5X
if (clock_pin == &pin_PA10 || clock_pin == &pin_PB16) {
self->clock_unit = 0;
} else if (clock_pin == &pin_PB12
#if defined(PIN_PB28) && !defined(IGNORE_PIN_PB28)
|| data_pin == &pin_PB28
#endif
) {
self->clock_unit = 1;
#endif
#endif
} else { } else {
raise_ValueError_invalid_pin_name(MP_QSTR_clock); raise_ValueError_invalid_pin_name(MP_QSTR_clock);
} }
@ -136,21 +138,21 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
#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 #else
#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
#endif
} else { } else {
raise_ValueError_invalid_pin_name(MP_QSTR_data); raise_ValueError_invalid_pin_name(MP_QSTR_data);
} }
@ -163,7 +165,8 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
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 { } else {
#ifdef SAMD21 #ifdef SAMD21
if ((I2S->CTRLA.vec.SEREN & (1 << self->serializer)) != 0) { if ((I2S->CTRLA.vec.SEREN & (1 << self->serializer)) != 0) {
@ -183,10 +186,10 @@ 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.
@ -202,9 +205,9 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
// 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
@ -241,11 +244,11 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
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 +267,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 +294,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 +317,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 +327,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 +344,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 +356,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 +383,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 +402,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 +447,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 +462,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 +474,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 +487,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.

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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) {

View File

@ -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) {

View File

@ -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"

View File

@ -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"

View File

@ -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);

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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.

View File

@ -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"

View File

@ -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

View File

@ -9,6 +9,7 @@ USB_NUM_ENDPOINT_PAIRS = 8
CIRCUITPY_ROTARYIO_SOFTENCODER = 1 CIRCUITPY_ROTARYIO_SOFTENCODER = 1
CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 1 CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 1
CIRCUITPY_LTO = 1
###################################################################### ######################################################################
# Put samd21-only choices here. # Put samd21-only choices here.
@ -78,6 +79,8 @@ endif
SUPEROPT_GC = 0 SUPEROPT_GC = 0
SUPEROPT_VM = 0 SUPEROPT_VM = 0
CIRCUITPY_LTO_PARTITION = 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 +97,10 @@ 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),0)
CIRCUITPY_LTO_PARTITION ?= one
endif
# The ?='s allow overriding in mpconfigboard.mk. # The ?='s allow overriding in mpconfigboard.mk.
@ -116,6 +123,10 @@ ifeq ($(CHIP_FAMILY),same51)
# No native touchio on SAME51. # No native touchio on SAME51.
CIRCUITPY_TOUCHIO_USE_NATIVE = 0 CIRCUITPY_TOUCHIO_USE_NATIVE = 0
ifeq ($(CIRCUITPY_FULL_BUILD),0)
CIRCUITPY_LTO_PARTITION ?= one
endif
# The ?='s allow overriding in mpconfigboard.mk. # The ?='s allow overriding in mpconfigboard.mk.
CIRCUITPY_ALARM ?= 1 CIRCUITPY_ALARM ?= 1

View File

@ -107,7 +107,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
# BCM CLFAGS # BCM CLFAGS
CFLAGS += -ffreestanding -nostartfiles -DMICROPY_HW_MCU_NAME="\"$(CHIP_VARIANT)\"" CFLAGS += -nostartfiles -DMICROPY_HW_MCU_NAME="\"$(CHIP_VARIANT)\""
OPTIMIZATION_FLAGS ?= -O3 OPTIMIZATION_FLAGS ?= -O3

View File

@ -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"

View File

@ -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"

View File

@ -3,6 +3,8 @@ USB_HIGHSPEED = 1
# Number of USB endpoint pairs. # Number of USB endpoint pairs.
USB_NUM_ENDPOINT_PAIRS = 6 USB_NUM_ENDPOINT_PAIRS = 6
CIRCUITPY_TRANSLATE_OBJECT = 1
# Longints can be implemented as mpz, as longlong, or not # Longints can be implemented as mpz, as longlong, or not
LONGINT_IMPL = MPZ LONGINT_IMPL = MPZ

View File

@ -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

View File

@ -6,9 +6,6 @@ USB_MANUFACTURER = "Adafruit"
IDF_TARGET = esp32s3 IDF_TARGET = esp32s3
# Make room for build
CIRCUITPY_ULAB = 0
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ LONGINT_IMPL = MPZ

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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) {

View File

@ -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;

View File

@ -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) {

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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,

View File

@ -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);

View File

@ -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];

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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,

View File

@ -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.

View File

@ -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"

View File

@ -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];

View File

@ -71,6 +71,12 @@ 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 = 1
CIRCUITPY_LTO_PARTITION = balanced
endif
else else
ifeq ($(MCU_CHIP),nrf52833) ifeq ($(MCU_CHIP),nrf52833)
MCU_SERIES = m4 MCU_SERIES = m4
@ -87,5 +93,9 @@ 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 = 1
CIRCUITPY_LTO_PARTITION = one
endif endif
endif endif

View File

@ -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:

View File

@ -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"

View File

@ -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);

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -233,7 +233,7 @@ SRC_C += \
supervisor/stub/filesystem.c \ supervisor/stub/filesystem.c \
supervisor/stub/safe_mode.c \ supervisor/stub/safe_mode.c \
supervisor/stub/stack.c \ supervisor/stub/stack.c \
supervisor/shared/translate.c \ supervisor/shared/translate/translate.c \
$(SRC_MOD) \ $(SRC_MOD) \
$(wildcard $(VARIANT_DIR)/*.c) $(wildcard $(VARIANT_DIR)/*.c)
@ -363,4 +363,4 @@ install: $(PROG)
uninstall: uninstall:
-rm $(BINDIR)/$(PROG) -rm $(BINDIR)/$(PROG)
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compression.generated.h

View File

@ -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"

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