Commit Graph

50 Commits

Author SHA1 Message Date
Scott Shawcroft 1a0596a2fb
Add option to disable the concurrent write protection
This allows writing to the filesystem from the host computer and
CircuitPython by increasing the risk of filesystem corruption.
2019-02-21 10:45:41 -08:00
Scott Shawcroft 46fd60c703
Prevent infinite display update recursion and fix VFS mounting
Fixes #1529
2019-02-19 14:50:31 -08:00
Dan Halbert 5154e0581e WIP: atmel-samd trinket build works 2019-02-15 00:28:20 -05:00
Scott Shawcroft 473bdf48f6
A safe mode fix and displayio fixes
* Fixes safe mode on the SAMD51. The "preserved" value was being
clobbered by the bootloader.
* Fixes auto-reload loop when in safe mode.
* Fixes reading Group children with [].
* Check that a TileGrid actually moves before queueing a refresh.
2019-02-13 15:31:06 -08:00
Lionel Debroux 943216deda Make several const char / const char * arrays static to save a bit of space.
Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
2019-02-07 20:10:43 +01:00
Scott Shawcroft 601a910f4e
More improvements to Terminal:
* Fix Hallowing.
* Fix builds without displayio.
* Fix y bounds that appears as untrollable row of pixels.
* Add scrolling to TileGrid.
* Remove Sprite to save space. TileGrid is a drop in replacement.
2019-01-31 11:42:14 -08:00
Scott Shawcroft 6145f08cc8
Support adjustable backlight brightness 2019-01-31 11:42:14 -08:00
Scott Shawcroft 1a1dbef992
Hook up the terminal based on the first display. 2019-01-31 11:42:14 -08:00
Scott Shawcroft 6404aaf411
Fix up nrf and using board.SPI in FourWire 2019-01-17 18:19:07 -08:00
Scott Shawcroft 84292ad890
External fourwire works and blinka splash after 2019-01-17 00:20:16 -08:00
Scott Shawcroft 05d8885a1a
Rework displays in prep for dynamic support and 8bit parallel. 2019-01-16 12:05:20 -08:00
Scott Shawcroft 801d9a5abc
Fix running the USB task on nRF.
It wasn't being run due to a rework done only on the atmel-samd port.
The rework itself isn't needed now that the heap check triggers safe
mode instead of throwing a Python exception. So, I've removed the
rework.
2018-12-07 16:11:21 -08:00
Scott Shawcroft 6ef8639971
Rework safe mode and have heap overwrite trigger it.
This creates a common safe mode mechanic that ports can share.
As a result, the nRF52 now has safe mode support as well.

The common safe mode adds a 700ms delay at startup where a reset
during that window will cause a reset into safe mode. This window
is designated by a yellow status pixel and flashing the single led
three times.

A couple NeoPixel fixes are included for the nRF52 as well.

Fixes #1034. Fixes #990. Fixes #615.
2018-12-06 14:24:20 -08:00
Scott Shawcroft 7ad2e6ace3
Add stack validity check and raise an error when it happens.
The backtrace cannot be given because it relies on the validity
of the qstr data structures on the heap which may have been
corrupted.

In fact, it still can crash hard when the bytecode itself is
overwritten. To fix, we'd need a way to skip gathering the
backtrace completely.

This also increases the default stack size on M4s so it can
accomodate the stack needed by ASF4s nvm API.
2018-12-04 23:26:04 -08:00
Dan Halbert 11de8fdca7 merge 3.x swap of /lib and .frozen; update frozen libs 2018-11-15 15:00:23 -05:00
Scott Shawcroft 9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00
Dan Halbert 4dfba2f8ac put .frozen before /lib in sys.path; update frozen libraries 2018-11-01 19:57:10 -04:00
Nick Moore 823ff779ca network module c api into shared-module 2018-10-11 14:02:18 +11:00
Nick Moore 15b59bee1b change initialization method + mod_network names 2018-10-04 22:31:47 +10:00
Scott Shawcroft 32c616b5dd
Initial Grand Central definition
It has a ton of pins in a Mega form-factor

This also includes a change to init the stack earlier. It fixes
a crash that occurs if the flash doesn't start correctly and the
original spot isn't reached.
2018-09-06 16:54:13 -07:00
Dan Halbert 9ea809bef7 add pin claiming to devices 2018-08-31 18:38:05 -04:00
Scott Shawcroft de5a9d72dc
Compress all translated strings with Huffman coding.
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
2018-08-16 17:40:57 -07:00
Scott Shawcroft 933add6cd8
Support internationalisation. 2018-08-07 14:58:57 -07:00
Scott Shawcroft 12cf5e51c2
Allow for resizing the stack area. 2018-07-31 05:18:23 -07:00
Scott Shawcroft 777542c716
Add basic memory allocation outside Python runtime
This allows for the heap to fill all space but the stack. It also
allows us to designate space for memory outside the runtime for
things such as USB descriptors, flash cache and main filename.

Fixes #754
2018-07-31 05:18:03 -07:00
Scott Shawcroft ec78d3cefd
Mark pointers in cpu registers as in use.
This prevents bugs where gc_collect is called from C code that did
a recent allocation.
2018-07-03 05:45:50 -07:00
Dan Halbert e724bc1c4e Fix playing audio from SD card 2018-06-14 18:47:40 -04:00
Jeff Epler 654591e11f main: move code pertaining to boot.py out of line
.. this reduces stack usage in main() substantially, because
the 512 byte stack allocation will only exist during the new run_boot_py
function's duration.

Closes: #904
2018-06-06 08:01:17 -05:00
Jeff Epler a4e06bd998 main: Explicitly set the stack top based on _estack
.. setting it based on the ad-hoc stack pointer calculation of
mp_stack_ctrl_init() meant that the stack used above main() counts
against the 1KiB safety factor that the mp_stack_set_limit call tries
to establish.  It turns out, at least on M4, that over half of the
safety factor is used up by stack-above-main()!

In the case of the basics/gen_stack_overflow.py test,
which blows the stack on purpose, it turns out that gc would be called
while handling the "maximum recursion depth exceeded" error, and this
needed more stack than was left.

Closes: #900
2018-06-05 22:04:55 -05:00
Dan Halbert 990da6d363 wasn't always clearing boot_output_file 2018-05-19 01:01:37 -04:00
Roy Hooper 698912633f Rename reload_next_character to reload_requested to make it match it's intended use 2018-05-14 17:00:38 -04:00
Dan Halbert 224e245e05 clarify comment 2018-05-07 00:08:26 -04:00
Dan Halbert fc214fb320 boot.py change of filesystem writability would get overridden. 2018-05-06 23:48:11 -04:00
Dan Halbert f73e06d910 minor function API improvement 2018-05-04 08:28:05 -04:00
Dan Halbert f486ead84a Handle bad power on reset. 2018-05-03 23:43:02 -04:00
Scott Shawcroft 5f9b3f2b87 Fix the status neopixel flashing.
We were storing the wrong current color.
2018-04-12 13:33:58 -07:00
Dan Halbert aa8c262d14 add storage.erase_filesystem() to erase and reformat CIRCUITPY 2018-04-09 12:52:42 -04:00
Dan Halbert 31f5b6a238 WIP: simple working HID 2018-03-24 18:29:12 -04:00
Scott Shawcroft c7af17525b m4 pulseout works 2018-02-14 11:38:52 -08:00
Scott Shawcroft cc616aea4e m4 tc output works. Watch out for the PAC! 2018-02-12 23:41:26 -08:00
mrmcwethy a38d8948b3 M4 status LED flashing with no main.py present #447 Initialized stack variable 2017-11-22 22:57:50 -08:00
Scott Shawcroft ecc47d5258 Create supervisor module.
It can control autoreload and the rgb status led.
2017-11-16 09:04:17 -08:00
bsiepert b4fc464a4d support for doubled file extensions ala issue #383 (#415)
Fixes #383
2017-11-07 23:00:44 -08:00
Scott Shawcroft 3177e10e9e atmel-samd: Add samd21 neopixel support.
Also, fix and enable the status neopixel.

Fixes #264
2017-10-31 22:38:09 -07:00
Scott Shawcroft 4aeef100f6 atmel-samd: More USB polish
* Introduce a python script to generate the USB descriptor instead of
  a bunch of C macros. In the future, we can use this dynamically in
  CircuitPython.
* Add support for detecting read-only mass storage mounts.

Fixes #377
2017-10-30 18:29:20 -07:00
Dan Halbert 8e45dc041f Read serial input as a background task so we can check for the interrupt character. 2017-10-27 17:32:13 -04:00
Dan Halbert 7f88ba3b26 Revert "Allow main.py to be interrupted by ctrl-C" (#381)
* Revert "Read serial input as a background task so we can check for the interrupt character."

This reverts commit 046092e8a2.

* Revert "Check INTERNAL_LIBM make flag in a safer way."

This reverts commit 2b80add22f.
2017-10-27 17:32:13 -04:00
Dan Halbert 2487226dff Read serial input as a background task so we can check for the interrupt character. 2017-10-27 17:32:13 -04:00
Dan Halbert fabaa2ec30 merge 2.x changes into master; touch up Makefile CFLAGS logic 2017-10-12 20:10:31 -04:00
Scott Shawcroft 6839fff313 Move to ASF4 and introduce SAMD51 support. (#258)
* atmel-samd: Remove ASF3. This will break builds.

* atmel-samd: Add ASF4 for the SAMD21 and SAMD51.

* Introduce the supervisor concept to facilitate porting.

The supervisor is the code which runs individual MicroPython VMs. By
splitting it out we make it more consistent and easier to find.

This also adds very basic SAMD21 and SAMD51 support using the
supervisor. Only the REPL currently works.

This begins the work for #178.
2017-09-22 21:05:51 -04:00