Commit Graph

3721 Commits

Author SHA1 Message Date
Lucian Copeland 8791ca6af3 implement requested changes 2020-04-23 13:33:41 -04:00
Lucian Copeland d0a2106547 Remove old build flags, add fixes for shared_matrix 2020-04-22 16:06:08 -04:00
Dan Halbert fbc8719fad ringbuf tested 2020-04-21 22:40:12 -04:00
Dan Halbert 77cd93ac2d merge from adafruit 2020-04-21 17:47:51 -04:00
Dan Halbert 38ec3bc574 further ringbuf cleanup 2020-04-21 17:38:20 -04:00
Scott Shawcroft bebf27e733
Merge remote-tracking branch 'adafruit/master' into lower_power
This isn't perfect and needs a bit more testing.
2020-04-20 18:25:13 -07:00
Jeff Epler 5fcc6d6286 RGBMatrix: finish renaming from Protomatter
This gets all the purely internal references.  Some uses of
protomatter/Protomatter/PROTOMATTER remain, as they are references
to symbols in the Protomatter C library itself.
2020-04-17 18:44:07 -05:00
Jeff Epler 3d6258f63d Rename Protomatter -> RGBMatrix
This is a quick rename, it changes the user-facing names but not the
internal names of things.
2020-04-17 18:43:57 -05:00
Jeff Epler a32337718d Rename _protomatter -> protomatter
I originally believed that there would be a wrapper library around it,
like with _pixelbuf; but this proves not to be the case, as there's
too little for the library to do.
2020-04-17 18:43:57 -05:00
Scott Shawcroft b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler b1fab1cdac Make stripping circuitpython optional, not the default 2020-04-14 18:24:58 -05:00
Jeff Epler 09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00
Jeff Epler 135fb5b887 py.mk: update warning flags needed for ulab 2020-04-14 15:37:36 -05:00
Scott Shawcroft c248730bd1
Clean up 2020-04-02 17:36:09 -07:00
Scott Shawcroft 8fe512c7e9
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-03-31 15:13:58 -07:00
Jeff Epler 9d2270a979 runtime: Improve error message when setting read-only property
Formerly, if you wrote
   SPI.frequency = 0
you would get the sightly erroneous error message
   AttributeError: 'SPI' object has no attribute 'frequency'
In this case, a better message would read
   AttributeError: 'SPI' object cannot assign attribute 'frequency'

This new message will both be used in the case where the attribute doesn't
exist at all (and the object has no dynamic attributes; most instances of
built in types behave this way), or if the attribute exists but is
read-only.
2020-03-20 17:57:28 -05:00
Jeff Epler 96f2288b84 ulab: include new 'extras' source file 2020-03-17 09:33:17 -05:00
Jeff Epler d6342af980 ulab: rename enable macro so it appears in the support matrix 2020-03-17 09:33:03 -05:00
Jeff Epler 69aa010cfc objslice: take mp_obj_slice_indices from micropython 2020-03-17 08:32:52 -05:00
Scott Shawcroft 48b5f2a384
Initial work on SAMD 2020-03-13 11:16:41 -07:00
Scott Shawcroft d988af02d1
Merge pull request #2690 from jepler/topic-pep-498-fstrings
Implement partial PEP-498 (f-string) support
2020-03-10 10:53:04 -07:00
Jeff Epler 491a31a731 circuitpy_mpconfig.mk: Enable ULAB for "full builds"
This enables it on the imxrt and cds56 ports where it was disabled before
2020-03-09 15:54:40 -05:00
Jeff Epler 473e9c5ffb f-strings: Make optional, defaulting to !CIRCUITPY_MINIMAL_BUILD
This should reclaim *most* code space added to handle f-strings.
However, there may be some small code growth as parse_string_literal
takes a new parameter (which will always be 0, so hopefully the optimizer
eliminates it)
2020-03-09 09:03:25 -05:00
Jeff Epler 32647cd9b4 lexer: catch concatenation of f'' and '' strings
This turns the "edge case" into a parse-time error.
2020-03-09 09:03:25 -05:00
Josh Klar 40bc05ee1e Address dpgeorge feedback - largely simplifications 2020-03-09 08:16:07 -05:00
Josh Klar 3a7a5ba686 py: Implement partial PEP-498 (f-string) support
This implements (most of) the PEP-498 spec for f-strings, with two
exceptions:

- raw f-strings (`fr` or `rf` prefixes) raise `NotImplementedError`
- one special corner case does not function as specified in the PEP
(more on that in a moment)

This is implemented in the core as a syntax translation, brute-forcing
all f-strings to run through `String.format`. For example, the statement
`x='world'; print(f'hello {x}')` gets translated *at a syntax level*
(injected into the lexer) to `x='world'; print('hello {}'.format(x))`.
While this may lead to weird column results in tracebacks, it seemed
like the fastest, most efficient, and *likely* most RAM-friendly option,
despite being implemented under the hood with a completely separate
`vstr_t`.

Since [string concatenation of adjacent literals is implemented in the
lexer](534b7c368d),
two side effects emerge:

- All strings with at least one f-string portion are concatenated into a
single literal which *must* be run through `String.format()` wholesale,
and:
- Concatenation of a raw string with interpolation characters with an
f-string will cause `IndexError`/`KeyError`, which is both different
from CPython *and* different from the corner case mentioned in the PEP
(which gave an example of the following:)

```python
x = 10
y = 'hi'
assert ('a' 'b' f'{x}' '{c}' f'str<{y:^4}>' 'd' 'e') == 'ab10{c}str< hi >de'
```

The above-linked commit detailed a pretty solid case for leaving string
concatenation in the lexer rather than putting it in the parser, and
undoing that decision would likely be disproportionately costly on
resources for the sake of a probably-low-impact corner case. An
alternative to become complaint with this corner case of the PEP would
be to revert to string concatenation in the parser *only when an
f-string is part of concatenation*, though I've done no investigation on
the difficulty or costs of doing this.

A decent set of tests is included. I've manually tested this on the
`unix` port on Linux and on a Feather M4 Express (`atmel-samd`) and
things seem sane.
2020-03-09 08:16:07 -05:00
Jeff Epler 4fa90261a3
Merge pull request #2657 from tannewt/builtin_package
Support importing native modules in native packages.
2020-03-05 14:28:46 -06:00
Jeff Epler da31acfcc4 Merge remote-tracking branch 'origin/master' into ulab 2020-03-03 20:13:53 -06:00
Scott Shawcroft 274cb597b0
Remove debug extern 2020-03-03 10:55:50 -08:00
Jeff Epler 862830da32 compile: Give a proper error on 'async with'/'async for' outside 'async def'
A simple reproducer is:
   async for x in():x
2020-03-01 09:40:43 -06:00
Jeff Epler 511c180869 parse: push_result_token: throw an exception on too-long names
Before this, such names would instead cause an assertion error inside
qstr_from_strn.

A simple reproducer is a python source file containing the letter "a"
repeated 256 times
2020-03-01 09:38:34 -06:00
Jeff Epler 39cfe32c34 Update ulab from upstream again 2020-02-27 14:14:05 -06:00
Jeff Epler fa3b9eba92 ulab: Incorporate it 2020-02-27 11:03:03 -06:00
Scott Shawcroft 6375d8699e
Validate builtin member is a module 2020-02-26 10:32:02 -08:00
Scott Shawcroft 86fd93bd03
Support importing native modules in native packages.
This only fixes the `import` portion. It doesn't actually change
reference behavior because modules within a package could already
be referenced through the parent package even though an error should
have been thrown.
2020-02-25 15:32:55 -08:00
Dan Halbert e31ac710be Enable _bleio adapter when _bleio is imported 2020-02-20 21:55:04 -05:00
Scott Shawcroft e8f7141564
Disable BLE file service for now
Fixes #2633
2020-02-20 12:15:56 -08:00
Dan Halbert c592bd612a Implement to_bytes(..., signed=True) 2020-02-14 15:12:20 -05:00
Scott Shawcroft e97b0cfc61
Merge pull request #2581 from jamesbowman/master
First draft of eveL, the low-level module of the Gameduino bindings
2020-02-13 11:21:32 -08:00
Scott Shawcroft 36e6cc8feb
Track first free atb for multiple block sizes.
This speeds up cases where no single block allocations happen while
Python code is allocating other block sizes.
2020-02-11 17:06:24 -08:00
James Bowman 5c6d94d3e5 Split into shared-module and shared-bindings 2020-02-07 10:30:49 -08:00
James Bowman acef93a253 Rename eveL to _eve, EVEL to _EVE 2020-02-05 18:17:58 -08:00
Dan Halbert e13642351c fix printing single-arg exceptions 2020-02-04 16:55:56 -05:00
Dan Halbert 7fe959ab39 fix multi-arg exception printing 2020-02-04 16:41:25 -05:00
Dan Halbert 5164719e67 preserve errno in OSError 2020-02-04 16:19:40 -05:00
Dan Halbert 57b566e736 Include filename for 'No such file/directory', etc. 2020-02-04 13:32:39 -05:00
James Bowman 8347f2b5c3 Correct default state to off for eveL module.
Fix build break because of overflowing small ports
2020-02-03 19:23:42 -08:00
James Bowman 7fd30e7d20 First draft of eveL, the low-level module of the Gameduino (and BridgeTek EVE) bindings.
[adafruit/circuitpython#2578]
2020-02-03 16:46:14 -08:00
Scott Shawcroft 55eb1730b8
Merge remote-tracking branch 'adafruit/master' into tweak_pixelbuf 2020-01-30 10:59:21 -08:00
Scott Shawcroft 2cc20e8816
Remove unneeded native cast. 2020-01-30 10:59:16 -08:00
Scott Shawcroft 5d24ade5c9
Tweak error messages to reduce code size. 2020-01-29 17:32:07 -08:00
Scott Shawcroft d655c785b6
Merge commit 'b36b24' into tweak_pixelbuf 2020-01-29 13:35:22 -08:00
Scott Shawcroft 5b6b4eb326
Merge pull request #2551 from jepler/build-mpy-cross-static-linux-win64
Build static binaries of mpy-cross for desktop linux, desktop windows, mac, and raspbian
2020-01-29 11:45:08 -08:00
Scott Shawcroft f6a635b102
Fix subclassing of objects that are tested. Others may still be broken. 2020-01-27 14:52:42 -08:00
Scott Shawcroft b36b2493bc
Merge pull request #2532 from tannewt/teensy4-dev
Refine iMX RT memory layout and add three boards
2020-01-27 14:11:08 -08:00
Jeff Epler d9e0742a07 accomodate excessively old gcc versions for raspbian mpy-cross cross-build 2020-01-25 15:32:52 -06:00
Scott Shawcroft 81c3bc411f
Don't assume native methods want the native object as self. 2020-01-24 18:22:28 -08:00
tsupplis b66abd47b8
Update fix (missing pragma gcc diagnostic push)
Update fix (missing pragma gcc diagnostic push)
2020-01-21 19:45:20 +00:00
Scott Shawcroft 7d8dac9211
Refine iMX RT memory layout and add three boards
Introduces a way to place CircuitPython code and data into
tightly coupled memory (TCM) which is accessible by the CPU in a
single cycle. It also frees up room in the corresponding cache for
intermittent data. Loading from external flash is slow!

The data cache is also now enabled.

Adds support for the iMX RT 1021 chip. Adds three new boards:
* iMX RT 1020 EVK
* iMX RT 1060 EVK
* Teensy 4.0

Related to #2492, #2472 and #2477. Fixes #2475.
2020-01-17 17:36:08 -08:00
Scott Shawcroft 8b61333937
Merge pull request #2510 from dhalbert/bonding-nvm
nrf: Add bonding to BLE pairing support
2020-01-15 16:11:09 -08:00
Scott Shawcroft 1d2e262a59
Merge pull request #2505 from theodox/master
Make all `PYTHON` env vars into `PYTHON3`
2020-01-14 10:55:23 -08:00
Scott Shawcroft ed811fb9c0
Merge pull request #2504 from rhooper/fix-tuple-subscr
Fix tuple subscr
2020-01-14 10:53:50 -08:00
Dan Halbert 2a75196aa3 merge from adafruit/circuitpython 2020-01-13 18:15:32 -05:00
Scott Shawcroft 2eb26a6d0b
Merge pull request #2457 from hierophect/stm32-cpython-compat
STM32: Cpython compatibility flag 2
2020-01-13 13:47:55 -08:00
Dan Halbert 9e7f8743c2 fix CCCD bonding store; avoid excessive bonding writes 2020-01-12 23:32:51 -05:00
Steve Theodore dd4b0f6e9c
Make all `PYTHON` env vars into `PYTHON3`
make file contained a mix of references to `PYTHON` and `PYTHON3`, and did not build on a fresh install of Ubuntu (under Windows LXSS)
2020-01-11 21:37:54 -08:00
Roy Hooper 73e076a40c make types that depend on tuple subscr work 2020-01-11 18:21:43 -05:00
Scott Shawcroft 6ea8d8a6c2
Merge pull request #2498 from dhalbert/optional-i2c-pullup-checking
Make requiring I2C pullups be optional
2020-01-10 11:42:44 -08:00
Scott Shawcroft 8708d3dc45
Merge pull request #2461 from jepler/urandom-hardfaults
Urandom hardfaults
2020-01-10 11:37:59 -08:00
Dan Halbert 189f2d5f07 Make requiring I2C pullups be optional 2020-01-09 17:31:50 -05:00
Hierophect 10eed78dd8 use CFLAG to properly set define 2020-01-08 17:37:20 -05:00
Jeff Epler f1c2dee1c0 style 2020-01-08 16:36:43 -06:00
Scott Shawcroft a10cd8580c
Merge pull request #2445 from jepler/mp3-jeplayer-fixes
Fixes for JEplayer
2020-01-08 12:50:13 -08:00
Scott Shawcroft d4492aaed0
Merge remote-tracking branch 'adafruit/master' into packet_buffer 2020-01-08 10:44:37 -08:00
Jeff Epler 5baaac55ce vstr_init_len: Don't crash if (size_t)-1 is passed
In this unusual case, (len + 1) is zero, the allocation in vstr_init
succeeds (allocating 1 byte), and then the caller is likely to erroneously
access outside the allocated region, for instance with a memset().

This could be triggered with os.urandom(-1) after it was converted to use
mp_obj_new_bytes_of_zeros.
2020-01-08 09:42:44 -06:00
Jeff Epler dd6010a17e Fix more build problems 2020-01-06 13:35:43 -06:00
Marius-450 3ad3d49959 changes only for monster m4sk 2020-01-04 12:32:49 -05:00
Marius-450 d2b2cf0add CIRCUITPY_DISPLAY_LIMIT = 2 2020-01-04 12:20:32 -05:00
Scott Shawcroft 82fb761c0f
Add PacketBuffer and MTU negotiation support.
PacketBuffer facilitates packet oriented BLE protocols such as BLE
MIDI and the Apple Media Service.

This also adds PHY, MTU and connection event extension negotiation
to speed up data transfer when possible.
2020-01-03 17:29:54 -08:00
Roy Hooper 767ce1cdf8 remove unnecessary GCC pragmas 2020-01-02 18:03:18 -05:00
Roy Hooper f1a9039632 Merge branch 'master' into pixelbuf-subscr-change 2019-12-29 13:56:31 -05:00
Scott Shawcroft b859e2b710
Remove `re` from CPX Displayio build to make space. 2019-12-20 11:43:56 -08:00
Jeff Epler 201f4648c4 py.mk: Fix race condition building .mo files
By having an order-only dependency on the directory itself, the directory
is sure to be created before the rule to create a .mo file is.

This fixes a low-freqency error on github actions such as

> msgfmt: error while opening "build/genhdr/en_US.mo" for writing: No such file or directory
2019-12-16 15:33:55 -06:00
Scott Shawcroft d8e66a5f32
try 2. make namedtuple types handle subclasses 2019-12-13 16:00:04 -08:00
Scott Shawcroft 7f7105d36d
Fix tuple test 2019-12-13 14:52:04 -08:00
Roy Hooper dc8dd6df20 Revert subscr signature change 2019-12-13 14:29:15 -05:00
Roy Hooper 15072c69c9 push changes 2019-12-13 14:07:53 -05:00
Roy Hooper 72ad2e9259 Merge branch 'master' into new-pixelbuf-api 2019-12-13 13:45:16 -05:00
Dan Halbert ef2ef7a6b8 merge from master 2019-12-12 15:51:13 -05:00
Damien George 767d47dd60
py/nlrthumb: Save and restore VFP registers s16-s21 when CPU has them.
These s16-s21 registers are used by gcc so need to be saved.  Future
versions of gcc (beyond v9.1.0), or other compilers, may eventually need
additional registers saved/restored.

See issue #4844.
2019-12-12 11:10:10 -08:00
Damien George 1cf0ce094a
py/nlr: Use MP_UNREACHABLE at the end of arch-specific nlr_jump funcs.
Recent versions of gcc perform optimisations which can lead to the
following code from the MP_NLR_JUMP_HEAD macro being omitted:

    top->ret_val = val; \
    MP_NLR_RESTORE_PYSTACK(top); \
    *_top_ptr = top->prev; \

This is noticeable (at least) in the unix coverage on x86-64 built with gcc
9.1.0.  This is because the nlr_jump function is marked as no-return, so
gcc deduces that the above code has no effect.

Adding MP_UNREACHABLE tells the compiler that the asm code may branch
elsewhere, and so it cannot optimise away the code.
2019-12-12 11:01:40 -08:00
Damien George 63046d800d
py: Introduce MP_UNREACHABLE macro to annotate unreachable code.
And use it to replace the same pattern at the end of nlrthumb.c:nlr_jump.
2019-12-12 11:01:39 -08:00
Dan Halbert 8176325130 Merge remote-tracking branch 'adafruit/master' into ld-cleanup 2019-12-11 22:52:59 -05:00
Dan Halbert 68ae47907c merge from upstream 2019-12-10 21:04:46 -05:00
Roy Hooper 0326c98fd5 Merge branch 'master' into new-pixelbuf-api 2019-12-10 20:44:43 -05:00
Dan Halbert 013c840862 working on all ports 2019-12-10 20:27:30 -05:00
Jeff Epler 6305d48947 gc_free: give a better error when freeing outside of VM 2019-12-10 17:07:52 -06:00
Jeff Epler a08d9e6d8e audiocore: Add MP3File using Adafruit_MP3 library 2019-12-10 14:03:06 -06:00
Scott Shawcroft 19ac8aea8c
Merge pull request #2353 from jepler/audiosample-protocol
Convert audiosamples to use micropython "protocols" (safely)
2019-12-09 14:50:16 -08:00
Dan Halbert d628d2a261 atmel-samd working 2019-12-06 15:18:20 -05:00