Commit Graph

27 Commits

Author SHA1 Message Date
Dan Halbert 2171e67c1b merge latest adafruit/main 2023-08-13 19:43:54 -04:00
Dan Halbert 0d4bc8c163 initial v1.19.1 merge; not compiled yet 2023-08-01 13:50:05 -04:00
Scott Shawcroft e45a61f57e
Align fatfs window buffer for tinyusb
Also, update tinyusb.
2023-07-27 09:15:58 -07:00
Scott Shawcroft 144aed40e3
Rename flag. Turn on UTF-8 and flag on unix
Also added label portion to the test.
2023-02-24 12:23:59 -08:00
Scott Shawcroft 1a3358d036
Limit FatFs' ability to upper case paths
Only uppercase ASCII letters a-z. This saves ~900 bytes. Previously
written files with other unicode letters will only be accessible
from their upper cased path.
2023-02-23 14:28:58 -08:00
Jeff Epler 3d66ed27ce
oofatfs: enable use of random volume IDs
This may help address #7409 if the underlying cause is the deterministic
volume ID. However, not all boards have working urandom (samd21
at least does not) so a couple of fallbacks are attempted when it fails.

I verified that on a pico_w, each `storage.erase_filesystem()` gives
a distinct 32-bit volume ID (pico_w's urandom can never fail)
2023-01-03 17:18:29 -06:00
Dan Halbert 6ee45dde57 f_rename return value; add a test for rename dir inside itself 2022-10-12 16:52:22 -04:00
Melissa LeBlanc-Williams 9e13e8e991 Moved folder moving inside itself checks into f_rename 2022-09-13 08:42:35 -07:00
Timon a1052d5f73
Initial broadcom port for Raspberry Pi
This targets the 64-bit CPU Raspberry Pis. The BCM2711 on the Pi 4
and the BCM2837 on the Pi 3 and Zero 2W. There are 64-bit fixes
outside of the ports directory for it.

There are a couple other cleanups that were incidental:
* Use const mcu_pin_obj_t instead of omitting the const. The structs
  themselves are const because they are in ROM.
* Use PTR <-> OBJ conversions in more places. They were found when
  mp_obj_t was set to an integer type rather than pointer.
* Optimize submodule checkout because the Pi submodules are heavy
  and unnecessary for the vast majority of builds.

Fixes #4314
2021-11-22 14:54:44 -08:00
Jeff Epler 12c95ee9e9
oofatfs: Allow fat32 mkfs to be compiled out
Saves 508 bytes
2021-11-12 17:31:12 -06:00
Scott Shawcroft 11f1c42bb5
Turn on unicode for FATFS
This also tweaks the repr for unicode strings to only escape a few
utf-8 code points. This makes emoji show in os.listdir() for
example.

Also, enable exfat support on full builds.

Fixes #5146
2021-08-17 17:41:59 -07:00
Scott Shawcroft 76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -07:00
Diego Elio Pettenò 34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Jeff Epler eef742bf45 oofatfs: Remove _FS_DISK_READ_ALIGNED
This workaround is no longer needed, so it can be removed.

Closes: #2332
2020-02-28 10:04:28 -06:00
Jeff Epler a484a93b29 nRF: disk_read must be 4-byte aligned
.. a requirement that oofatfs needs to be taught to respect.

This problem can be demonstrated with the following snippet, except
that the related file ("test.bin") must also be contiguous on the
filesystem.  You can ensure this by reformatting your device's filesystem
before testing, then copying any single file bigger than 4kB to test.bin.

    f = open("test.bin", "rb")
    f.seek(2048)
    b = bytearray(2048)
    v = memoryview(b)
    f.readinto(v[909:])

Closes: #2332
2019-12-10 14:03:06 -06:00
Damien George 350dbb89e6 lib/oofatfs: Update oofatfs library to fix issue with logic not.
From https://github.com/micropython/oofatfs, branch work-R0.13c,
commit 3b4ee5a646af2769b3dddfe17d5d866233c1e45b.
2019-03-07 15:03:09 +11:00
Damien George 7eadcaa8c6 lib/oofatfs: Update ffconf.h config for new oofatfs version. 2019-03-05 15:56:39 +11:00
Damien George 1a24bac6cb lib/oofatfs: Update oofatfs library to R0.13c working branch.
From https://github.com/micropython/oofatfs, branch work-R0.13c,
commit cb05c9486d3b48ffd6bd7542d8dbbab4b1caf790.

Large code pages (932, 936, 949, 950) have been removed from ffunicode.c
because they were not included in previous versions here.
2019-03-05 15:56:39 +11:00
Scott Shawcroft a393a6e0c5
Add fast seek support to file objects 2019-02-03 13:41:20 -08:00
Noralf Trønnes 28383afa11 shared-module/os: Fix os.mkdir('a/b')
This fixes commit a99f9427420d("'/' and '\' are also acceptable ends of the path now") which broke mkdir.
The problem is where the directory name is a single letter like this:
>>> os.mkdir('a')
>>> os.mkdir('a/b')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 17] File exists
>>> os.mkdir('a/bb')
>>>

I wasn't smart enough to fix this in the oofatfs library, so I did it in the os shared module by
creating a path lookup function for the os methods that only deals with directories. I reverted
the library change introduced by the aforementioned commit.

This means that os.stat and os.rename can't handle trailing slashes. This is to avoid allowing
filenames with trailing slashes to pass through. In order to handle trailing slashes for these
it would be necessary to check if it really is a directory before stripping. I didn't do this
since the original issue was to make os.chdir tolerate trailing slashes.

There's an open MicroPython issue #2929 wrt. trailing slashes and mkdir.
2018-11-09 19:20:56 +01:00
Leszek Jakubowski a99f942742 '/' and '\' are also acceptable ends of the path now 2018-07-28 17:07:22 +02:00
Andrew Gatt 9d3c0d423e lib/oofatfs/ffconf.h: Add MICROPY_FATFS_NORTC option. 2017-01-31 19:54:20 +11:00
Damien George b039d93d7e lib/oofatfs/ffconf.h: Allow to configure FS_EXFAT option.
Using MICROPY_FATFS_EXFAT.  Enabling this has licensing implications;
see https://www.microsoft.com/en-us/legal/intellectualproperty/mtl/exfat-licensing.aspx
2017-01-31 12:32:24 +11:00
Damien George 28899cd971 lib/oofatfs: Update oofatfs library.
From https://github.com/micropython/oofatfs, branch work-R0.12b,
commit 46fb53331e7a583c29a41d37ce4b53f2718597e5.
2017-01-30 12:07:40 +11:00
Damien George 0390bc97ea lib/oofatfs: Update oofatfs library.
From https://github.com/micropython/oofatfs, branch work-R0.12b,
commit 1e295b40550664bbaac18d95a4b6a58154464d31.
2017-01-27 23:22:15 +11:00
Damien George 9b08faf3ae lib/oofatfs: Add OO version of FatFS library.
From https://github.com/micropython/oofatfs, branch work-R0.12b,
commit a346ccec123c2e4d887e2751d64156208d03bff4.
2017-01-27 13:19:10 +11:00