Skip to content

Commit c0a4abc

Browse files
committed
Fix merge bugs; remove shared/tinyusb/*
1 parent a8fb081 commit c0a4abc

File tree

22 files changed

+82
-427
lines changed

22 files changed

+82
-427
lines changed

extmod/modbinascii.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "py/binary.h"
3333
#include "py/objstr.h"
3434

35-
#include "lib/uzlib/tinf.h"
35+
//#include "lib/uzlib/tinf.h"
3636

3737
#if MICROPY_PY_BINASCII
3838

@@ -219,7 +219,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_binascii_b2a_base64_obj, 1, mod_binascii_b
219219
*/
220220

221221
#if MICROPY_PY_UBINASCII_CRC32
222-
#include "lib/uzlib/tinf.h"
222+
//#include "lib/uzlib/uzlib.h"
223223

224224
STATIC mp_obj_t mod_binascii_crc32(size_t n_args, const mp_obj_t *args) {
225225
mp_buffer_info_t bufinfo;

extmod/modzlib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#include "py/stream.h"
3232
#include "py/mperrno.h"
3333

34-
#if MICROPY_PY_UZLIB
34+
#if MICROPY_PY_ZLIB
3535

3636
#define UZLIB_CONF_PARANOID_CHECKS (1)
37-
#include "lib/uzlib/tinf.h"
37+
#include "lib/uzlib/uzlib.h"
3838

3939
#if 0 // print debugging info
4040
#define DEBUG_printf DEBUG_printf
@@ -243,4 +243,4 @@ MP_REGISTER_MODULE(MP_QSTR_zlib, mp_module_uzlib);
243243
#include "lib/uzlib/adler32.c"
244244
#include "lib/uzlib/crc32.c"
245245

246-
#endif // MICROPY_PY_UZLIB
246+
#endif // MICROPY_PY_ZLIB

ports/raspberrypi/bindings/cyw43/__init__.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
5959
cyw43_pin_type,
6060
MP_QSTR_CywPin,
6161
MP_TYPE_FLAG_NONE,
62-
print, shared_bindings_microcontroller_pin_print,
63-
unary_op, mp_generic_unary_op
62+
print, shared_bindings_microcontroller_pin_print
6463
);
6564

6665
//| PM_STANDARD: int

py/builtinimport.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include <assert.h>
3232

3333
#include "py/compile.h"
34+
// CIRCUITPY: for gc_collect() after each import
35+
#include "py/gc.h"
3436
#include "py/objmodule.h"
3537
#include "py/persistentcode.h"
3638
#include "py/runtime.h"
@@ -136,7 +138,6 @@ STATIC mp_import_stat_t stat_top_level(qstr mod_name, vstr_t *dest) {
136138
return stat;
137139
}
138140
}
139-
#endif
140141

141142
// sys.path was empty or no matches, do not search the filesystem or
142143
// frozen code.

py/compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ STATIC void compile_error_set_line(compiler_t *comp, mp_parse_node_t pn) {
255255
}
256256
}
257257

258-
STATIC void compile_syntax_error(compiler_t *comp, mp_parse_node_t pn, mp_rom_error_text_t msg) {
258+
STATIC void compile_syntax_error(compiler_t *comp, mp_parse_node_t pn, const compressed_string_t *msg) {
259259
// only register the error if there has been no other error
260260
if (comp->compile_error == MP_OBJ_NULL) {
261261
comp->compile_error = mp_obj_new_exception_msg(&mp_type_SyntaxError, msg);

py/gc.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,6 @@ void gc_add(void *start, void *end) {
260260
prev_area->next = area;
261261
}
262262

263-
// CIRCUITPY
264-
// TODO FOR MERGE: fix this for multiple areas??
265-
void gc_deinit(void) {
266-
// Run any finalisers before we stop using the heap.
267-
gc_sweep_all();
268-
MP_STATIC_ASSERT(!MICROPY_GC_SPLIT_HEAP);
269-
memset(&MP_STATE_MEM(area), 0, sizeof(MP_STATE_MEM(area)));
270-
271263
#if MICROPY_GC_SPLIT_HEAP_AUTO
272264
// Try to automatically add a heap area large enough to fulfill 'failed_alloc'.
273265
STATIC bool gc_try_add_heap(size_t failed_alloc) {
@@ -346,6 +338,15 @@ STATIC bool gc_try_add_heap(size_t failed_alloc) {
346338

347339
#endif
348340

341+
// CIRCUITPY
342+
// TODO FOR MERGE: fix this for multiple areas??
343+
void gc_deinit(void) {
344+
// Run any finalisers before we stop using the heap.
345+
gc_sweep_all();
346+
MP_STATIC_ASSERT(!MICROPY_GC_SPLIT_HEAP);
347+
memset(&MP_STATE_MEM(area), 0, sizeof(MP_STATE_MEM(area)));
348+
}
349+
349350
void gc_lock(void) {
350351
// This does not need to be atomic or have the GC mutex because:
351352
// - each thread has its own gc_lock_depth so there are no races between threads;

py/mpconfig.h

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
#ifndef MICROPY_INCLUDED_PY_MPCONFIG_H
2727
#define MICROPY_INCLUDED_PY_MPCONFIG_H
2828

29+
// Is this a CircuitPython build?
30+
#ifndef CIRCUITPY
31+
#define CIRCUITPY 0
32+
#endif
33+
2934
// In CircuitPython, version info is in genhdr/mpversion.h.
3035
#if CIRCUITPY
3136
#include "genhdr/mpversion.h"
@@ -53,11 +58,6 @@
5358
// You can override any of the options below using mpconfigport.h file
5459
// located in a directory of your port.
5560

56-
// Is this a CircuitPython build?
57-
#ifndef CIRCUITPY
58-
#define CIRCUITPY 0
59-
#endif
60-
6161
// mpconfigport.h is a file containing configuration settings for a
6262
// particular port. mpconfigport.h is actually a default name for
6363
// such config, and it can be overridden using MP_CONFIGFILE preprocessor
@@ -540,6 +540,15 @@
540540
#define MICROPY_OPT_COMPUTED_GOTO (0)
541541
#endif
542542

543+
// CIRCUITPY
544+
// Whether to save trade flash space for speed in MICROPY_OPT_COMPUTED_GOTO.
545+
// Costs about 3% speed, saves about 1500 bytes space. In addition to the assumptions
546+
// of MICROPY_OPT_COMPUTED_GOTO, also assumes that mp_execute_bytecode is less than
547+
// 32kB in size.
548+
#ifndef MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE
549+
#define MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE (0)
550+
#endif
551+
543552
// Optimise the fast path for loading attributes from instance types. Increases
544553
// Thumb2 code size by about 48 bytes.
545554
#ifndef MICROPY_OPT_LOAD_ATTR_FAST_PATH
@@ -597,6 +606,12 @@
597606
#define MICROPY_HAS_FILE_READER (MICROPY_READER_POSIX || MICROPY_READER_VFS)
598607
#endif
599608

609+
// CIRCUITPY
610+
// Number of VFS mounts to persist across soft-reset.
611+
#ifndef MICROPY_FATFS_NUM_PERSISTENT
612+
#define MICROPY_FATFS_NUM_PERSISTENT (0)
613+
#endif
614+
600615
// Hook for the VM at the start of the opcode loop (can contain variable
601616
// definitions usable by the other hook functions)
602617
#ifndef MICROPY_VM_HOOK_INIT
@@ -1595,6 +1610,7 @@ typedef double mp_float_t;
15951610
// TODO? CIRCUITPY_ZLIB instead
15961611
#ifndef MICROPY_PY_ZLIB
15971612
#define MICROPY_PY_ZLIB (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES)
1613+
#endif
15981614

15991615
// Whether to provide "deflate" module (decompression-only by default)
16001616
#ifndef MICROPY_PY_DEFLATE
@@ -1977,6 +1993,19 @@ typedef double mp_float_t;
19771993
#define MP_WEAK __attribute__((weak))
19781994
#endif
19791995

1996+
// CIRCUITPY
1997+
// Modifier for functions which should not be instrumented when tracing with
1998+
// -finstrument-functions
1999+
#ifndef MP_NO_INSTRUMENT
2000+
#define MP_NO_INSTRUMENT __attribute__((no_instrument_function))
2001+
#endif
2002+
2003+
// CIRCUITPY
2004+
// Modifier for functions which should ideally inlined
2005+
#ifndef MP_INLINE
2006+
#define MP_INLINE inline MP_NO_INSTRUMENT
2007+
#endif
2008+
19802009
// Modifier for functions which should be never inlined
19812010
#ifndef MP_NOINLINE
19822011
#define MP_NOINLINE __attribute__((noinline))
@@ -1997,6 +2026,13 @@ typedef double mp_float_t;
19972026
#define MP_UNLIKELY(x) __builtin_expect((x), 0)
19982027
#endif
19992028

2029+
// CIRCUITPY
2030+
// Modifier for functions which aren't often used. Calls will also be considered
2031+
// unlikely. Section names are `.text.unlikely` for use in linker scripts.
2032+
#ifndef MP_COLD
2033+
#define MP_COLD __attribute__((cold))
2034+
#endif
2035+
20002036
// To annotate that code is unreachable
20012037
#ifndef MP_UNREACHABLE
20022038
#if defined(__GNUC__)

py/obj.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ mp_obj_t mp_obj_new_memoryview(byte typecode, size_t nitems, void *items);
10571057

10581058
const mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in);
10591059
const char *mp_obj_get_type_str(mp_const_obj_t o_in);
1060-
CIRCUITPY
1060+
// CIRCUITPY
10611061
#define mp_obj_get_type_qstr(o_in) (mp_obj_get_type((o_in))->name)
10621062
bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo); // arguments should be type objects
10631063
mp_obj_t mp_obj_cast_to_native_base(mp_obj_t self_in, mp_const_obj_t native_type);

py/objgenerator.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
103103
MP_QSTR_coroutine,
104104
MP_TYPE_FLAG_BINDS_SELF,
105105
GEN_WRAP_TYPE_ATTR
106-
call, gen_wrap_call,
107-
unary_op, mp_generic_unary_op
106+
call, gen_wrap_call
108107
);
109108
#endif
110109

@@ -191,8 +190,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
191190
MP_QSTR_coroutine,
192191
MP_TYPE_FLAG_BINDS_SELF,
193192
GEN_WRAP_TYPE_ATTR
194-
call, native_gen_wrap_call,
195-
unary_op, mp_generic_unary_op
193+
call, native_gen_wrap_call
196194
);
197195
#endif
198196

@@ -475,7 +473,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
475473
MP_QSTR_coroutine,
476474
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
477475
print, coro_instance_print,
478-
unary_op, mp_generic_unary_op,
479476
iter, gen_instance_iternext,
480477
locals_dict, &coro_instance_locals_dict
481478
);

py/parse.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -653,20 +653,11 @@ STATIC const mp_rom_map_elem_t mp_constants_table[] = {
653653
STATIC MP_DEFINE_CONST_MAP(mp_constants_map, mp_constants_table);
654654
#endif
655655

656-
STATIC void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args);
657-
658-
#if MICROPY_COMP_CONST_FOLDING
659-
// CIRCUITPY: The compilers mentioned below are esp-2020r3. We are using minimum esp-2021r3 (ESP-IDF v4.4).
660-
// See https://github.com/micropython/micropython/commit/f63b4f85aae1e0ade7a7c9f908debb5905cc144d
661-
// and https://github.com/espressif/esp-idf/issues/9130
662-
// So disable this for CircuitPython.
663-
/*
664-
#if MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND
656+
#if defined(MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND) && MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND
665657
// Some versions of the xtensa-esp32-elf-gcc compiler generate wrong code if this
666658
// function is static, so provide a hook for them to work around this problem.
667659
MP_NOINLINE
668660
#endif
669-
*/
670661
STATIC bool fold_logical_constants(parser_t *parser, uint8_t rule_id, size_t *num_args) {
671662
if (rule_id == RULE_or_test
672663
|| rule_id == RULE_and_test) {

0 commit comments

Comments
 (0)