This commit is contained in:
Dan Halbert 2023-08-03 23:29:00 -04:00
parent 0d4bc8c163
commit 465d1c673e
18 changed files with 71 additions and 283 deletions

View File

@ -124,7 +124,6 @@ static void check_not_unicode(const mp_obj_t arg) {
#endif #endif
} }
#if MICROPY_PY_UHASHLIB_SHA256
#include "lib/crypto-algorithms/sha256.c" #include "lib/crypto-algorithms/sha256.c"
STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {

View File

@ -3,12 +3,7 @@
* *
* The MIT License (MIT) * The MIT License (MIT)
* *
<<<<<<<< HEAD:ports/espressif/common-hal/hashlib/Hash.c
* Copyright (c) 2022 Scott Shawcroft for Adafruit Industries * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries
========
* Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2022 Renesas Electronics Corporation
>>>>>>>> v1.19.1:ports/renesas-ra/moduos.c
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -29,7 +24,6 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
<<<<<<<< HEAD:ports/espressif/common-hal/hashlib/Hash.c
#include "shared-bindings/hashlib/Hash.h" #include "shared-bindings/hashlib/Hash.h"
#include "components/mbedtls/mbedtls/include/mbedtls/ssl.h" #include "components/mbedtls/mbedtls/include/mbedtls/ssl.h"
@ -60,40 +54,4 @@ size_t common_hal_hashlib_hash_get_digest_size(hashlib_hash_obj_t *self) {
return 20; return 20;
} }
return 0; return 0;
========
#include "py/runtime.h"
#include "uart.h"
#if MICROPY_VFS_FAT
#include "lib/oofatfs/ff.h"
#include "lib/oofatfs/diskio.h"
#endif
// sync()
// Sync all filesystems.
STATIC mp_obj_t mp_uos_sync(void) {
#if MICROPY_VFS_FAT
for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) {
// this assumes that vfs->obj is fs_user_mount_t with block device functions
disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL);
}
#endif
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_sync_obj, mp_uos_sync);
bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream) {
const mp_obj_type_t *type = mp_obj_get_type(stream);
return type == &machine_uart_type;
}
void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) {
if (mp_obj_get_type(stream_detached) == &machine_uart_type) {
uart_attach_to_repl(MP_OBJ_TO_PTR(stream_detached), false);
}
if (mp_obj_get_type(stream_attached) == &machine_uart_type) {
uart_attach_to_repl(MP_OBJ_TO_PTR(stream_attached), true);
}
>>>>>>>> v1.19.1:ports/renesas-ra/moduos.c
} }

View File

@ -30,13 +30,5 @@
#include "py/mphal.h" #include "py/mphal.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
<<<<<<<< HEAD:ports/raspberrypi/common-hal/board/__init__.c
// Pins aren't actually defined here. They are in the board specific directory // Pins aren't actually defined here. They are in the board specific directory
// such as boards/arduino_zero/pins.c. // such as boards/arduino_zero/pins.c.
========
int allocate_dma_channel(void);
void free_dma_channel(int n);
void dma_init(void);
#endif // MICROPY_INCLUDED_MIMXRT_DMACHANNEL_H
>>>>>>>> v1.19.1:ports/raspberrypi/dma_manager.h

View File

@ -81,13 +81,9 @@
#define MBEDTLS_BIGNUM_C #define MBEDTLS_BIGNUM_C
#define MBEDTLS_CIPHER_C #define MBEDTLS_CIPHER_C
#define MBEDTLS_CTR_DRBG_C #define MBEDTLS_CTR_DRBG_C
<<<<<<<< HEAD:ports/raspberrypi/mbedtls/mbedtls_config.h
#define MBEDTLS_ECDH_C #define MBEDTLS_ECDH_C
#define MBEDTLS_ECDSA_C #define MBEDTLS_ECDSA_C
#define MBEDTLS_ECP_C #define MBEDTLS_ECP_C
========
// #define MBEDTLS_ECP_C
>>>>>>>> v1.19.1:ports/stm32/mbedtls/mbedtls_config.h
#define MBEDTLS_ENTROPY_C #define MBEDTLS_ENTROPY_C
#define MBEDTLS_ERROR_C #define MBEDTLS_ERROR_C
#define MBEDTLS_GCM_C #define MBEDTLS_GCM_C

View File

@ -3,11 +3,7 @@
* *
* The MIT License (MIT) * The MIT License (MIT)
* *
<<<<<<<< HEAD:ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries * Copyright (c) 2020 Lucian Copeland for Adafruit Industries
========
* Copyright (c) 2022 Arduino SA
>>>>>>>> v1.19.1:ports/stm/boards/ARDUINO_PORTENTA_H7/bdev.c
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -28,7 +24,6 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
<<<<<<<< HEAD:ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
// Chip: STM32F411 // Chip: STM32F411
@ -70,24 +65,3 @@
#ifndef BOARD_HSE_SOURCE #ifndef BOARD_HSE_SOURCE
#define BOARD_HSE_SOURCE (RCC_HSE_ON) #define BOARD_HSE_SOURCE (RCC_HSE_ON)
#endif #endif
========
#include "storage.h"
#include "qspi.h"
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
// Shared cache for first and second SPI block devices
STATIC mp_spiflash_cache_t spi_bdev_cache;
#endif
// First external SPI flash uses hardware QSPI interface
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_QSPI,
.bus.u_qspi.data = NULL,
.bus.u_qspi.proto = &qspi_proto,
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
.cache = &spi_bdev_cache,
#endif
};
spi_bdev_t spi_bdev;
>>>>>>>> v1.19.1:ports/stm/boards/ARDUINO_PORTENTA_H7/bdev.c

View File

@ -3,11 +3,7 @@
* *
* The MIT License (MIT) * The MIT License (MIT)
* *
<<<<<<<< HEAD:ports/stm/peripherals/stm32f4/stm32f412cx/clocks.h
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries * Copyright (c) 2020 Lucian Copeland for Adafruit Industries
========
* Copyright (c) 2013, 2014 Damien P. George
>>>>>>>> v1.19.1:ports/renesas-ra/gccollect.c
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -28,7 +24,6 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
<<<<<<<< HEAD:ports/stm/peripherals/stm32f4/stm32f412cx/clocks.h
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
// Chip: STM32F412Cx // Chip: STM32F412Cx
@ -69,50 +64,3 @@
#ifndef BOARD_HSE_SOURCE #ifndef BOARD_HSE_SOURCE
#define BOARD_HSE_SOURCE (RCC_HSE_ON) #define BOARD_HSE_SOURCE (RCC_HSE_ON)
#endif #endif
========
#include <stdio.h>
#include <stdint.h>
#include "py/mpstate.h"
#include "py/gc.h"
#include "py/mpthread.h"
#include "shared/runtime/gchelper.h"
#include "gccollect.h"
#include "softtimer.h"
#include "systick.h"
void gc_collect(void) {
// get current time, in case we want to time the GC
#if 0
uint32_t start = mp_hal_ticks_us();
#endif
// start the GC
gc_collect_start();
// trace the stack and registers
gc_helper_collect_regs_and_stack();
// trace root pointers from any threads
#if MICROPY_PY_THREAD
mp_thread_gc_others();
#endif
// trace soft timer nodes
soft_timer_gc_mark_all();
// end the GC
gc_collect_end();
#if 0
// print GC info
uint32_t ticks = mp_hal_ticks_us() - start;
gc_info_t info;
gc_info(&info);
printf("GC@%lu %lums\n", start, ticks);
printf(" " UINT_FMT " total\n", info.total);
printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free);
printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block);
#endif
}
>>>>>>>> v1.19.1:ports/renesas-ra/gccollect.c

View File

@ -55,6 +55,16 @@ extern void common_hal_mcu_enable_interrupts(void);
#define MICROPY_BEGIN_ATOMIC_SECTION() (common_hal_mcu_disable_interrupts(), 0) #define MICROPY_BEGIN_ATOMIC_SECTION() (common_hal_mcu_disable_interrupts(), 0)
#define MICROPY_END_ATOMIC_SECTION(state) ((void)state, common_hal_mcu_enable_interrupts()) #define MICROPY_END_ATOMIC_SECTION(state) ((void)state, common_hal_mcu_enable_interrupts())
// MicroPython-only options not used by CircuitPython, but present in various files
// inherited from MicroPython, especially in extmod/
#define MICROPY_ENABLE_DYNRUNTIME (0)
#define MICROPY_PY_BLUETOOTH (0)
#define MICROPY_PY_LWIP_SLIP (0)
#define MICROPY_PY_OS_DUPTERM (0)
#define MICROPY_ROM_TEXT_COMPRESSION (0)
#define MICROPY_VFS_LFS1 (0)
#define MICROPY_VFS_LFS2 (0)
// Sorted alphabetically for easy finding. // Sorted alphabetically for easy finding.
// //
// default is 128; consider raising to reduce fragmentation. // default is 128; consider raising to reduce fragmentation.
@ -73,6 +83,7 @@ extern void common_hal_mcu_enable_interrupts(void);
#define MICROPY_ENABLE_DOC_STRING (0) #define MICROPY_ENABLE_DOC_STRING (0)
#define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_GC (1)
#define MICROPY_ENABLE_PYSTACK (1)
#define MICROPY_TRACKED_ALLOC (CIRCUITPY_SSL_MBEDTLS) #define MICROPY_TRACKED_ALLOC (CIRCUITPY_SSL_MBEDTLS)
#define MICROPY_ENABLE_SOURCE_LINE (1) #define MICROPY_ENABLE_SOURCE_LINE (1)
#define MICROPY_EPOCH_IS_1970 (1) #define MICROPY_EPOCH_IS_1970 (1)
@ -96,7 +107,6 @@ extern void common_hal_mcu_enable_interrupts(void);
#define MICROPY_PY_ARRAY (CIRCUITPY_ARRAY) #define MICROPY_PY_ARRAY (CIRCUITPY_ARRAY)
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
#define MICROPY_PY_ATTRTUPLE (1) #define MICROPY_PY_ATTRTUPLE (1)
#define MICROPY_PY_BUILTINS_BYTEARRAY (1) #define MICROPY_PY_BUILTINS_BYTEARRAY (1)
#define MICROPY_PY_BUILTINS_ENUMERATE (1) #define MICROPY_PY_BUILTINS_ENUMERATE (1)
#define MICROPY_PY_BUILTINS_FILTER (1) #define MICROPY_PY_BUILTINS_FILTER (1)
@ -144,7 +154,6 @@ extern void common_hal_mcu_enable_interrupts(void);
#define MICROPY_QSTR_BYTES_IN_HASH (1) #define MICROPY_QSTR_BYTES_IN_HASH (1)
#define MICROPY_REPL_AUTO_INDENT (1) #define MICROPY_REPL_AUTO_INDENT (1)
#define MICROPY_REPL_EVENT_DRIVEN (0) #define MICROPY_REPL_EVENT_DRIVEN (0)
#define MICROPY_ENABLE_PYSTACK (1)
#define CIRCUITPY_SETTABLE_PYSTACK (1) #define CIRCUITPY_SETTABLE_PYSTACK (1)
#define MICROPY_STACK_CHECK (1) #define MICROPY_STACK_CHECK (1)
#define MICROPY_STREAMS_NON_BLOCK (1) #define MICROPY_STREAMS_NON_BLOCK (1)

View File

@ -45,6 +45,9 @@ CFLAGS += -DCIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE=$(CIRCUITPY_OPTIMIZE_PROPERTY
MICROPY_PY_ASYNC_AWAIT ?= $(CIRCUITPY_FULL_BUILD) MICROPY_PY_ASYNC_AWAIT ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DMICROPY_PY_ASYNC_AWAIT=$(MICROPY_PY_ASYNC_AWAIT) CFLAGS += -DMICROPY_PY_ASYNC_AWAIT=$(MICROPY_PY_ASYNC_AWAIT)
# unused by CIRCUITPYTHON
MICROPY_ROM_TEXT_COMPRESSION = 0
# uasyncio # uasyncio
# By default, include uasyncio if async/await are available. # By default, include uasyncio if async/await are available.
MICROPY_PY_UASYNCIO ?= $(MICROPY_PY_ASYNC_AWAIT) MICROPY_PY_UASYNCIO ?= $(MICROPY_PY_ASYNC_AWAIT)

View File

@ -60,6 +60,7 @@ _MODE_QSTR = "qstr"
# Extract MP_COMPRESSED_ROM_TEXT("") macros. (Which come from MP_ERROR_TEXT) # Extract MP_COMPRESSED_ROM_TEXT("") macros. (Which come from MP_ERROR_TEXT)
_MODE_COMPRESS = "compress" _MODE_COMPRESS = "compress"
# Extract MP_REGISTER_MODULE(...) macros. # Extract MP_REGISTER_MODULE(...) macros.
_MODE_MODULE = "module" _MODE_MODULE = "module"
@ -120,7 +121,6 @@ def write_out(fname, output):
with open(args.output_dir + "/" + fname + "." + args.mode, "w") as f: with open(args.output_dir + "/" + fname + "." + args.mode, "w") as f:
f.write("\n".join(output) + "\n") f.write("\n".join(output) + "\n")
def qstr_unescape(qstr): def qstr_unescape(qstr):
for name in name2codepoint: for name in name2codepoint:
if "__" + name + "__" in qstr: if "__" + name + "__" in qstr:
@ -131,12 +131,16 @@ def qstr_unescape(qstr):
def process_file(f): def process_file(f):
re_line = re.compile(r"#[line]*\s(\d+)\s\"([^\"]+)\"") re_line = re.compile(r"#[line]*\s\d+\s\"([^\"]+)\"")
re_qstr = re.compile(r"MP_QSTR_[_a-zA-Z0-9]+") if args.mode == _MODE_QSTR:
re_match = re.compile(r"MP_QSTR_[_a-zA-Z0-9]+")
elif args.mode == _MODE_COMPRESS:
re_match = re.compile(r'MP_COMPRESSED_ROM_TEXT\("([^"]*)"\)')
elif args.mode == _MODE_MODULE:
re_match = re.compile(r"MP_REGISTER_MODULE\(.*?,\s*.*?\);")
re_translate = re.compile(r"translate\(\"((?:(?=(\\?))\2.)*?)\"\)") re_translate = re.compile(r"translate\(\"((?:(?=(\\?))\2.)*?)\"\)")
output = [] output = []
last_fname = None last_fname = None
lineno = 0
for line in f: for line in f:
if line.isspace(): if line.isspace():
continue continue
@ -144,8 +148,7 @@ def process_file(f):
if line.startswith(("# ", "#line")): if line.startswith(("# ", "#line")):
m = re_line.match(line) m = re_line.match(line)
assert m is not None assert m is not None
lineno = int(m.group(1)) fname = m.group(1)
fname = m.group(2)
if os.path.splitext(fname)[1] not in [".c", ".cpp"]: if os.path.splitext(fname)[1] not in [".c", ".cpp"]:
continue continue
if fname != last_fname: if fname != last_fname:
@ -153,13 +156,16 @@ def process_file(f):
output = [] output = []
last_fname = fname last_fname = fname
continue continue
for match in re_qstr.findall(line): for match in re_match.findall(line):
name = match.replace("MP_QSTR_", "") if args.mode == _MODE_QSTR:
if name not in QSTRING_BLOCK_LIST: name = match.replace("MP_QSTR_", "")
output.append("Q(" + qstr_unescape(name) + ")") if name not in QSTRING_BLOCK_LIST:
output.append("Q(" + qstr_unescape(name) + ")")
elif args.mode in (_MODE_COMPRESS, _MODE_MODULE):
output.append(match)
for match in re_translate.findall(line): for match in re_translate.findall(line):
output.append('TRANSLATE("' + match[0] + '")') output.append('TRANSLATE("' + match[0] + '")')
lineno += 1
if last_fname: if last_fname:
write_out(last_fname, output) write_out(last_fname, output)

View File

@ -97,6 +97,8 @@ def make_version_header(filename):
#define MICROPY_VERSION_MINOR (%s) #define MICROPY_VERSION_MINOR (%s)
#define MICROPY_VERSION_MICRO (%s) #define MICROPY_VERSION_MICRO (%s)
#define MICROPY_VERSION_STRING "%s" #define MICROPY_VERSION_STRING "%s"
// Combined version as a 32-bit number for convenience
#define MICROPY_VERSION (MICROPY_VERSION_MAJOR << 16 | MICROPY_VERSION_MINOR << 8 | MICROPY_VERSION_MICRO)
#define MICROPY_FULL_VERSION_INFO "Adafruit CircuitPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME #define MICROPY_FULL_VERSION_INFO "Adafruit CircuitPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME
""" % ( """ % (
git_tag, git_tag,

View File

@ -26,6 +26,8 @@
#ifndef MICROPY_INCLUDED_PY_MPCONFIG_H #ifndef MICROPY_INCLUDED_PY_MPCONFIG_H
#define MICROPY_INCLUDED_PY_MPCONFIG_H #define MICROPY_INCLUDED_PY_MPCONFIG_H
// In CircuitPython, this is defined in genghdr/mpversion.h
#if !CIRCUITPY
// Current version of MicroPython // Current version of MicroPython
#define MICROPY_VERSION_MAJOR 1 #define MICROPY_VERSION_MAJOR 1
#define MICROPY_VERSION_MINOR 19 #define MICROPY_VERSION_MINOR 19
@ -42,6 +44,8 @@
MP_STRINGIFY(MICROPY_VERSION_MAJOR) "." \ MP_STRINGIFY(MICROPY_VERSION_MAJOR) "." \
MP_STRINGIFY(MICROPY_VERSION_MINOR) "." \ MP_STRINGIFY(MICROPY_VERSION_MINOR) "." \
MP_STRINGIFY(MICROPY_VERSION_MICRO) MP_STRINGIFY(MICROPY_VERSION_MICRO)
#endif
// This file contains default configuration settings for MicroPython. // This file contains default configuration settings for MicroPython.
// You can override any of the options below using mpconfigport.h file // You can override any of the options below using mpconfigport.h file

View File

@ -34,9 +34,6 @@
#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/translate/translate.h"
// type check is done on getiter method to allow tuple, namedtuple, attrtuple
#define mp_obj_is_tuple_compatible(o) (mp_obj_get_type(o)->getiter == mp_obj_tuple_getiter)
/******************************************************************************/ /******************************************************************************/
/* tuple */ /* tuple */

View File

@ -645,11 +645,17 @@ STATIC MP_DEFINE_CONST_MAP(mp_constants_map, mp_constants_table);
STATIC void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args); STATIC void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args);
#if MICROPY_COMP_CONST_FOLDING #if MICROPY_COMP_CONST_FOLDING
// CIRCUITPY: The compilers mentioned below are esp-2020r3. We are using minimum esp-2021r3 (ESP-IDF v4.4).
// See https://github.com/micropython/micropython/commit/f63b4f85aae1e0ade7a7c9f908debb5905cc144d
// and https://github.com/espressif/esp-idf/issues/9130
// So disable this for CircuitPython.
/*
#if MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND #if MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND
// Some versions of the xtensa-esp32-elf-gcc compiler generate wrong code if this // Some versions of the xtensa-esp32-elf-gcc compiler generate wrong code if this
// function is static, so provide a hook for them to work around this problem. // function is static, so provide a hook for them to work around this problem.
MP_NOINLINE MP_NOINLINE
#endif #endif
*/
STATIC bool fold_logical_constants(parser_t *parser, uint8_t rule_id, size_t *num_args) { STATIC bool fold_logical_constants(parser_t *parser, uint8_t rule_id, size_t *num_args) {
if (rule_id == RULE_or_test if (rule_id == RULE_or_test
|| rule_id == RULE_and_test) { || rule_id == RULE_and_test) {

View File

@ -197,7 +197,6 @@ PY_EXTMOD_O_BASENAME = \
extmod/modubinascii.o \ extmod/modubinascii.o \
extmod/modurandom.o \ extmod/modurandom.o \
extmod/moduselect.o \ extmod/moduselect.o \
extmod/modframebuf.o \
extmod/vfs.o \ extmod/vfs.o \
extmod/vfs_blockdev.o \ extmod/vfs_blockdev.o \
extmod/vfs_reader.o \ extmod/vfs_reader.o \

View File

@ -24,19 +24,12 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
<<<<<<< HEAD:shared-module/keypad/EventQueue.h
#ifndef MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H #ifndef MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H
#define MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H #define MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H
=======
#include "mpconfigport.h"
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE)
>>>>>>> v1.19.1:ports/rp2/tusb_config.h
#include "py/obj.h" #include "py/obj.h"
#include "py/ringbuf.h" #include "py/ringbuf.h"
<<<<<<< HEAD:shared-module/keypad/EventQueue.h
typedef struct _keypad_eventqueue_obj_t { typedef struct _keypad_eventqueue_obj_t {
mp_obj_base_t base; mp_obj_base_t base;
ringbuf_t encoded_events; ringbuf_t encoded_events;
@ -46,13 +39,3 @@ typedef struct _keypad_eventqueue_obj_t {
bool keypad_eventqueue_record(keypad_eventqueue_obj_t *self, mp_uint_t key_number, bool pressed, mp_obj_t timestamp); bool keypad_eventqueue_record(keypad_eventqueue_obj_t *self, mp_uint_t key_number, bool pressed, mp_obj_t timestamp);
#endif // MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H #endif // MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H
=======
#if MICROPY_HW_USB_MSC
// Board and hardware specific configuration
#define CFG_TUD_MSC (1)
// Set MSC EP buffer size to FatFS block size to avoid partial read/writes (offset arg).
#define CFG_TUD_MSC_BUFSIZE (MICROPY_FATFS_MAX_SS)
#endif
#endif // MICROPY_INCLUDED_RP2_TUSB_CONFIG_H
>>>>>>> v1.19.1:ports/rp2/tusb_config.h

View File

@ -45,7 +45,6 @@ typedef struct {
bool in_cmd25; bool in_cmd25;
} sdcardio_sdcard_obj_t; } sdcardio_sdcard_obj_t;
<<<<<<< HEAD:shared-module/sdcardio/SDCard.h
void common_hal_sdcardio_sdcard_construct(sdcardio_sdcard_obj_t *self, busio_spi_obj_t *spi, const mcu_pin_obj_t *cs, int baudrate); void common_hal_sdcardio_sdcard_construct(sdcardio_sdcard_obj_t *self, busio_spi_obj_t *spi, const mcu_pin_obj_t *cs, int baudrate);
void common_hal_sdcardio_sdcard_deinit(sdcardio_sdcard_obj_t *self); void common_hal_sdcardio_sdcard_deinit(sdcardio_sdcard_obj_t *self);
void common_hal_sdcardio_sdcard_check_for_deinit(sdcardio_sdcard_obj_t *self); void common_hal_sdcardio_sdcard_check_for_deinit(sdcardio_sdcard_obj_t *self);
@ -53,36 +52,3 @@ int common_hal_sdcardio_sdcard_get_blockcount(sdcardio_sdcard_obj_t *self);
int common_hal_sdcardio_sdcard_readblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf); int common_hal_sdcardio_sdcard_readblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf);
int common_hal_sdcardio_sdcard_sync(sdcardio_sdcard_obj_t *self); int common_hal_sdcardio_sdcard_sync(sdcardio_sdcard_obj_t *self);
int common_hal_sdcardio_sdcard_writeblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf); int common_hal_sdcardio_sdcard_writeblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf);
=======
static mp_obj_t microbit_repeat_iter_next(mp_obj_t iter_in) {
repeat_iterator_t *iter = (repeat_iterator_t *)iter_in;
iter->index++;
if (iter->index >= mp_obj_get_int(mp_obj_len(iter->iterable))) {
iter->index = 0;
}
return mp_obj_subscr(iter->iterable, MP_OBJ_NEW_SMALL_INT(iter->index), MP_OBJ_SENTINEL);
}
const mp_obj_type_t microbit_repeat_iterator_type = {
{ &mp_type_type },
.name = MP_QSTR_iterator,
.print = NULL,
.make_new = NULL,
.call = NULL,
.unary_op = NULL,
.binary_op = NULL,
.attr = NULL,
.subscr = NULL,
.getiter = mp_identity_getiter,
.iternext = microbit_repeat_iter_next,
.buffer_p = {NULL},
MP_OBJ_NULL
};
mp_obj_t microbit_repeat_iterator(mp_obj_t iterable) {
repeat_iterator_t *result = mp_obj_malloc(repeat_iterator_t, &microbit_repeat_iterator_type);
result->iterable = iterable;
result->index = -1;
return result;
}
>>>>>>> v1.19.1:ports/nrf/boards/microbit/modules/iters.c

View File

@ -31,15 +31,4 @@ char get_fmt_type(const char **fmt);
mp_uint_t get_fmt_num(const char **p); mp_uint_t get_fmt_num(const char **p);
mp_uint_t calcsize_items(const char *fmt); mp_uint_t calcsize_items(const char *fmt);
<<<<<<< HEAD:shared-module/struct/__init__.h
=======
// The main sleep implementation for the Windows port.
void msec_sleep(double msec);
// Define usleep() because some of the unix port's code uses that.
// Mingw and the likes provide a definition of usleep(), note however
// that it's also just Sleep(usec/1000).
#ifdef _MSC_VER
int usleep(__int64 usec);
>>>>>>> v1.19.1:ports/windows/sleep.h
#endif #endif

View File

@ -3,7 +3,7 @@
* *
* The MIT License (MIT) * The MIT License (MIT)
* *
* SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2013, 2014 Damien P. George
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -86,61 +86,40 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
nlr.ret_val = NULL; nlr.ret_val = NULL;
if (nlr_push(&nlr) == 0) { if (nlr_push(&nlr) == 0) {
mp_obj_t module_fun; mp_obj_t module_fun;
<<<<<<< HEAD
#if CIRCUITPY_ATEXIT #if CIRCUITPY_ATEXIT
if (!(exec_flags & EXEC_FLAG_SOURCE_IS_ATEXIT)) if (!(exec_flags & EXEC_FLAG_SOURCE_IS_ATEXIT))
======= #endif
#if MICROPY_MODULE_FROZEN_MPY
if (exec_flags & EXEC_FLAG_SOURCE_IS_RAW_CODE) {
// source is a raw_code object, create the function
const mp_frozen_module_t *frozen = source;
mp_module_context_t *ctx = m_new_obj(mp_module_context_t);
ctx->module.globals = mp_globals_get();
ctx->constants = frozen->constants;
module_fun = mp_make_function_from_raw_code(frozen->rc, ctx, NULL);
} else
>>>>>>> v1.19.1
#endif
{ {
#if MICROPY_MODULE_FROZEN_MPY #if MICROPY_MODULE_FROZEN_MPY
if (exec_flags & EXEC_FLAG_SOURCE_IS_RAW_CODE) { if (exec_flags & EXEC_FLAG_SOURCE_IS_RAW_CODE) {
// source is a raw_code object, create the function // source is a raw_code object, create the function
module_fun = mp_make_function_from_raw_code(source, MP_OBJ_NULL, MP_OBJ_NULL); const mp_frozen_module_t *frozen = source;
} else mp_module_context_t *ctx = m_new_obj(mp_module_context_t);
ctx->module.globals = mp_globals_get();
ctx->constants = frozen->constants;
module_fun = mp_make_function_from_raw_code(frozen->rc, ctx, NULL);
} else
#endif
{
#if MICROPY_ENABLE_COMPILER
mp_lexer_t *lex;
if (exec_flags & EXEC_FLAG_SOURCE_IS_VSTR) {
const vstr_t *vstr = source;
lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr->buf, vstr->len, 0);
} else if (exec_flags & EXEC_FLAG_SOURCE_IS_READER) {
lex = mp_lexer_new(MP_QSTR__lt_stdin_gt_, *(mp_reader_t *)source);
} else if (exec_flags & EXEC_FLAG_SOURCE_IS_FILENAME) {
lex = mp_lexer_new_from_file(source);
} else {
lex = (mp_lexer_t *)source;
}
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, exec_flags & EXEC_FLAG_IS_REPL);
#else
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("script compilation not supported"));
#endif #endif
{
#if MICROPY_ENABLE_COMPILER
mp_lexer_t *lex;
if (exec_flags & EXEC_FLAG_SOURCE_IS_VSTR) {
const vstr_t *vstr = source;
lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr->buf, vstr->len, 0);
} else if (exec_flags & EXEC_FLAG_SOURCE_IS_READER) {
lex = mp_lexer_new(MP_QSTR__lt_stdin_gt_, *(mp_reader_t *)source);
} else if (exec_flags & EXEC_FLAG_SOURCE_IS_FILENAME) {
lex = mp_lexer_new_from_file(source);
} else {
lex = (mp_lexer_t *)source;
}
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
if (input_kind == MP_PARSE_FILE_INPUT) {
mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
}
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, exec_flags & EXEC_FLAG_IS_REPL);
// Clear the parse tree because it has a heap pointer we don't need anymore.
*((uint32_t volatile *)&parse_tree.chunk) = 0;
#else
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("script compilation not supported"));
#endif
}
// If the code was loaded from a file it's likely to be running for a while so we'll long
// live it and collect any garbage before running.
if (input_kind == MP_PARSE_FILE_INPUT) {
module_fun = make_obj_long_lived(module_fun, 6);
gc_collect();
}
} }
// execute code // execute code
@ -474,18 +453,9 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
} else if (ret == CHAR_CTRL_B) { } else if (ret == CHAR_CTRL_B) {
// reset friendly REPL // reset friendly REPL
mp_hal_stdout_tx_str("\r\n"); mp_hal_stdout_tx_str("\r\n");
<<<<<<< HEAD
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO); mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
mp_hal_stdout_tx_str("\r\n"); mp_hal_stdout_tx_str("\r\n");
// mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n"); // mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n");
=======
mp_hal_stdout_tx_str(MICROPY_BANNER_NAME_AND_VERSION);
mp_hal_stdout_tx_str("; " MICROPY_BANNER_MACHINE);
mp_hal_stdout_tx_str("\r\n");
#if MICROPY_PY_BUILTINS_HELP
mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n");
#endif
>>>>>>> v1.19.1
goto input_restart; goto input_restart;
} else if (ret == CHAR_CTRL_C) { } else if (ret == CHAR_CTRL_C) {
// break // break
@ -633,19 +603,10 @@ int pyexec_friendly_repl(void) {
vstr_init(&line, 32); vstr_init(&line, 32);
friendly_repl_reset: friendly_repl_reset:
<<<<<<< HEAD
mp_hal_stdout_tx_str("\r\n"); mp_hal_stdout_tx_str("\r\n");
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO); mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
mp_hal_stdout_tx_str("\r\n"); mp_hal_stdout_tx_str("\r\n");
// mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n"); // mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n");
=======
mp_hal_stdout_tx_str(MICROPY_BANNER_NAME_AND_VERSION);
mp_hal_stdout_tx_str("; " MICROPY_BANNER_MACHINE);
mp_hal_stdout_tx_str("\r\n");
#if MICROPY_PY_BUILTINS_HELP
mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n");
#endif
>>>>>>> v1.19.1
// to test ctrl-C // to test ctrl-C
/* /*
@ -688,7 +649,6 @@ friendly_repl_reset:
} }
vstr_reset(&line); vstr_reset(&line);
<<<<<<< HEAD
nlr_buf_t nlr; nlr_buf_t nlr;
nlr.ret_val = NULL; nlr.ret_val = NULL;
@ -704,9 +664,6 @@ friendly_repl_reset:
mp_hal_stdout_tx_str("\r\n"); mp_hal_stdout_tx_str("\r\n");
mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val)); mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val));
} }
=======
int ret = readline(&line, mp_repl_get_ps1());
>>>>>>> v1.19.1
mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT; mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT;
if (ret == CHAR_CTRL_A) { if (ret == CHAR_CTRL_A) {