Commit Graph

305 Commits

Author SHA1 Message Date
Jeff Epler 1f3821220e fix build for non-displayio & non-protomatter targets 2020-04-14 18:24:58 -05:00
Jeff Epler 3a94412cd3 protomatter: more memory allocation fixes
- bump supervisor alloc count by 4 (we actually use 5)
 - move reconstruct to after gc heap is reset
 - destroy protomatter object entirely if not used by a FramebufferDisplay
 - ensure previous supervisor allocations are released
 - zero out pointers so GC can collect them
2020-04-14 18:24:58 -05:00
Jeff Epler 094fe05bdd allow retrieving info about a supervisor allocation 2020-04-14 18:24:54 -05:00
Lucian Copeland 5ac38c95cc Various requested fixes 2020-04-13 12:03:05 -04:00
Max Holliday 826837186c adds standard (non-queued) SPI support to QSPI for external flash 2020-04-07 18:17:25 -07:00
Scott Shawcroft c0ba2a839f
Updates based on feedback from jepler 2020-04-06 16:03:31 -07:00
Scott Shawcroft e99cf6e441
Rework sleep timing
It didn't account for background task time and could end up
sleeping for way longer than it should because the RTC compare time
had already passed.
2020-04-03 18:07:56 -07:00
Lucian Copeland 9761672d42 Linker file restructure, TCM and MPU additions 2020-04-03 16:33:18 -04:00
Scott Shawcroft c248730bd1
Clean up 2020-04-02 17:36:09 -07:00
Lucian Copeland 2f764ded63 merge and docs 2020-04-01 13:52:53 -04:00
Lucian Copeland a89928c13c Implement requested changes 2020-04-01 13:02:05 -04:00
Scott Shawcroft 8fe512c7e9
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-03-31 15:13:58 -07:00
Sean Cross 1902579b46 supervisor: enable itcm memory region for fomu
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-31 09:40:38 +08:00
Brian Dean b1d83c3f5e supervisor/shared/external_flash/devices.h: Add MX25L51245G support.
Add external flash support for Macronix MX25L51245G 64MiB SPI flash.
2020-03-25 17:16:09 -04:00
Scott Shawcroft 2623022c84
Initial work for STM32. Need to fix us delay and PulseIn still. 2020-03-20 12:58:34 -07:00
Scott Shawcroft 612ba2f45d
Fix DotStar status LED init. 2020-03-17 12:11:11 -07:00
Scott Shawcroft 4297ae2d0b
Fix DotStar status LED init. 2020-03-17 12:10:12 -07:00
Scott Shawcroft 7100d5e485
Fix autoreload and ticks in general 2020-03-13 16:13:24 -07:00
Scott Shawcroft ed5cdd7e09
Hopefully fix flash flush and hopefully audio as well. 2020-03-13 11:12:31 -07:00
Scott Shawcroft 418333979a
Fix autoreload, neopixel, monotonic_ns and sleep w/o SD 2020-03-13 11:12:31 -07:00
Scott Shawcroft 6f60afe8c5
First try at lowering the power consumption 2020-03-13 11:12:30 -07:00
Jeff Epler 415cb351c7
Merge pull request #2655 from jepler/thing51
samd51 thing plus: new port
2020-02-25 14:13:47 -06:00
jepler f20255813f samd51 thing plus: new port
testing performed:
 * successfully store and retrieve a 500kB file on the flash
 * square wave output on each pin appears on o'scope
 * board.SPI(), board.SERIAL(), board.I2C() all construct
2020-02-25 11:52:23 -06:00
Scott Shawcroft 876c646d09
Fix Mac crash when waking up with an ejected CIRCUITPY
We now correctly set the reason for the unit not being ready and
always start the unit.

Fixes #2567
2020-02-24 15:40:52 -08:00
Scott Shawcroft e8f7141564
Disable BLE file service for now
Fixes #2633
2020-02-20 12:15:56 -08:00
Scott Shawcroft cde9b63eab
Merge pull request #2615 from mubes/label-drive
Allow drive name to be set per target
2020-02-12 10:43:04 -08:00
Dave Marples bfca65d86f Allow drive name to be set per target, with fallback to pre-existing behaviour 2020-02-12 11:09:48 +00:00
Gadi Rotenberg 07708f1518 Added fix to allow remount when usb enabled but msc is ejected 2020-02-12 09:57:58 +02:00
Langston Nashold 76d8e5b399 Add support for external flash device Winbond.com W25Q80DV
Currently, we only support external flash device W25Q80DL. This
adds support for the W25Q80DL.

tweak
2020-02-06 16:46:43 -08:00
hierophect 898f4e1f72
Merge branch 'master' into stm32-meowbit 2020-01-29 16:32:08 -05:00
Lucian Copeland 3c86005546 Implement requested changes 2020-01-28 17:11:25 -05: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
Dan Halbert 6f13979c9b pygamer and pybadge boards were not resetting neopixels 2020-01-24 09:32:28 -05:00
Dan Halbert 68f9aee992 reset NeoPixels on CPB on soft reload 2020-01-23 20:16:31 -05: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
Hierophect 3f43155b63 Meowbit bus conflict WIP 2020-01-17 13:31:12 -05:00
Scott Shawcroft 5fc20145d1
Merge pull request #2390 from jepler/displayio-set-rotation
displayio: make 'rotation' property settable
2019-12-20 09:34:25 -08:00
Scott Shawcroft 561fdfb279
Improve USB eject by resetting on replug 2019-12-17 19:01:03 -08:00
Jeff Epler a63da7a6c0 displayio: make 'rotation' property settable 2019-12-16 15:23:41 -06:00
Dan Halbert ef2ef7a6b8 merge from master 2019-12-12 15:51:13 -05:00
Dan Halbert 1b3028bed1 make translate and remove backslash-r's 2019-12-12 14:51:50 -05:00
Dan Halbert 7889b999cc Fix flash write error handling; clean up safe mode message printing 2019-12-12 14:41:49 -05: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
Dan Halbert 013c840862 working on all ports 2019-12-10 20:27:30 -05:00
Jeff Epler f4a5c17b5e supervisor: external_flash: don't call m_free when it's bad
It's extremely dubious that we have these handles that we think
are to GC'd memory at a time when the gc pool may not be initialized.
Hopefully, they WERE valid GC memory and are undisturbed by the teardown
of the interpreter that can lead to this state.

In this case, don't try to m_free them, the memory will become free when
the GC heap is reinitialized.

Closes: #2338 (together with previous commit)
2019-12-10 17:07:20 -06:00
Jeff Epler b22fbcd77d supervisor: external_flash: don't call m_malloc_maybe when it's bad 2019-12-10 17:06:09 -06:00
Scott Shawcroft e8a54eacaa
Comment supervisor ble data arrays. 2019-12-06 11:13:22 -08:00
Dan Halbert 40434d6919 wip 2019-12-05 22:45:53 -05:00
Scott Shawcroft 17c8356b8c
Add connection interval and debugging
This also sets TinyUSB to master and to not include its submodules.

It also fixes an old displayio example comment and retries gattc
reads.
2019-12-04 14:39:02 -08:00
Scott Shawcroft 15886b1505
Merge pull request #2345 from jepler/compressed-unicode
translation: Compress as unicode, not bytes
2019-12-02 17:11:49 -08:00
Jeff Epler e06a3bbceb translation: Compress as unicode, not bytes
By treating each unicode code-point as a single entity for huffman
compression, the overall compression rate can be somewhat improved
without changing the algorithm.  On the decompression side, when
compressed values above 127 are encountered, they need to be
converted from a 16-bit Unicode code point into a UTF-8 byte
sequence.

Doing this returns approximately 1.5kB of flash storage with the
zh_Latn_pinyin translation. (292 -> 1768 bytes remaining in my build
of trinket_m0)

Other "more ASCII" translations benefit less, and in fact
zh_Latn_pinyin is no longer the most constrained translation!
(de_DE 1156 -> 1384 bytes free in flash, I didn't check others
before pushing for CI)

English is slightly pessimized, 2840 -> 2788 bytes, probably mostly
because the "values" array was changed from uint8_t to uint16_t,
which is strictly not required for an all-ASCII translation.  This
could probably be avoided in this case, but as English is not the
most constrained translation it doesn't really matter.

Testing performed: built for feather nRF52840 express and trinket m0
in English and zh_Latn_pinyin; ran and verified the localized
messages such as
    Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài.
and
    Press any key to enter the REPL. Use CTRL-D to reload.
were properly displayed.
2019-12-02 09:46:46 -06:00
Jeff Epler 95d9c49e43 Merge remote-tracking branch 'origin/master' into tick-refactor 2019-11-29 11:27:09 -06:00
Ayan Pahwa 718a28c886 update filesystem.c 2019-11-26 01:13:46 +05:30
Ayan Pahwa 5e1740d11f Not creating code.py file for non-express boards 2019-11-26 00:06:03 +05:30
Ayan Pahwa 9c6466cffb Fix build failure for boards with less memory 2019-11-25 22:31:01 +05:30
Ayan Pahwa 180b485f8b Enable creation of code.py only for full builds 2019-11-23 20:58:33 +05:30
Ayan Pahwa 262cfd4ea3 Passing address of char_written at f_write 2019-11-23 20:47:30 +05:30
Ayan Pahwa 5823f5ed04 Add \n to file end 2019-11-23 20:43:24 +05:30
Jeff Epler 46c5775ba4 supervisor: tick: add supervisor_fake_tick 2019-11-20 14:37:13 -06:00
Jeff Epler a9baa0f954 supervisor: tick: document 2019-11-20 14:37:13 -06:00
Jeff Epler 70719597ab supervisor: tick: Rewrite without atomics 2019-11-20 14:37:13 -06:00
Ayan Pahwa a0ef667a14 Supervisor: create code.py file with sample code 2019-11-19 01:59:29 +05:30
Jeff Epler 568636d562 run_background_tasks: Do nothing unless there has been a tick
This improves performance of running python code by 34%, based
on the "pystone" benchmark on metro m4 express at 5000 passes
(1127.65 -> 1521.6 passes/second).

In addition, by instrumenting the tick function and monitoring on an
oscilloscope, the time actually spent in run_background_tasks() on
the metro m4 decreases from average 43% to 0.5%. (however, there's
some additional overhead that is moved around and not accounted for
in that "0.5%" figure, each time supervisor_run_background_tasks_if_tick
is called but no tick has occurred)

On the CPB, it increases pystone from 633 to 769, a smaller percentage
increase of 21%.  I did not measure the time actually spent in
run_background_tasks() on CPB.

Testing performed: on metro m4 and cpb, run pystone adapted from python3.4
(change time.time to time.monotonic for sub-second resolution)

Besides running a 5000 pass test, I also ran a 50-pass test while
scoping how long an output pin was set.  Average: 34.59ms or 1445/s on m4,
67.61ms or 739/s on cbp, both matching the other pystone result reasonably
well.

import pystone
import board
import digitalio
import time

d = digitalio.DigitalInOut(board.D13)
d.direction = digitalio.Direction.OUTPUT

while True:
    d.value = 0
    time.sleep(.01)
    d.value = 1
    pystone.main(50)
2019-11-18 11:26:48 -06:00
Jeff Epler 7f744a2369 Supervisor: move most of systick to the supervisor
This code is shared by most parts, except where not all the #ifdefs
inside the tick function were present in all ports.  This mostly would
have broken gamepad tick support on non-samd ports.

The "ms32" and "ms64" variants of the tick functions are introduced
because there is no 64-bit atomic read.  Disabling interrupts avoids
a low probability bug where milliseconds could be off by ~49.5 days
once every ~49.5 days (2^32 ms).

Avoiding disabling interrupts when only the low 32 bits are needed is a minor
optimization.

Testing performed: on metro m4 express, USB still works and
time.monotonic_ns() still counts up
2019-11-18 11:01:23 -06:00
Hierophect 8ff1bc0132 add missing include 2019-11-15 12:49:47 -05:00
Hierophect de5691acf5 Add never_reset and reset to pin common hal, adjust files 2019-11-15 12:47:00 -05:00
Thea Flowers 67ff1c92f0
Allow boards to change the "CircuitPython" text in their USB interface description.
In cases where more than one board is connected to a single computer it can become pretty hard to figure out which board you're actually talking to. For example, if you have several MIDI-compatible boards they all show up as "CircuitPython MIDI". This change allows boards to replace the "CircuitPython" part of their USB descriptors with more specific text, for example, "CircuitPython Feather" or just "Feather". This will let folks more easily tell boards apart.

The new option is named `USB_INTERFACE_NAME` and is available in `mkconfigboard.mk`. For example:

```
USB_INTERFACE_NAME = "Feather"
```
2019-11-12 13:29:35 -08:00
Thea Flowers 73989dbcaf Add board configuration for Winterbloom Sol 2019-11-04 23:11:42 -08:00
Dan Halbert 8cd2f87e99
Merge pull request #2236 from tannewt/bleio_tweaks
Refine _bleio
2019-11-04 22:27:54 -05:00
Scott Shawcroft 47e50e5659
Merge remote-tracking branch 'adafruit/master' into bleio_tweaks 2019-11-01 13:20:58 -07:00
Dan Halbert 99fe905039 Reduce DotStar status brightness; macros for status colors 2019-11-01 13:37:36 -04:00
Dan Halbert ab6fd34828 add object types to rgb status objects;mark spi rgb objects as never_reset 2019-10-25 22:32:43 -04:00
Dan Halbert cdeb0857a9 Initial Itsy nRF52840 defn 2019-10-25 11:15:34 -04:00
Scott Shawcroft ece8352126
Fix build by removing unused vars 2019-10-22 17:24:04 -07:00
Scott Shawcroft ae30a1e5aa
Refine _bleio
This PR refines the _bleio API. It was originally motivated by
the addition of a new CircuitPython service that enables reading
and modifying files on the device. Moving the BLE lifecycle outside
of the VM motivated a number of changes to remove heap allocations
in some APIs.

It also motivated unifying connection initiation to the Adapter class
rather than the Central and Peripheral classes which have been removed.
Adapter now handles the GAP portion of BLE including advertising, which
has moved but is largely unchanged, and scanning, which has been enhanced
to return an iterator of filtered results.

Once a connection is created (either by us (aka Central) or a remote
device (aka Peripheral)) it is represented by a new Connection class.
This class knows the current connection state and can discover and
instantiate remote Services along with their Characteristics and
Descriptors.

Relates to #586
2019-10-21 18:57:03 -07:00
Kamil Tomaszewski f3151bb6c4 Use get top and limit stack functions 2019-10-18 11:05:08 +02:00
Kamil Tomaszewski 96756b3945 Add functions to get top and limit stack 2019-10-18 11:04:45 +02:00
Dan Halbert be8136dc6d Merge remote-tracking branch 'adafruit/master' into bonding1 2019-10-15 15:55:21 -04:00
Scott Shawcroft 1a7c787d3c
Merge branch 'master' into master 2019-10-14 19:47:46 -07:00
arturo182 e0f60d0c17 Add IS25LP128F flash device definition 2019-10-14 23:42:53 +02:00
Cedar Grove Maker Studios f1ab9aaa9c
add def for AT25SF161-SSHD-T 2MiB SPI flash chip 2019-10-14 11:58:14 -07:00
kamtom480 f6e553f89f
Merge branch 'master' into circuitpython-number-endpoint 2019-10-08 09:41:29 +02:00
Kamil Tomaszewski 29844db332 Use boolean type for renumber_endpoints 2019-10-08 09:26:02 +02:00
Kamil Tomaszewski badf32e88d Add HID OUT 2019-10-07 13:40:44 +02:00
Kamil Tomaszewski 1205d3e305 Add validation 2019-10-07 12:31:42 +02:00
Kamil Tomaszewski 7aefcc449a Add an alternative way to number the USB endpoints
Two options available:
- relative numbering (USB_RELATIVE_EP_NUM = 1) - default
- absolute numbering (USB_RELATIVE_EP_NUM = 0) - new!
2019-10-07 12:31:42 +02:00
Dan Halbert fc19e03128 WIP: bonding 2019-10-06 21:30:26 -04:00
Kamil Tomaszewski ef42abb818 Add a way to change max packet size for MSC 2019-10-04 13:49:33 +02:00
Hierophect eacdb1da6e Disable timeout, remove redundancy 2019-10-03 14:43:25 -04:00
Hierophect 8a4bbae077 Fix typo causing parsing error 2019-10-02 18:18:52 -04:00
Hierophect 9aa6d215fd Add some definitions for when F412 can be implemented 2019-10-02 16:03:22 -04:00
Dan Halbert b8200d7295 fix atmel-samd filesystem_tick'ing; clear_temp_status() should check for status indicator in use 2019-09-09 23:17:52 -04:00
Dan Halbert cf6fbcbf2d
Merge pull request #2123 from hierophect/stm32-flashstub-fix
Fix stm32f412zg compile warning
2019-09-06 14:56:24 -04:00
Hierophect bc37649884 Remove unused static function 2019-09-06 11:06:02 -04:00
Dan Halbert f3af2a6fb7 Merge remote-tracking branch 'adafruit/master' into choose-usb-devices-xac 2019-09-04 21:56:13 -04:00
Dan Halbert 195de97c67 use only one endpoint pair for MSC except on SAMD21 2019-09-04 21:45:16 -04:00
Dan Halbert fca440fb66
Merge pull request #2113 from tannewt/displayio_hidden
Add .hidden to TileGrid and Group
2019-09-04 15:48:00 -04:00
Dan Halbert b46c8dcc62
Merge pull request #2065 from hierophect/f411re-feature-buildout
F411re feature buildout
2019-09-04 15:45:54 -04:00
Hierophect 479b047618 Reverted descriptor changes pending HID restructuring 2019-09-04 13:58:18 -04:00