Commit Graph

512 Commits

Author SHA1 Message Date
Jeff Epler 87d3740c64 Merge tag 'v1.16' 2021-06-18 10:54:19 -05:00
Jeff Epler 11288c1c28 esp32s2: Add rgbmatrix support 2021-05-26 11:21:59 -05:00
Damien George 0aa01b0205 lib/mbedtls: Switch to currently latest commit of LTS branch v2.16.
Signed-off-by: Damien George <damien@micropython.org>
2021-05-25 00:04:01 +10:00
Scott Shawcroft 966d25c6a5
Merge MicroPython v1.15 into CircuitPython 2021-05-12 17:51:42 -07:00
Scott Shawcroft e02a26453c
Merge MicroPython 1.14 into CircuitPython 2021-05-11 15:07:40 -07:00
Ayke van Laethem 70f50c46cc lib/utils: Add ARM semihosting utility functions.
This can be a replacement for a UART in custom ports.
2021-05-11 23:33:12 +10:00
Damien George b6b39bff47 py/gc: Make gc_lock_depth have a count per thread.
This commit makes gc_lock_depth have one counter per thread, instead of one
global counter.  This makes threads properly independent with respect to
the GC, in particular threads can now independently lock the GC for
themselves without locking it for other threads.  It also means a given
thread can run a hard IRQ without temporarily locking the GC for all other
threads and potentially making them have MemoryError exceptions at random
locations (this really only occurs on MCUs with multiple cores and no GIL,
eg on the rp2 port).

The commit also removes protection of the GC lock/unlock functions, which
is no longer needed when the counter is per thread (and this also fixes the
cas where a hard IRQ calling gc_lock() may stall waiting for the mutex).

It also puts the check for `gc_lock_depth > 0` outside the GC mutex in
gc_alloc, gc_realloc and gc_free, to potentially prevent a hard IRQ from
waiting on a mutex if it does attempt to allocate heap memory (and putting
the check outside the GC mutex is now safe now that there is a
gc_lock_depth per thread).

Signed-off-by: Damien George <damien@micropython.org>
2021-05-10 13:07:16 +10:00
Scott Shawcroft 3fda0c0a1b
Fix board builds and use MP_ERROR_TEXT in py and extmod 2021-05-05 17:51:52 -07:00
Scott Shawcroft f0bb26d70f
Merge MicroPython 1.13 into CircuitPython 2021-05-04 18:06:33 -07:00
Scott Shawcroft b35fa44c8a
Merge MicroPython 1.12 into CircuitPython 2021-05-03 14:01:18 -07:00
Scott Shawcroft 76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -07:00
Damien George 530c76f6ca lib/utils: Remove unused PYEXEC_SWITCH_MODE from pyexec.h.
It was made obsolete by commit c98c128fe8.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-24 00:10:59 +10:00
Scott Shawcroft 09f7b43c64
Merge MicroPython 1.10 into CircuitPython 2021-04-21 15:59:17 -07:00
Scott Shawcroft b057fb8a4b
codeformat 2021-04-19 22:22:44 -07:00
Jeff Epler 95a75b0410 update protomatter 2021-04-13 08:48:40 -05:00
hathach 7c3975ecf2 update tinyusb to fix midi buffer overflow issue 2021-04-02 17:57:56 +07:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Damien George a62e791978 lib/pico-sdk: Update to latest version 1.1.0.
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12 01:00:00 +11:00
Yonatan Goldschmidt 098ac11bb0 lib/utils/gchelper_generic: Implement AArch64 support. 2021-03-11 12:54:05 +11:00
Mirko Vogt 7d73b9ff99 lib/mbedtls: Switch to currently latest commit of LTS branch v2.16.
From a version numbering point of view this is a downgrade (2.17.0 ->
2.16.x).  However the latest commit for version 2.17.0 is from March 2019
and no further minor release happened after 2.17.0.  This version is EOL.
2.16.x though is still actively maintained as a long term release, hence
security and stability fixes are still being backported, including
compatibility with upcoming compiler releases.
2021-03-11 11:49:18 +11:00
Jeff Epler c95def0b32 raspberrypi: Enable mp3 playback
The rp2040 is _very_ marginal for mp3 playback, and currently sometimes triggers a bug that gives garbled audio output.  However, it does work for some limited situations.
2021-03-10 18:44:10 -06:00
Scott Shawcroft e3d4036f2e
Update TinyUSB 2021-03-08 17:24:03 -08:00
Dan Halbert b1268107af change esp build cache key (again) 2021-03-04 15:22:56 -05:00
hathach c26120a3ac update tinyusb 2021-03-04 21:29:04 +07:00
Jeff Epler 407a8c222a protomatter: get an rp2 fix by updating 2021-03-01 15:13:47 -06:00
Jeff Epler 1d1ff5f308 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-02-26 09:56:35 -06:00
Kamil Tomaszewski dafdd246bc Update tinyUSB 2021-02-24 18:27:54 +01:00
Kamil Tomaszewski ced820c8a7 Update tinyUSB 2021-02-24 18:19:18 +01:00
Jeff Epler ff1942cff6 Enable protomatter on RP2040 builds
Also found a race condition between timer_disable and redraw, which
would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable
or put a delay or print inside it.  That's what pausing inside reconstruct
fixes.

So that the "right timer" can be chosen, `timer_allocate` now gets the `self`
pointer.  It's guaranteed at this point that the pin information is accurate,
so you can e.g., find a PWM unit related to the pins themselves.
This required touching each port to add the parameter even though it's
unused everywhere but raspberrypi.
2021-02-12 08:25:15 -06:00
Damien George 9b7d8b87ee lib/tinyusb: Update to version 0.8.0.
Includes support for RP2040.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-12 12:50:22 +11:00
Damien George 9b277d9815 lib/pico-sdk: Update to latest version v1.0.1.
In particular it fixes GPIO19 so that it can be used as an output.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-02 10:59:27 +11:00
stijn fca2730ea0 lib/utils/pyexec: Remove obsolete LCD initialization.
This was added a long time ago in 75abee206d
when USB host support was added to the stm (now stm32) port, and when this
pyexec code was actually part of the stm port.  It's unlikely to work as
intended anymore.  If it is needed in the future then generic hook macros
can be added in pyexec.
2021-01-30 13:41:36 +11:00
Damien George ef3ee7aa10 lib/pico-sdk: Add new pico-sdk submodule, for the rp2 port.
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 23:57:10 +11:00
Damien George 33f10381d6 lib/timeutils: Provide simple impl of extra funcs when Epoch is 1970.
Dates/times must be post 2000/1/1 to work correctly with these simple
implementations.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 23:57:10 +11:00
Jeff Epler 51f0544405 protmatter: Update to version that supports tiling 2021-01-26 09:19:44 -06:00
Kamil Tomaszewski 30a1c52e75 Update TinyUSB 2021-01-25 18:40:14 +01:00
Scott Shawcroft b73b30ff9f
Switch to upstream TinyUSB 2021-01-21 11:33:13 -08:00
Scott Shawcroft 733094aead
Add initial RP2040 support
The RP2040 is new microcontroller from Raspberry Pi that features
two Cortex M0s and eight PIO state machines that are good for
crunching lots of data. It has 264k RAM and a built in UF2
bootloader too.

Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf
2021-01-20 19:16:56 -08:00
Damien George 0ce6948653 lib/libhydrogen: Add new libhydrogen submodule.
This library is a small and easy-to-use cryptographic library which is well
suited to embedded systems.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-18 12:43:01 +11:00
Jeff Epler 8e51139da0 update uzlib to v2.9.5
uzlib isn't actually used in any firmwares, but is built into the
"unix" port used for testing.

The main benefit of the update is to fix problems encountered on
Windows, as the old ref of uzlib had filenames with embedded colons;
this has been fixed upstream.

uzlib seems to have been reabsed since the version that we took; this
doesn't really matter to us.
2021-01-14 13:45:42 -06:00
Dan Halbert 39c166ba6a update tinyusb; _ticks_enabled only for SAMD21 2021-01-08 13:30:11 -05:00
Damien George f694a6fa20 lib/stm32lib: Update library for WB v1.10.0.
Changes in this new library version are:
- Update WB HAL to v1.10.0.

Signed-off-by: Damien George <damien@micropython.org>
2020-12-10 12:26:24 +11:00
Damien George 8a29319a15 lib/littlefs: Guard lfs2_mlist_isopen with LFS2_NO_ASSERT.
To prevent warnings about this function being unused when assertions are
disabled.

Signed-off-by: Damien George <damien@micropython.org>
2020-12-09 13:19:31 +11:00
Damien George d9d761b057 lib/littlefs: Update littlefs2 to v2.3.0.
At commit 1a59954ec64ca168828a15242cc6de94ac75f9d1

Signed-off-by: Damien George <damien@micropython.org>
2020-12-09 11:01:24 +11:00
Dan Halbert 8b7c23c1ee address review comments 2020-12-01 20:01:14 -05:00
Damien George bb24c69b90 lib/utils/pyexec: Add stdin-reader on raw REPL with flow control.
Background: the friendly/normal REPL is intended for human use whereas the
raw REPL is for computer use/automation.  Raw REPL is used for things like
pyboard.py script_to_run.py.  The normal REPL has built-in flow control
because it echos back the characters.  That's not so with raw REPL and flow
control is just implemented by rate limiting the amount of data that goes
in.  Currently it's fixed at 256 byte chunks every 10ms.  This is sometimes
too fast for slow MCUs or systems with small stdin buffers.  It's also too
slow for a lot of higher-end MCUs, ie it could be a lot faster.

This commit adds a new raw REPL mode which includes flow control: the
device will echo back a character after a certain number of bytes are sent
to the host, and the host can use this to regulate the data going out to
the device.  The amount of characters is controlled by the device and sent
to the host before communication starts.  This flow control allows getting
the maximum speed out of a serial link, regardless of the link or the
device at the other end.

Also, this new raw REPL mode parses and compiles the incoming data as it
comes in.  It does this by creating a "stdin reader" object which is then
passed to the lexer.  The lexer requests bytes from this "stdin reader"
which retrieves bytes from the host, and does flow control.  What this
means is that no memory is used to store the script (in the existing raw
REPL mode the device needs a big buffer to read in the script before it can
pass it on to the lexer/parser/compiler).  The only memory needed on the
device is enough to parse and compile.

Finally, it would be possible to extend this new raw REPL to allow bytecode
(.mpy files) to be sent as well as text mode scripts (but that's not done
in this commit).

Some results follow. The test was to send a large 33k script that contains
mostly comments and then prints out the heap, run via pyboard.py large.py.

On PYBD-SF6, prior to this PR:

$ ./pyboard.py large.py
stack: 524 out of 23552
GC: total: 392192, used: 34464, free: 357728
 No. of 1-blocks: 12, 2-blocks: 2, max blk sz: 2075, max free sz: 22345
GC memory layout; from 2001a3f0:
00000: h=hhhh=======================================hhBShShh==h=======h
00400: =====hh=B........h==h===========================================
00800: ================================================================
00c00: ================================================================
01000: ================================================================
01400: ================================================================
01800: ================================================================
01c00: ================================================================
02000: ================================================================
02400: ================================================================
02800: ================================================================
02c00: ================================================================
03000: ================================================================
03400: ================================================================
03800: ================================================================
03c00: ================================================================
04000: ================================================================
04400: ================================================================
04800: ================================================================
04c00: ================================================================
05000: ================================================================
05400: ================================================================
05800: ================================================================
05c00: ================================================================
06000: ================================================================
06400: ================================================================
06800: ================================================================
06c00: ================================================================
07000: ================================================================
07400: ================================================================
07800: ================================================================
07c00: ================================================================
08000: ================================================================
08400: ===============================================.....h==.........
       (349 lines all free)

(the big blob of used memory is the large script).

Same but with this PR:

$ ./pyboard.py large.py
stack: 524 out of 23552
GC: total: 392192, used: 1296, free: 390896
 No. of 1-blocks: 12, 2-blocks: 3, max blk sz: 40, max free sz: 24420
GC memory layout; from 2001a3f0:
00000: h=hhhh=======================================hhBShShh==h=======h
00400: =====hh=h=B......h==.....h==....................................
       (381 lines all free)

The only thing in RAM is the compiled script (and some other unrelated
items).

Time to download before this PR: 1438ms, data rate: 230,799 bits/sec.

Time to download with this PR: 119ms, data rate: 2,788,991 bits/sec.

So it's more than 10 times faster, and uses significantly less RAM.

Results are similar on other boards. On an stm32 board that connects via
UART only at 115200 baud, the data rate goes from 80kbit/sec to
113kbit/sec, so gets close to saturating the UART link without loss of
data.

The new raw REPL mode also supports a single ctrl-C to break out of this
flow-control mode, so that a ctrl-C can always get back to a known state.
It's also backwards compatible with the original raw REPL mode, which is
still supported with the same sequence of commands.  The new raw REPL
mode is activated by ctrl-E, which gives an error on devices that do not
support the new mode.

Signed-off-by: Damien George <damien@micropython.org>
2020-11-30 11:37:44 +11:00
hathach bafa0501d1 update to have tud_connected() 2020-11-24 22:06:59 +07:00
hathach 5351a93c70 update tinyusb to fix cdc connection race
issue is fixed in https://github.com/hathach/tinyusb/pull/557
2020-11-23 13:39:14 +07:00
Damien George 7789cd5f16 lib/utils/pyexec: Add MICROPY_BOARD hooks before/after executing code.
Signed-off-by: Damien George <damien@micropython.org>
2020-11-11 21:47:13 +11:00
Jeff Epler b293aa7e09 protomatter: Update to upstream tag 1.0.10
Among other things this fixes a problem with blanking the display
and Closes #3664.
2020-11-10 09:12:16 -06:00
Jeff Epler 5e38bb98cb rgbmatrix: update protomatter to 1.0.5 tag
this is compile-tested on
 stm32f405 feather
 matrixportal
 nrf52840 feather

but not actually tested-tested.
2020-10-10 14:30:37 -05:00
Jeff Epler 1cdc91dce6 Update protomatter
This brings in the following, and updates us to the 1.0.4 release tag:

Submodule lib/protomatter 2a1ba8fa4..5f07ec618:
  > Bumping version for release
  > Merge pull request #21 from makermelissa/master
  > Merge pull request #20 from makermelissa/master
  > Merge pull request #18 from jepler/fix-cpy-3184
  > Merge pull request #14 from hierophect/cpy-timer-allocator

We previously had the _changes_ of jepler/fix-cpy-3184 and
hierophect/cpy-timer-allocator but not their merge commits.

The only other changes in protomatter were one formatting change in the
core, plus several Arduino sketches.  So this should make no practical
difference for CPy.
2020-10-03 13:21:58 -05:00
Scott Shawcroft 73d08df9ad
Update TinyUSB to get MIDI SysEx fix
Fixes #3465
2020-09-25 12:23:31 -07:00
Damien George 8f20cdc353 all: Rename absolute time-based functions to include "epoch".
For time-based functions that work with absolute time there is the need for
an Epoch, to set the zero-point at which the absolute time starts counting.
Such functions include time.time() and filesystem stat return values.  And
different ports may use a different Epoch.

To make it clearer what functions use the Epoch (whatever it may be), and
make the ports more consistent with their use of the Epoch, this commit
renames all Epoch related functions to include the word "epoch" in their
name (and remove references to "2000").

Along with this rename, the following things have changed:

- mp_hal_time_ns() is now specified to return the number of nanoseconds
  since the Epoch, rather than since 1970 (but since this is an internal
  function it doesn't change anything for the user).

- littlefs timestamps on the esp8266 have been fixed (they were previously
  off by 30 years in nanoseconds).

Otherwise, there is no functional change made by this commit.

Signed-off-by: Damien George <damien@micropython.org>
2020-09-18 17:20:34 +10:00
Jim Mussared 23109988c2 stm32/uart: Allow static IRQ handler registration.
This will allow the HCI UART to use a non-heap mp_irq_obj_t, which avoids
needing to make a root pointer for it.
2020-09-08 10:46:30 +10:00
Damien George 3ff7079277 lib/utils/mpirq: Add mp_irq_init func, and clean up unused init method.
mp_irq_init() is useful when the IRQ object is allocated by the caller.

The mp_irq_methods_t.init method is not used anywhere so has been removed.

Signed-off-by: Damien George <damien@micropython.org>
2020-09-04 12:40:38 +10:00
Scott Shawcroft 96cf60fbbd
Merge remote-tracking branch 'adafruit/main' into native_wifi 2020-09-03 16:34:56 -07:00
Damien George 38959ed8f1 lib/libm: Reduce size of static two_over_pi array.
Thanks to Jeff Epler for the idea.

Signed-off-by: Damien George <damien@micropython.org>
2020-09-04 00:45:56 +10:00
Jeff Epler 2f120c70ee rgbmatrix: recover gracefully from allocation errors
e.g., allocating a 192x32x6bpp matrix would be enough to trigger this
reliably on a Metro M4 Express using the "memory hogging" layout.
Allocating 64x32x6bpp could trigger it, but somewhat unreliably.

There are several things going on here:
 * we make the failing call with interrupts off
 * we were throwing an exception with interrupts off
 * protomatter failed badly in _PM_free when it was partially-initialized

Incorporate the fix from protomatter, switch to a non-throwing malloc
variant, and ensure that interrupts get turned back on.

This decreases the quality of the MemoryError (it cannot report the size
of the failed allocation) but allows CircuitPython to survive, rather
than faulting.
2020-09-01 10:55:45 -05:00
Scott Shawcroft 767ca5c3dc
Merge remote-tracking branch 'adafruit/main' into native_wifi 2020-08-27 11:42:31 -07:00
Scott Shawcroft 8b71e26abd
Merge remote-tracking branch 'adafruit/main' into native_wifi 2020-08-25 16:39:23 -07:00
Jeff Epler e9bc8e892b pyexec: Handle a ctrl-c that comes in "very late"
In relatively unusual circumstances, such as entering `l = 17 ** 17777`
at the REPL, you could hit ctrl-c, but not get KeyboardInterrupt.
This can lead to a condition where the display would stop updating (#2689).
2020-08-25 11:45:00 -05:00
Damien George badd351150 lib/timeutils: Add helper functions to deal with nanosecs since 1970.
Signed-off-by: Damien George <damien@micropython.org>
2020-08-22 15:41:10 +10:00
George Waters ebabc5db37
Handle home, delete, & emacs key w/ utf-8 in repl 2020-08-19 23:25:20 -04:00
Scott Shawcroft eb8b42aff1
Add basic error handling 2020-08-19 14:23:28 -07:00
George Waters 398be76bf6
Count utf8 chars, not every byte for line 2020-08-09 14:07:13 -04:00
George Waters 93829e57b2
Try too make new utf-8 code smaller again 2020-08-09 13:14:02 -04:00
George Waters 41ccbbd4e9
Fix failed unix build 2020-08-09 13:14:02 -04:00
George Waters 71ce480dbb
Refactor utf-8 code, reduce impact on code size 2020-08-09 13:14:02 -04:00
George Waters 1d410bb68b
Fix repl support for unicode
Currently when a utf8 character that is bigger than 1 byte is typed in
the repl, it isn't handled how it should be. If you try to move the
cursor in any direction the text gets messed up. This fixes that.
2020-08-09 13:14:01 -04:00
Jeff Epler c0b32976e8 libm: rem_pio2: Reduce size of static array
This array was of 32-bit values, but the entries were only ever
in the 0-255 range.  Convert to uint8_t.

Testing performed: The result of the sum-of-sin was unchanged
>>> import math; sum(math.sin(2.**i) for i in range(21))
1.42069
2020-08-04 14:45:45 -05:00
Jeff Epler d3fb6c96da libm: ef_rem_pio2.c: Save ROM-tables at the expense of speed
This function computes the remainder of a value `x` modulo pi/2, to high
precision.

It does this by dividing the flotaing point values into several ranges
by magnitude, and applies successively slower but more accurate algorithms.

The last two steps, one covering values up to around 2^7 * pi/2
(called "medium size") and a final one covering all possible float values,
require big tables.

By eliminating the "medium size" case, a table and some code are removed
from the binary.  This makes some cases take longer, but saves hundreds
of bytes.  It does _NOT_ affect the result, only the speed.

```
[desktop python]
>>> sum(math.sin(2.**i) for i in range(21))
1.4206898748939305

[trinket m0, before change to ef_rem_pio2.c]
>>> sum(math.sin(2.**i) for i in range(21))
1.42069

[trinket m0, after change to ef_rem_pio2.c]
>>> sum(math.sin(2.**i) for i in range(21))
1.42069
```
2020-08-04 14:45:45 -05:00
hathach 93cc505144
update tinyusb to commit 22100b252
fix warnings on esp32s2 and stm32
2020-07-29 19:18:46 +07:00
hathach 9f3bddbcb2
update tinyusb from commmit dc5445e2f to 78f1576e9 2020-07-29 16:23:21 +07:00
hierophect e232ec10ce
Merge branch 'main' into stm32-timer-allocator 2020-07-22 13:59:39 -04:00
Damien George d9b7261024 lib/libc: Fix string0's implementation of strncpy.
Fixing 98e583430f, the semantics of strncpy
require that the remainder of dst be filled with null bytes.

Signed-off-by: Damien George <damien@micropython.org>
2020-07-22 16:29:54 +10:00
Zoltán Vörös 27767aafa2 lib/libm_dbl: Add round.c source code.
This code is imported from musl, to match existing code in libm_dbl.

The file is also added to the build in stm32/Makefile.  It's not needed by
the core code but, similar to c5cc64175b,
allows round() to be used by user C modules or board extensions.
2020-07-21 11:07:19 +10:00
Damien George f80b1d8535 lib/stm32lib: Update library for H7 v1.6.0 and WB v1.6.0.
Changes in this new library version are:
- Update H7 HAL to v1.6.0.
- Update WB HAL to v1.6.0.
- Add patches to fix F4 ll_uart clock selection for UART9/UART10.

Signed-off-by: Damien George <damien@micropython.org>
2020-07-21 01:02:58 +10:00
Thorsten von Eicken 3e758ef235 lib/mbedtls_errors: Add code to patch mbedtls for shortened error strs.
The file `mbedtls_errors/mp_mbedtls_errors.c` can be used instead of
`mbedtls/library/error.c` to give shorter error strings, reducing the build
size of the error strings from about 12-16kB down to about 2-5kB.
2020-07-20 23:53:27 +10:00
Thorsten von Eicken 98e583430f lib/libc: Add implementation of strncpy. 2020-07-20 23:42:04 +10:00
Lucian Copeland cdfc3a2d37 Check out active protomatter PR 2020-07-16 12:08:40 -04:00
Scott Shawcroft 51c888d4be
Merge pull request #3003 from Flameeyes/master
License tagging according to REUSE specifications.
2020-07-13 16:28:49 -07:00
Jeff Epler f1509debc3 lib/mp3: update to 1.2.2 release
This fixes the audio clipping bug
2020-07-09 10:05:08 -05:00
Diego Elio Pettenò 34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01:00
Damien George 9d5edb3559 lib/utils: Protect all of mpirq.c with MICROPY_ENABLE_SCHEDULER.
So it can be unconditionally included in a port's build even if certain
configurations in that port do not use its features, to simplify the
Makefile.

Signed-off-by: Damien George <damien@micropython.org>
2020-06-30 22:31:41 +10:00
David Lechner 77ed6f69ac tools/uncrustify: Enable more opts to remove space between func and '('.
With only `sp_func_proto_paren = remove` set there are some cases where
uncrustify misses removing a space between the function name and the
opening '('.  This sets all of the related options to `force` as well.
2020-06-19 22:07:32 +10:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Damien George b2030e1661 lib/utils/pyexec: Add missing MP_ERROR_TEXT when compiler disabled. 2020-06-02 15:43:44 +10:00
Damien George 4bbba3060d lib/utils: Lock the scheduler when executing hard callback functions.
Otherwise scheduled functions may execute during the hard callback and then
fail if they try to allocate heap memory.
2020-05-27 17:53:31 +10:00
Sean Cross 5ed4e4d0ab lib: tinyusb: update to get tud_task_is_queue_empty
This update gives us access to a function we can run with interrupts
disabled to determine if the queue is empty.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-21 21:34:44 +08:00
Scott Shawcroft 164628282d
Update TinyUSB and shorten USB task delay 2020-05-18 17:27:49 -07:00
Damien George 9ee5aff334 lib/nrfx: Upgrade to nrfx v2.0.0. 2020-05-15 15:06:02 +10:00
Jeff Epler 182ae10080 Fix build after #2831 (stm32f4xx rgbmatrix) broke it 2020-05-07 18:32:50 -05:00
Scott Shawcroft c3b3eb4c21
Merge pull request #2831 from jepler/rgbmatrix-stm
stm: enable RGBMatrix
2020-05-06 08:35:25 -07:00
Jeff Epler e5be728c1c stm: enable protomatter
Testing performed: on stm32f405 feather, all pins change in plausible ways
on a logic probe.  Didn't actually drive a display yet.
2020-04-30 08:58:58 -05:00
Scott Shawcroft 18657b6539
Update TinyUSB to include SAMD race fix 2020-04-29 10:52:26 -07:00
Jim Mussared 710426024a all: Factor gchelper code to one place and use it for unix & ARM ports.
No functionality change is intended with this commit, it just consolidates
the separate implementations of GC helper code to the lib/utils/ directory
as a general set of helper functions useful for any port.  This reduces
duplication of code, and makes it easier for future ports or embedders to
get the GC implementation correct.

Ports should now link against gchelper_native.c and either gchelper_m0.s or
gchelper_m3.s (currently only Cortex-M is supported but other architectures
can follow), or use the fallback gchelper_generic.c which will work on
x86/x64/ARM.

The gc_helper_get_sp function from gchelper_m3.s is not really GC related
and was only used by cc3200, so it has been moved to that port and renamed
to cortex_m3_get_sp.
2020-04-29 23:45:19 +10:00
Jim Mussared c37fd78071 lib/btstack: Update to c8b9823 for USB HCI reset timeout fix. 2020-04-29 16:54:12 +10:00
Scott Shawcroft 755d404edf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-27 16:45:10 -07:00
Damien George e08ca78f40 py/stream: Remove mp_stream_errno and use system errno instead.
This change is made for two reasons:

1. A 3rd-party library (eg berkeley-db-1.xx, axtls) may use the system
   provided errno for certain errors, and yet MicroPython stream objects
   that it calls will be using the internal mp_stream_errno.  So if the
   library returns an error it is not known whether the corresponding errno
   code is stored in the system errno or mp_stream_errno.  Using the system
   errno in all cases (eg in the mp_stream_posix_XXX wrappers) fixes this
   ambiguity.

2. For systems that have threading the system-provided errno should always
   be used because the errno value is thread-local.

For systems that do not have an errno, the new lib/embed/__errno.c file is
provided.
2020-04-27 23:58:46 +10:00