Commit Graph

4655 Commits

Author SHA1 Message Date
Jeff Epler 9c1434014c remove redundant docs of struct _mp_obj_full_type_t 2021-07-12 07:01:14 -05:00
Jeff Epler 52540a9830 Rename EXTENDED_FIELDS -> MP_TYPE_EXTENDED_FIELDS 2021-07-12 06:57:59 -05:00
Jeff Epler 7302bc09a7 rename the type flag to EXTENDED for consistency 2021-07-09 14:59:37 -05:00
Jeff Epler 26ae1c7705 Move & comment the field access macros 2021-07-07 08:32:59 -05:00
Jeff Epler 44a3da55e6 Fix EXTENDED_FIELDS macro to work with clang
This appears to work with clang versions at least since 3.0.
2021-07-07 08:32:33 -05:00
Jeff Epler 2997113e73 obj.h: Make mp_obj_is_type work between full & non-full types
By comparing the address of the initial 'name' field instead of the
addresses of the objects themselves, a small amount of type safety is
added back, vs just casting to void.

In the event that some other kind of object is passed in as 't',
which happens to have a 'name' field of the right type, the construct
would be (undesirably) accepted but it would almost certainly evaluate
to false at runtime.
2021-07-07 08:31:54 -05:00
Jeff Epler 0d756066e8 milestone: coverage make test_full passes 2021-07-06 10:37:32 -05:00
Jeff Epler df56ba207f WIP 2021-07-06 09:25:56 -05:00
Jeff Epler cd119ca3ec Introduce, use getters for fields which will be optional in types 2021-07-06 09:15:01 -05:00
Dan Halbert c7ffc2c10b
Merge pull request #4957 from tannewt/ble_serial
Add serial over BLE
2021-07-01 23:05:18 -04:00
Dan Halbert 7f39779f45
Merge pull request #4931 from jepler/struct-time-construct
Allow construction of struct_time from another struct_time
2021-06-30 22:59:46 -04:00
microDev e0c626af16
fix bytes() and bytearray() input validation 2021-06-29 19:59:44 +05:30
Jeff Epler 33482e0831 mp_obj_get_array: Work with namedtuple, attrtuple.
Signed-off-by: Jeff Epler <jepler@gmail.com>
2021-06-26 20:25:24 -05:00
Jeff Epler f380a91e7c objtuple: Move mp_obj_is_tuple_compatible to obj.h.
Signed-off-by: Jeff Epler <jepler@gmail.com>
2021-06-26 20:25:23 -05:00
Scott Shawcroft 3177973843
Add BLE serial service 2021-06-25 15:00:10 -07:00
Scott Shawcroft b81573d439
Merge pull request #4891 from dhalbert/keypad-scanning-events
keypad: support for vector and matrix key scanning
2021-06-24 10:25:21 -07:00
Dan Halbert 8c74b4a5f2 fix some typos 2021-06-21 17:47:12 -04:00
Dan Halbert 51c547a5b9 add generic arg validation routines; add interval args to keypad 2021-06-21 12:13:39 -04:00
Jeff Epler a5876f4dea fix compile error on boards with inline asm 2021-06-18 16:59:48 -05:00
Jeff Epler fa29be5aea restore a redundant NULL-comparison, it silences compiler diagnostics 2021-06-18 11:24:39 -05:00
Jeff Epler 87d3740c64 Merge tag 'v1.16' 2021-06-18 10:54:19 -05:00
Damien George 7c51cb2307 all: Bump version to 1.16.
Signed-off-by: Damien George <damien@micropython.org>
2021-06-18 16:38:06 +10:00
Damien George bc89cdeb45 py/gc: Only use no_sanitize_address attribute for GCC 4.8 and above.
It's not supported on older GCC versions.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-18 14:15:37 +10:00
Dan Halbert af66931f71 Added keypad.ShiftRegisterKeys 2021-06-17 20:51:45 -04:00
Dan Halbert 04b69cde9b turn off gamepad on most builds;turn off keypad where appropriate 2021-06-17 13:46:45 -04:00
Dan Halbert cd31136c30 factor out keypad.EventQueue 2021-06-16 15:55:54 -04:00
Dan Halbert 3d18c5c327 Use a single list of keypad scanners 2021-06-16 13:29:38 -04:00
Dan Halbert 32eec85230 compiles 2021-06-14 20:54:43 -04:00
Dan Halbert 627c426259 wip 2021-06-14 16:00:15 -04:00
Dan Halbert 7d23206018 Inital keypad work: Keys working: one pin per key
keypad.Buttons and keypad.State

Buttons -> Keys; further work

wip

wip

wip: compiles

about to try

keypad.Keys working
2021-06-08 20:27:31 -04:00
Damien George 5e1d3c8b5d py/stackctrl: Prevent unused-var warning when stack checking disabled.
Signed-off-by: Damien George <damien@micropython.org>
2021-06-05 11:03:09 +10:00
Damien George a70a4e6688 py/emitglue: Always flush caches when assigning native ARM code.
Prior to this commit, cache flushing for ARM native code was done only in
the assembler code asm_thumb_end_pass()/asm_arm_end_pass(), at the last
pass of the assembler.  But this misses flushing the cache when loading
native code from an .mpy file, ie in persistentcode.c.

The change here makes sure the cache is always flushed/cleaned/invalidated
when assigning native code on ARM architectures.

This problem was found running tests/micropython/import_mpy_native_gc.py on
the mimxrt port.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-05 11:03:04 +10:00
George Waters c5066efacb
Enable slice indices 2021-06-03 22:55:32 -04:00
Tsutomu IKEGAMI 9490010d7d Fix format (expand tab) 2021-06-02 12:10:41 +09:00
Tsutomu IKEGAMI 6278c2bb9f Fix bit_length() method to work with zero-valued mpz integer. 2021-06-02 11:57:55 +09:00
Jonathan Giles 064e6881ed Fix mpy-cross build on Apple M1 machines 2021-05-31 14:14:20 -04:00
Damien George 53519e322a py/builtinimport: Change relative import's ValueError to ImportError.
Following CPython change, see https://bugs.python.org/issue37444.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-30 19:35:03 +10:00
Jeff Epler d67f4115b4 py/repl: Don't read past the end of import_str.
asan considers that memcmp(p, q, N) is permitted to access N bytes at each
of p and q, even for values of p and q that have a difference earlier.
Accessing additional values is frequently done in practice, reading 4 or
more bytes from each input at a time for efficiency, so when completing
"non_exist<TAB>" in the repl, this causes a diagnostic:

    ==16938==ERROR: AddressSanitizer: global-buffer-overflow on
    address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
    READ of size 9 at 0x555555cd8dc8 thread T0
        #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
        #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
        #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
        #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
        #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
        #5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
        #6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
        #7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
        #8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

    0x555555cd8dc8 is located 0 bytes to the right of global variable
    'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
    size 8
      'import_str' is ascii string 'import '

Signed-off-by: Jeff Epler <jepler@gmail.com>
2021-05-30 11:50:51 +10:00
Jeff Epler 9a74546f8d py/gc: Access the list of root pointers in an asan-compatible way.
Signed-off-by: Jeff Epler <jepler@gmail.com>
2021-05-30 11:50:51 +10:00
Jeff Epler f2dbc91022 py/compile: Raise an error on async with/for outside an async function.
A simple reproducer is:

   async for x in (): x

Before this change, it would cause an assertion error in mpy-cross and
micropython-coverage.
2021-05-30 10:38:48 +10:00
Damien George 4ee8ec6931 py/asmarm: Use builtin func to flush I- and D-cache on ARM 7 archs.
The inline assembler code does not work for __ARM_ARCH == 7.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-26 16:24:00 +10:00
James Carr 61a7212b28
Update comment in persistentcode.c
Update comment in mp_raw_code_save so that it matches the code.
2021-05-23 08:57:41 +01:00
Damien George e61ac453dc py/mkrules.cmake: Add MPY_LIB_DIR and BOARD_DIR to makemanifest call.
So that the FROZEN_MANIFEST option in cmake works the same as make.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-23 00:00:39 +10:00
Scott Shawcroft 5643355e90
Merge remote-tracking branch 'adafruit/main' into simplify_status_led 2021-05-20 08:35:15 -07:00
Damien George 5176a2d732 py/emitnative: Fix x86-64 emitter to generate correct 8/16-bit stores.
Fixes issue #6643.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-20 23:43:25 +10:00
Damien George f49d47c167 py/asmx64: Support use of top 8 regs in src_r64 argument.
Signed-off-by: Damien George <damien@micropython.org>
2021-05-20 23:43:25 +10:00
Scott Shawcroft 499a4388cf
Handle inverted neopixel power 2021-05-19 17:29:02 -07:00
Bob Abeles 7ceccad4e2 py/nlrx64: Correct the detection of Darwin ABI.
__APPLE__ tests for an Apple OS and __MACH__ tests that it is based on CMU
Mach.  Using both tests ensures that just Darwin is recognized.
2021-05-18 11:52:00 +10:00
Bob Abeles 126b1c7271 py/nlraarch64: Add underscore prefix to function symbols for Darwin ABI.
The proper way to do this is to test for __APPLE__ and __MACH__, where
__APPLE__ tests for an Apple OS and __MACH__ tests that it is based on CMU
Mach.  Using both tests ensures that just Darwin (Apple's open source base
for MacOS, iOS, etc.) is recognized. __APPLE__ by itself will test for any
Apple OS, which can include older OS 7-9 and any future Apple OS. __MACH__
tests for any OS based on CMU Mach, including Darwin and GNU Hurd.

Fixes #7232.
2021-05-18 11:46:30 +10:00
Damien George 6d2680fa36 py/objarray: Fix constructing a memoryview from a memoryview.
Fixes issue #7261.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-18 10:18:56 +10:00