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/UUID.h"
#include "supervisor/shared/tick.h"
#include "supervisor/shared/translate/translate.h"
STATIC uint16_t max_mtu = BT_ATT_DEFAULT_LE_MTU; // 23
STATIC unsigned long timeout = 5000;

View File

@ -33,6 +33,8 @@
#include "shared-bindings/supervisor/__init__.h"
#endif
#include "supervisor/shared/translate/translate.h"
#if MICROPY_PY_UASYNCIO
// Used when task cannot be guaranteed to be non-NULL.

View File

@ -11,6 +11,8 @@
#include "py/runtime.h"
#include "py/binary.h"
#include "supervisor/shared/translate/translate.h"
static void check_not_unicode(const mp_obj_t arg) {
#if MICROPY_CPYTHON_COMPAT
if (mp_obj_is_str(arg)) {

View File

@ -11,7 +11,7 @@
#include "py/objtuple.h"
#include "py/binary.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#if MICROPY_PY_UCTYPES

View File

@ -8,7 +8,7 @@
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#if MICROPY_PY_UHASHLIB

View File

@ -6,7 +6,7 @@
#include "py/objlist.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#if MICROPY_PY_UHEAPQ

View File

@ -13,7 +13,7 @@
#include "py/runtime.h"
#include "py/stream.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#if MICROPY_PY_UJSON

View File

@ -10,7 +10,7 @@
#include "py/runtime.h"
#include "py/smallint.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#if MICROPY_PY_UTIMEQ

View File

@ -10,7 +10,7 @@
#include "py/stream.h"
#include "py/mperrno.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#if MICROPY_PY_UZLIB

View File

@ -20,7 +20,7 @@
#include "extmod/vfs_fat.h"
#include "shared/timeutils/timeutils.h"
#include "supervisor/filesystem.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#if FF_MAX_SS == FF_MIN_SS
#define SECSIZE(fs) (FF_MIN_SS)

View File

@ -8,7 +8,7 @@
#include "py/runtime.h"
#include "py/stream.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)

2
main.c
View File

@ -58,7 +58,7 @@
#include "supervisor/shared/status_leds.h"
#include "supervisor/shared/tick.h"
#include "supervisor/shared/traceback.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "supervisor/shared/workflow.h"
#include "supervisor/usb.h"
#include "supervisor/workflow.h"

View File

@ -67,7 +67,7 @@ SRC_C += \
shared/runtime/gchelper_generic.c \
supervisor/stub/safe_mode.c \
supervisor/stub/stack.c \
supervisor/shared/translate.c
supervisor/shared/translate/translate.c
# Add fmode when compiling with mingw gcc
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
@ -78,6 +78,6 @@ endif
OBJ = $(PY_CORE_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

View File

@ -123,8 +123,6 @@ $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
#Debugging/Optimization
ifeq ($(DEBUG), 1)
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.
# CFLAGS += -fno-inline -fno-ipa-sra
ifeq ($(CHIP_FAMILY), samd21)
@ -147,11 +145,8 @@ else
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
endif
CFLAGS += -flto
ifeq ($(CIRCUITPY_FULL_BUILD),0)
CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20
CFLAGS += -flto-partition=one
endif
ifdef CFLAGS_BOARD
@ -168,8 +163,7 @@ CFLAGS += \
-mcpu=cortex-m0plus \
-msoft-float \
-mfloat-abi=soft \
-DSAMD21 \
-flto-partition=one
-DSAMD21
endif
ifeq ($(CHIP_FAMILY), samd51)
CFLAGS += \
@ -206,7 +200,6 @@ endif
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 += -flto=$(shell $(NPROC))
LIBS := -lgcc -lc
# Use toolchain libm if we're not using our own.
@ -277,6 +270,9 @@ SRC_ASF += \
hpl/oscctrl/hpl_oscctrl.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)
SRC_ASF += \
hal/src/hal_rand_sync.c \

View File

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

View File

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

View File

@ -35,7 +35,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/util.h"
#include "samd/timers.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "timer_handler.h"

View File

@ -37,7 +37,7 @@
#include "samd/adc.h"
#include "shared-bindings/analogio/AnalogIn.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "atmel_start_pins.h"
#include "hal/include/hal_adc_sync.h"

View File

@ -33,7 +33,7 @@
#include "shared-bindings/analogio/AnalogOut.h"
#include "shared-bindings/audioio/AudioOut.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "atmel_start_pins.h"
#include "hal/include/hal_dac_sync.h"

View File

@ -40,7 +40,7 @@
#include "shared-bindings/audiobusio/I2SOut.h"
#include "shared-bindings/audiocore/RawSample.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "atmel_start_pins.h"
#include "hal/include/hal_gpio.h"

View File

@ -37,7 +37,7 @@
#include "shared-bindings/audiobusio/PDMIn.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "atmel_start_pins.h"
#include "hal/include/hal_gpio.h"
@ -80,11 +80,13 @@ void pdmin_reset(void) {
pdmin_dma_block_done = false;
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->INTFLAG.reg = I2S_INTFLAG_MASK;
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;
}
@ -108,18 +110,18 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
} 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) {
#else
) {
|| data_pin == &pin_PB28
#endif
) {
self->clock_unit = 1;
#endif
#endif
} else {
raise_ValueError_invalid_pin_name(MP_QSTR_clock);
}
@ -136,8 +138,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
#endif
) {
self->serializer = 0;
}
else if (false
} else if (false
#if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08)
|| data_pin == &pin_PA08
#endif
@ -146,11 +147,12 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
#endif
) {
self->serializer = 1;
#endif
#else
#ifdef SAM_D5X_E5X
if (data_pin == &pin_PB10 || data_pin == &pin_PA22) {
self->serializer = 1;
#endif
#endif
} else {
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) {
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) {

View File

@ -35,7 +35,7 @@
#include "shared-bindings/audioio/AudioOut.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "atmel_start_pins.h"
#include "hal/include/hal_gpio.h"

View File

@ -35,7 +35,7 @@
#include "samd/sercom.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "common-hal/busio/__init__.h"

View File

@ -33,6 +33,7 @@
#include "peripheral_clk_config.h"
#include "supervisor/board.h"
#include "supervisor/shared/translate/translate.h"
#include "common-hal/busio/__init__.h"
#include "hal/include/hal_gpio.h"

View File

@ -34,7 +34,7 @@
#include "py/mperrno.h"
#include "py/runtime.h"
#include "py/stream.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "supervisor/shared/tick.h"
#include "hpl_sercom_config.h"

View File

@ -7,7 +7,7 @@
#include "eic_handler.h"
#include "samd/external_interrupts.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,
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 "shared-bindings/digitalio/DigitalInOut.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
digitalinout_result_t common_hal_digitalio_digitalinout_construct(
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/time/__init__.h"
#include "supervisor/shared/tick.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#ifdef SAMD21
#include "hpl/gclk/hpl_gclk_base.h"

View File

@ -27,6 +27,7 @@
#include "py/runtime.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate/translate.h"
#include "atmel_start_pins.h"
#include "hal/include/hal_gpio.h"

View File

@ -36,7 +36,7 @@
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Processor.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) {
mp_hal_delay_us(delay);

View File

@ -43,7 +43,7 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/ps2io/Ps2.h"
#include "supervisor/port.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#define STATE_IDLE 0
#define STATE_RECV 1

View File

@ -44,7 +44,7 @@
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/pulseio/PulseIn.h"
#include "supervisor/shared/tick.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "supervisor/port.h"
// 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/runtime.h"
#include "shared-bindings/pulseio/PulseOut.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "timer_handler.h"
// 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 "samd/pins.h"
#include "samd/timers.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#undef ENABLE

View File

@ -33,7 +33,7 @@
#include "eic_handler.h"
#include "samd/external_interrupts.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,
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/RTC.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.
// 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/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "genhdr/sdiodata.h"

View File

@ -33,7 +33,7 @@
#include "py/mphal.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/touchio/TouchIn.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
// Native touchio only exists for SAMD21
#ifdef SAMD21

View File

@ -9,6 +9,7 @@ USB_NUM_ENDPOINT_PAIRS = 8
CIRCUITPY_ROTARYIO_SOFTENCODER = 1
CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 1
CIRCUITPY_LTO = 1
######################################################################
# Put samd21-only choices here.
@ -78,6 +79,8 @@ endif
SUPEROPT_GC = 0
SUPEROPT_VM = 0
CIRCUITPY_LTO_PARTITION = one
ifeq ($(CIRCUITPY_FULL_BUILD),0)
# On the smallest boards, this saves about 180 bytes. On other boards, it may -increase- space used.
CFLAGS_BOARD = -fweb -frename-registers
@ -94,6 +97,10 @@ ifeq ($(CHIP_FAMILY),samd51)
# No native touchio on SAMD51.
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
ifeq ($(CIRCUITPY_FULL_BUILD),0)
CIRCUITPY_LTO_PARTITION ?= one
endif
# The ?='s allow overriding in mpconfigboard.mk.
@ -116,6 +123,10 @@ ifeq ($(CHIP_FAMILY),same51)
# No native touchio on SAME51.
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
ifeq ($(CIRCUITPY_FULL_BUILD),0)
CIRCUITPY_LTO_PARTITION ?= one
endif
# The ?='s allow overriding in mpconfigboard.mk.
CIRCUITPY_ALARM ?= 1

View File

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

View File

@ -32,7 +32,7 @@
#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "peripherals/broadcom/gpio.h"

View File

@ -35,7 +35,7 @@
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/port.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "peripherals/broadcom/cpu.h"
#include "peripherals/broadcom/defines.h"

View File

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

View File

@ -165,8 +165,6 @@ else
# RISC-V is larger than xtensa so do -Os for it
OPTIMIZATION_FLAGS ?= -Os
endif
# TODO: Test with -flto
### CFLAGS += -flto
endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk

View File

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

View File

@ -28,7 +28,7 @@
#include "shared-bindings/analogio/AnalogIn.h"
#include "py/mperrno.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/esp_adc_cal/include/esp_adc_cal.h"

View File

@ -33,7 +33,7 @@
#include "shared-bindings/analogio/AnalogOut.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#ifdef CONFIG_IDF_TARGET_ESP32S2
#include "components/driver/include/driver/dac_common.h"

View File

@ -42,7 +42,7 @@
#include "shared-bindings/audiobusio/I2SOut.h"
#include "shared-bindings/audiocore/RawSample.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "driver/i2s.h"

View File

@ -32,7 +32,7 @@
#include "shared-bindings/microcontroller/__init__.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,
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/stream.h"
#include "supervisor/port.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "supervisor/shared/tick.h"
uint8_t never_reset_uart_mask = 0;

View File

@ -29,7 +29,7 @@
#include "common-hal/microcontroller/Pin.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,
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 "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "components/driver/include/driver/gpio.h"

View File

@ -33,7 +33,7 @@
#include "common-hal/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/ResetReason.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "esp_sleep.h"
#include "esp_system.h"

View File

@ -81,8 +81,6 @@ ifeq ($(DEBUG), 1)
else
CFLAGS += -DNDEBUG -ggdb3
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
# TODO: Test with -flto
### CFLAGS += -flto
endif
# 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
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,--build-id=none

View File

@ -27,7 +27,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "csr.h"

View File

@ -31,7 +31,7 @@
#include "common-hal/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/ResetReason.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "csr.h"
#include "generated/soc.h"

View File

@ -75,7 +75,7 @@ INC += \
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
CFLAGS += -Os -ftree-vrp -DNDEBUG -ffreestanding
CFLAGS += -ftree-vrp -DNDEBUG
# 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
@ -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
# in RAM. If inlining is disallowed, then we may end up calling a function in flash when we cannot.
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.
CFLAGS += -fno-ipa-sra
else
#CFLAGS += -flto -flto-partition=none
endif
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 \
-mfpu=fpv5-sp-d16 \
-DCPU_$(CHIP_VARIANT) \
-DDEBUG \
-DIMXRT10XX \
-g3 -Wno-unused-parameter \
-ffunction-sections -fdata-sections -fstack-usage

View File

@ -29,7 +29,7 @@
#include "shared-bindings/analogio/AnalogOut.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) {
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut);

View File

@ -36,7 +36,7 @@
#include "shared-bindings/microcontroller/Pin.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

View File

@ -37,7 +37,7 @@
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Processor.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]

View File

@ -35,7 +35,7 @@
#include "fsl_pwm.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "periph.h"
// 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/RTC.h"
#include "common-hal/rtc/RTC.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "fsl_snvs_hp.h"

View File

@ -84,14 +84,6 @@ INC += -I../../lib/mp-readline
INC += -I../../lib/tinyusb/src
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
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3

View File

@ -29,7 +29,7 @@
#include "shared-bindings/analogio/AnalogIn.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "nrf_saadc.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,
// so we completely re-initialize it.
nrf_saadc_value_t value;
nrf_saadc_value_t value = -1;
const nrf_saadc_channel_config_t config = {
.resistor_p = NRF_SAADC_RESISTOR_DISABLED,

View File

@ -31,7 +31,7 @@
#include "py/mperrno.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) {
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/Pin.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
STATIC audiopwmio_pwmaudioout_obj_t *active_audio[4];

View File

@ -32,7 +32,7 @@
#include "shared-bindings/microcontroller/Pin.h"
#include "py/mperrno.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "nrfx_twim.h"
#include "nrfx_spim.h"

View File

@ -33,7 +33,7 @@
#include "py/mperrno.h"
#include "py/runtime.h"
#include "py/stream.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "nrfx_uarte.h"
#include "nrf_gpio.h"

View File

@ -26,7 +26,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "nrf_gpio.h"

View File

@ -31,7 +31,6 @@
#include "common-hal/alarm/__init__.h"
#include "shared-bindings/microcontroller/ResetReason.h"
#include "supervisor/shared/translate.h"
#include "nrfx_saadc.h"
#ifdef BLUETOOTH_SD
@ -72,7 +71,7 @@ uint32_t common_hal_mcu_processor_get_frequency(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 = {
.resistor_p = NRF_SAADC_RESISTOR_DISABLED,

View File

@ -35,7 +35,7 @@
#include "py/runtime.h"
#include "shared-bindings/pulseio/PulseOut.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
// the code is single threaded.

View File

@ -30,7 +30,7 @@
#include "py/runtime.h"
#include "common-hal/pwmio/PWMOut.h"
#include "shared-bindings/pwmio/PWMOut.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "nrf_gpio.h"

View File

@ -33,7 +33,7 @@
#include "common-hal/rtc/RTC.h"
#include "shared-bindings/rtc/RTC.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.
__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.
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
OPTIMIZATION_FLAGS ?= -Os
CIRCUITPY_LTO = 1
CIRCUITPY_LTO_PARTITION = balanced
endif
else
ifeq ($(MCU_CHIP),nrf52833)
MCU_SERIES = m4
@ -87,5 +93,9 @@ SOFTDEV_VERSION ?= 7.0.1
BOOT_SETTING_ADDR = 0x7F000
NRF_DEFINES += -DNRF52833_XXAA -DNRF52833
OPTIMIZATION_FLAGS ?= -Os
CIRCUITPY_LTO = 1
CIRCUITPY_LTO_PARTITION = one
endif
endif

View File

@ -40,7 +40,7 @@
#include "py/mperrno.h"
#include "py/objproperty.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
//| class StateMachine:

View File

@ -28,7 +28,7 @@
#include "shared-bindings/analogio/AnalogIn.h"
#include "shared-bindings/microcontroller/Pin.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"

View File

@ -31,7 +31,7 @@
#include "py/mperrno.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) {
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut);

View File

@ -37,7 +37,7 @@
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-module/audiocore/__init__.h"
#include "bindings/rp2pio/StateMachine.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
const uint16_t i2s_program[] = {
// ; Load the next set of samples

View File

@ -32,7 +32,7 @@
#include "py/runtime.h"
#include "shared-bindings/audiobusio/PDMIn.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "audio_dma.h"

View File

@ -39,7 +39,7 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.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/rp2_common/hardware_pwm/include/hardware/pwm.h"

View File

@ -2,7 +2,7 @@
#include "py/runtime.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/digitalio/Pull.h"

View File

@ -32,7 +32,7 @@
#include "common-hal/microcontroller/Pin.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"

View File

@ -38,7 +38,7 @@
#include "supervisor/filesystem.h"
#include "supervisor/port.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/rp2_common/hardware_sync/include/hardware/sync.h"

View File

@ -32,7 +32,7 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/pulseio/PulseIn.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "bindings/rp2pio/StateMachine.h"
#include "common-hal/pulseio/PulseIn.h"

View File

@ -33,7 +33,7 @@
#include "shared-bindings/pwmio/PWMOut.h"
#include "shared-bindings/microcontroller/__init__.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/rp2_common/hardware_gpio/include/hardware/gpio.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/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/rp2_common/hardware_clocks/include/hardware/clocks.h"

View File

@ -88,8 +88,6 @@ else
CFLAGS += -DNDEBUG
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
CFLAGS += -ggdb3
# TODO: Test with -flto
# CFLAGS += -flto
endif
# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk

View File

@ -27,7 +27,7 @@
#include "common-hal/analogio/AnalogIn.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "shared-bindings/microcontroller/Pin.h"

View File

@ -33,7 +33,7 @@
#include "shared-bindings/analogio/AnalogOut.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "common-hal/microcontroller/Pin.h"

View File

@ -31,7 +31,7 @@
#include "py/runtime.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "shared-bindings/microcontroller/Pin.h"
// I2C timing specs for the H7 and F7

View File

@ -33,7 +33,7 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/board.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "shared-bindings/microcontroller/Pin.h"
// 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/runtime.h"
#include "py/stream.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#define ALL_UARTS 0xFFFF

View File

@ -28,7 +28,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/microcontroller/Pin.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.
#if (CPY_STM32H7)

View File

@ -32,7 +32,7 @@
#endif
#include "common-hal/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/ResetReason.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include STM32_HAL_H

View File

@ -33,7 +33,7 @@
#include "py/runtime.h"
#include "shared-bindings/pulseio/PulseOut.h"
#include "shared-bindings/pwmio/PWMOut.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include STM32_HAL_H
#include "shared-bindings/microcontroller/Pin.h"

View File

@ -29,7 +29,7 @@
#include "py/runtime.h"
#include "common-hal/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 STM32_HAL_H

View File

@ -32,7 +32,7 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/util.h"
#include "supervisor/board.h"
#include "supervisor/shared/translate.h"
#include "supervisor/shared/translate/translate.h"
#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Pin.h"

View File

@ -29,7 +29,7 @@
#include "py/gc.h"
#include "py/obj.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/Pin.h"

View File

@ -233,7 +233,7 @@ SRC_C += \
supervisor/stub/filesystem.c \
supervisor/stub/safe_mode.c \
supervisor/stub/stack.c \
supervisor/shared/translate.c \
supervisor/shared/translate/translate.c \
$(SRC_MOD) \
$(wildcard $(VARIANT_DIR)/*.c)
@ -363,4 +363,4 @@ install: $(PROG)
uninstall:
-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/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"

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