Commit Graph

420 Commits

Author SHA1 Message Date
Jeff Epler 1ca29ec47c Merge remote-tracking branch 'origin/main' into audioout-esp32 2021-01-12 09:23:07 -06:00
Dan Halbert 047708e36e
Merge pull request #3973 from kattni/update-code-py
Update created code.py file formatting.
2021-01-11 19:56:18 -05:00
Kattni Rembor 09596ddca2 Adding escape characters. 2021-01-11 16:26:27 -05:00
Kattni Rembor 9e9291777f Update created code.py file formatting. 2021-01-11 16:09:05 -05:00
Jeff Epler e20c65d8f0 background tasks: Add, use port_wake_main_task
Some ports need an extra operation to ensure that the main task is
awoken so that a queued background task will execute during an ongoing
light sleep.

This removes the need to enable supervisor ticks while I2SOut is operating.

Closes: #3952
2021-01-09 14:02:47 -06:00
Dan Halbert 255ffa979c avoid inline compile errors 2021-01-08 23:07:21 -05:00
DavePutz ce55822680
Fix size of memset in board_reset_user_neopixels() 2021-01-04 15:50:09 -06:00
Dan Halbert 938a0fa2fc
Add include to tick.c for mp_hal_is_interrupted() 2020-12-26 13:39:48 -05:00
Dan Halbert 8061a2574d
Merge branch 'main' into pin_alarm 2020-12-23 22:05:02 -05:00
Scott Shawcroft 8b5b602ea7
Merge pull request #3862 from dhalbert/storage-remount
unmounted filesystems start as ejected
2020-12-22 10:11:54 -08:00
Dan Halbert f226f4a233
Merge pull request #3864 from djix123/w25q64fv
Add support for Winbond W25Q64FV
2020-12-22 09:29:22 -05:00
Jonathan Giles 17e7973ff2 Add support for Winbond W25Q64FV 2020-12-22 07:50:56 -05:00
Dan Halbert 3b4c14f3ec unmounted filesystems start as ejected 2020-12-21 20:43:46 -05:00
Dan Halbert 233ccaac58
Merge pull request #3824 from skerr92/add_more_spi_flash
Adding Support for AT25DF641A SPI Flash
2020-12-21 14:48:36 -05:00
Hany Elkomy 70a9c601a8
Update devices.h
Correct capacity value for the MX25R1635F from 0x18 to 0x15 (tested and working)
refer to 
https://github.com/adafruit/circuitpython/issues/3558
2020-12-17 12:52:51 +08:00
Seth Kerr ca757f2ead removed comments on 64MiB SPI flash causing build test issues 2020-12-16 10:25:20 -05:00
Scott Shawcroft 1ad49d9a18
Add alarm.pin that wakes on pin level
Fixes #3787
2020-12-15 18:12:59 -08:00
Seth Kerr 6d8642bf41 fixing line comment issue with CI build tests 2020-12-14 17:17:28 -05:00
Seth Kerr 731cdefe80 this should be it. 2020-12-14 16:25:33 -05:00
Scott Shawcroft 0b4bcd9599
Fix build and more comments 2020-12-08 13:05:21 -08:00
Scott Shawcroft 40118bcf57
Add `board_deinit` for use with sleep
This changes lots of files to unify `board.h` across ports. It adds
`board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to
deinit the board before deep sleeping (even when pretending.)

Deep sleep is now a two step process for the port. First, the
port should prepare to deep sleep based on the given alarms. It
should set alarms for both deep and pretend sleep. In particular,
the pretend versions should be set immediately so that we don't
miss an alarm as we shutdown. These alarms should also wake from
`port_idle_until_interrupt` which is used when pretending to deep
sleep.

Second, when real deep sleeping, `alarm_enter_deep_sleep` is called.
The port should set any alarms it didn't during prepare based on
data it saved internally during prepare.

ESP32-S2 sleep is a bit reorganized to locate more logic with
TimeAlarm. This will help it scale to more alarm types.

Fixes #3786
2020-12-08 10:52:25 -08:00
Scott Shawcroft d7ba641ff6
Merge pull request #3767 from dhalbert/sleep
Initial alarm and sleep PR: time alarms with light and deep sleep; PinAlarms not yet implemented
2020-12-02 12:51:43 -08:00
Christian Walther d6f8a43f6c Eliminate goto. 2020-11-30 23:33:38 +01:00
Christian Walther 11ed6f86f0 Optimize out allocation moving code on boards that don't need it.
When no features are enabled that use movable allocations, supervisor_move_memory() is not needed.
2020-11-29 16:27:36 +01:00
Christian Walther 9ecaa16ece Unify redundant low/high_address computation to save a bit of code size. 2020-11-29 16:04:31 +01:00
Christian Walther 993a581f5e Make CIRCUITPY_SUPERVISOR_ALLOC_COUNT dependent on enabled features.
Avoids wasted memory and makes it easier to keep track of who needs how much for future additions.
2020-11-28 17:54:34 +01:00
Christian Walther 7ca36d45a4 Fix align32_size().
It not only caused crashes with requests larger than 64K (can happen with RGBMatrix), but also generated a lot longer code than necessary.
2020-11-28 17:54:34 +01:00
Christian Walther 2ba9805f84 Use movable allocation system for terminal tilegrid.
Moving memory is now done by the infrastructure and neither necessary nor correct here anymore.
2020-11-28 17:54:34 +01:00
Christian Walther c7404a3ff8 Add movable allocation system.
This allows calls to `allocate_memory()` while the VM is running, it will then allocate from the GC heap (unless there is a suitable hole among the supervisor allocations), and when the VM exits and the GC heap is freed, the allocation will be moved to the bottom of the former GC heap and transformed into a proper supervisor allocation. Existing movable allocations will also be moved to defragment the supervisor heap and ensure that the next VM run gets as much memory as possible for the GC heap.

By itself this breaks terminalio because it violates the assumption that supervisor_display_move_memory() still has access to an undisturbed heap to copy the tilegrid from. It will work in many cases, but if you're unlucky you will get garbled terminal contents after exiting from the vm run that created the display. This will be fixed in the following commit, which is separate to simplify review.
2020-11-28 17:50:23 +01:00
Dan Halbert e308a9ec11 working! PinAlarm not implemented yet. 2020-11-27 16:03:37 -05:00
Dan Halbert ef0830bfe2 merge from upstream + wip 2020-11-25 17:52:06 -05:00
Dan Halbert 7a45afc549 working, but need to avoid deep sleeping too fast before USB ready 2020-11-23 22:44:53 -05:00
Dan Halbert a0f1ec3c4a wip 2020-11-22 19:10:09 -05:00
Dan Halbert 75559f35cc wip: ResetReason to microcontroller.cpu 2020-11-21 23:29:52 -05:00
Dan Halbert e4c66990e2 compiles 2020-11-20 23:33:39 -05:00
Dan Halbert 39e1f52e28 wip; not compiling yet 2020-11-19 17:47:12 -05:00
Dan Halbert 649c930536 wip 2020-11-19 15:43:39 -05:00
Jeff Epler 331aa6e59f displayio: When the display is tall, move blinka above the text
This makes a more useful display on the portrait magtag, allowing 21
characters across instead of just 18.  There are 20 full rows of text,
instead of 21.  The total number of characters increases slightly from 378
to 420.

For comparison, the Commodore VIC 20 had 22 rows of 23 characters for a
total of 506 characters. :-P
2020-11-19 11:43:18 -06:00
Dan Halbert ffff02c053 Merge remote-tracking branch 'adafruit/main' into sleep 2020-11-16 12:06:11 -05:00
Dan Halbert bb77f1d130 wip: initial code changes, starting from @tannewt's sleepio branch 2020-11-16 11:56:20 -05:00
Scott Shawcroft bda3267432
Save flash space
* No weak link for modules. It only impacts _os and _time and is
  already disabled for non-full builds.
* Turn off PA00 and PA01 because they are the crystal on the Metro
  M0 Express.
* Change ejected default to false to move it to BSS. It is set on
  USB connection anyway.
* Set sinc_filter to const. Doesn't help flash but keeps it out of
  RAM.
2020-11-13 18:57:52 -08:00
Dan Halbert 144eb131ae
Merge pull request #3627 from adafruit/6.0.x
Merge 6.0.x bugfixes to main
2020-10-31 12:28:20 -04:00
Dan Halbert 345d84ffde improve USB CDC disconnect/reconnect checking 2020-10-30 22:25:50 -04:00
Scott Shawcroft 9a4efed8cb
Start tweaking the workflow to sleep 2020-10-27 17:55:03 -07:00
Jeff Epler 3c05a8c68c
Merge pull request #3482 from cwalther/alloc
Fix inconsistent supervisor heap
2020-10-16 21:31:32 -05:00
Scott Shawcroft 379e73af2e
Finer grained, per port tick locking
Fixes #3504 hopefully.
2020-10-12 18:43:21 -07:00
Scott Shawcroft 09bc415751
Unify iMX flash config and add Metro M7 1011
This unifies the flash config to the settings used by the Boot ROM.
This makes the config unique per board which allows for changing
quad enable and status bit differences per flash device. It also
allows for timing differences due to the board layout.

This change also tweaks linker layout to leave more ram space for
the CircuitPython heap.
2020-10-07 15:23:47 -07:00
Christian Walther be8092f4d3 When there is not enough free space, but a matching hole on the other side, use it. 2020-10-02 23:07:07 +02:00
Christian Walther 5bdb8c45dd Allow allocate_memory() to reuse holes when matching exactly.
This requires recovering the pointer of the allocation, which could be done by adding up neighbor lengths, but the simpler way is to stop NULLing it out in the first place and instead mark an allocation as freed by the client by setting the lowest bit of the length (which is always zero in a valid length).
2020-10-02 23:03:21 +02:00
Christian Walther d6d02c67d2 Fix inconsistent supervisor heap.
When allocations were freed in a different order from the reverse of how they were allocated (leaving holes), the heap would get into an inconsistent state, eventually resulting in crashes.

free_memory() relies on having allocations in order, but allocate_memory() did not guarantee that: It reused the first allocation with a NULL ptr without ensuring that it was between low_address and high_address. When it belongs to a hole in the allocated memory, such an allocation is not really free for reuse, because free_memory() still needs its length.

Instead, explicitly mark allocations available for reuse with a special (invalid) value in the length field. Only allocations that lie between low_address and high_address are marked that way.
2020-10-02 23:03:21 +02:00