Commit Graph

240 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
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 612ba2f45d
Fix DotStar status LED init. 2020-03-17 12:11:11 -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