Commit Graph

74 Commits

Author SHA1 Message Date
Scott Shawcroft
8137e2d6d2
Switch all ports to auto-growing split heap
This simplifies allocating outside of the VM because the VM doesn't
take up all remaining memory by default.

On ESP we delegate to the IDF for allocations. For all other ports,
we use TLSF to manage an outer "port" heap. The IDF uses TLSF
internally and we use their fork for the other ports.

This also removes the dynamic C stack sizing. It wasn't often used
and is not possible with a fixed outer heap.

Fixes #8512. Fixes #7334.
2023-11-01 15:24:16 -07:00
Scott Shawcroft
5a19971efd
Fix pre-commit 2023-10-16 10:46:11 -07:00
Dan Halbert
68a2927385 MP_REGISTER_ROOT_POINTER for port-specific root pointers 2023-09-29 15:46:42 -04:00
Dan Halbert
1c388ab315 finish converting to MP_REGISTER_ROOT_POINTER() 2023-09-29 10:49:34 -04:00
Dan Halbert
fe0e2f13bc wip; fix qstr processing 2023-08-10 20:06:32 -04:00
hathach
fecc1bdedb
fix typos (partial) detected by codepell 2023-03-18 22:17:02 +07:00
Pontus Oldberg
14417a21d1
Merge branch 'adafruit:main' into main 2023-01-03 09:31:49 +01:00
Dan Halbert
cc92ce4820 Use memory fence when disabling cache to avoid -O2 problems 2022-12-29 19:49:40 -05:00
Pontus Oldberg
9f266c361b Initializing external flash SPI speed to SPI_FLASH_MAX_BAUDRATE, instead of using driver default speed (32MHz), before probing JEDEC identifier. 2022-12-21 16:33:06 +01:00
George White
3b5171c4ff Move hook implementation to supervisor 2022-04-18 14:09:36 +00:00
Scott Gauche
3b418dbddc change half_duplex to be on spi construct 2022-02-08 21:37:38 -05:00
EmergReanimator
cfa7e8a168 fix #5948 Adding back the SPI configuration to spi_flash_read/write_data
Removing this configures will break cases where the flash is on a shared SPI bus with a device that has different settings.
This is rare but possible.
2022-02-01 19:39:56 +01:00
EmergReanimator
2a1f586634 Avoid excessive SPI re-configuration in run-time of SPI flash. 2022-01-30 09:49:07 +01:00
EmergReanimator
f610b6b190 Changed the order of SPI configuration and activation.
SPI should be configured while chip select pin is disabled.
Tested with external flash on STM32 F4VE board.
2022-01-29 18:29:50 +01:00
Jeff Epler
63fbf98186
Enable -Wmissing-prototypes for atmel-samd 2021-11-09 20:05:00 -06:00
Max Holliday
c999e2a329 add missing varriables to devices.h generator 2021-10-24 11:45:15 -07:00
Scott Shawcroft
1a0b4193b7
Simplify the status LED to save power
This also removes the need to pin share because we don't use the
status LED while user code is running.

The status flashes fallback to the HW_STATUS LED if no RGB LED is
present. Each status has a unique blink pattern as well.

One caveat is the REPL state. In order to not pin share, we set the
RGB color once. PWM and single color will be shutoff immediately but
DotStars and NeoPixels will hold the color until the user overrides
it.

Fixes #4133
2021-05-13 14:41:20 -07:00
Jeff Epler
e95e921ca1 codeformat: Fix filename matching
In #4683, tannewt noticed that uncrustify was not running on some
file in common-hal.

I investigated and found that it was not being run on a bunch of paths.

Rather than make incremental changes, I rewrote list_files to work
bsaed on regular expressions; these regular expressions are created from
the same git-style glob patterns.

I spot-checked some specific filenames after this change, and all looks good:

```
$ python3 tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py  ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup extmod/virtpin.c ports/raspberrypi/background.h ports/raspberrypi/common-hal/pulseio/PulseIn.c
black --fast --line-length=99 -v tests/thread/thread_exit1.py
```
recursiveloop and int_small are excluded, while PulseIn, virtpin,
and background are included.

Testing running from a subdirectory (not _specifically_ supported though):
```
(cd ports && python3 ../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c)
../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup ../extmod/virtpin.c raspberrypi/common-hal/pulseio/PulseIn.
```

As a side-effect, a bunch more files are re-formatted now. :-P
2021-04-30 10:48:08 -05:00
Scott Shawcroft
01c153cd7e
Fix devices include by splitting type from defines 2021-03-25 11:37:08 -07:00
Scott Shawcroft
aec0ef3cbf
Switch devices.h to nvm.toml data 2021-03-25 09:57:18 -07:00
Artyom Skrobov
3b613ff97c [spi_flash] handle reentrance gracefully
Report failure instead of deadlocking the device
2021-03-23 02:11:54 -04:00
Linar Yusupov
76c1ae7194 fix for MX25R1635F QSPI mode of operation 2021-03-22 09:12:26 +03:00
microDev
a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Jeff Epler
32475ce98c Automatically count EXTERNAL_FLASH_DEVICES (mk2)
Instead of counting words in make, which is slightly awful, notice that
possible_devices is local to external_flash.c, so we can declare the array
with an automatic bound, and then get the count as the element-count
(MP_ARRAY_SIZE) of the array.

Since EXTERNAL_FLASH_DEVICE_COUNT is no longer a global macro, switch
a few sites to using EXTERNAL_FLASH_DEVICES in `#if` checks instead.
2021-03-07 12:51:47 -06: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
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
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
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
Diego Elio Pettenò
34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01:00
Jeff Epler
d5074220a8 atmel-samd: Add SAM E54 Xplained board
Few peripherals are actually tested.  However, USB, I2C and GPIO seem to work.

Most pins are silkscreened with the "PX00" style, so the board module
only includes the small number that are screened differently.

The default SPI, I2C, and UART are the ones on the EXT2 header.  This is
arbitrary, but the I2C on this connector is shared with the on-board I2C
devices and the PCC header, making it the most versatile.
2020-06-23 10:41:48 -05:00
Brian Dean
cf888dc02b .../devices.h: Add GigaDevices GD25S512MD 64 MiB flash chip support. 2020-05-29 15:40:56 -04:00
Max Holliday
964040b770 More erroneous else statements 2020-05-09 12:16:04 -07:00
Max Holliday
8b6587a0c6 Unified single_status_byte & no_reset_cmd behavior 2020-05-09 12:09:01 -07:00
Max Holliday
9e01bb2136 Removing erroneous else statements 2020-05-09 12:03:26 -07:00
Max Holliday
9ef28d8536 Replacing device that was accidentally deleted 2020-05-09 12:00:59 -07:00
Dan Halbert
c377d4bea7
Merge branch 'master' into non-standard-nvm 2020-05-04 16:08:45 -04:00
Max Holliday
cc290c50c6 fixing diff error 2020-04-28 18:15:38 -07:00
Max Holliday
6c4decd4e2 decoupling chip specific functions from EXTERNAL_FLASH_QSPI_SINGLE 2020-04-28 11:51:07 -07:00
Scott Shawcroft
755d404edf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-27 16:45:10 -07:00
Max Holliday
86943ca8a1 Merge remote-tracking branch 'adafruit/master' 2020-04-27 13:51:51 -07:00
Sean Cross
05b5356acc external_flash: add support for mx25r1635f
This flash chip is used in Simmel.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 09:56:05 +08: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
8fe512c7e9
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-03-31 15:13:58 -07: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
ed5cdd7e09
Hopefully fix flash flush and hopefully audio as well. 2020-03-13 11:12:31 -07: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