Commit Graph

7686 Commits

Author SHA1 Message Date
Damien George bfa948c0a5 cc3200: Add implementations of mp_import_stat and builtin_open.
They disappeared when stmhal changed to use new MICROPY_VFS code.
2017-01-27 23:22:15 +11:00
Damien George 84c614e729 stmhal: Convert to use VFS sub-system and new ooFatFs component.
This patch makes the following configuration changes:
- MICROPY_FSUSERMOUNT is disabled, removing old mounting infrastructure
- MICROPY_VFS is enabled, giving new VFS sub-system
- MICROPY_VFS_FAT is enabled, giving uos.VfsFat type
- MICROPY_FATFS_OO is enabled, to use new ooFatFs lib, R0.12b

User facing API should be almost unchanged.  Most notable changes are
removal of os.mkfs (use os.VfsFat.mkfs instead) and pyb.mount doesn't
allow unmounting by passing None as the device.
2017-01-27 23:22:15 +11:00
Damien George 3242cf2d36 stmhal/usbd_msc_storage: Use storage functions instead of disk ones. 2017-01-27 23:22:15 +11:00
Damien George 4565d42e70 esp8266/fatfs_port: Include new oofatfs header. 2017-01-27 23:22:15 +11:00
Damien George 9225ce6a14 unix/fatfs_port: Include new oofatfs header. 2017-01-27 23:22:15 +11:00
Damien George 8aa8a0a660 extmod/vfs_fat: Use SECSIZE macro to determine FatFs sector size. 2017-01-27 23:22:15 +11:00
Damien George 3f6b4e08e3 extmod/vfs: Expose mp_vfs_mount_t type.
It should only be used for low-level things and with caution, for example
putting mounted VFS data in ROM or the static data section.
2017-01-27 23:22:15 +11:00
Damien George f488fa29e4 extmod/modlwip: Add socket.readinto() method. 2017-01-27 21:01:18 +11:00
Damien George b9bfaa349a tests/extmod/vfs_fat: Update tests to work with new VFS sub-system.
The vfs_fat_fsusermount test is no longer relevant so has been removed.
2017-01-27 17:21:45 +11:00
Damien George f9ecd484bb esp8266: Change to use new generic VFS sub-system.
The VFS sub-system supports mounting of an arbitrary number of devices
(limited only by available RAM).  The internal flash is now mounted at
"/flash".
2017-01-27 17:21:45 +11:00
Damien George f1e04148a1 unix: Change to use new generic VFS sub-system in coverage build.
This patch includes a new module "uos_vfs" which can be used for testing
the VFS syb-system.
2017-01-27 17:21:45 +11:00
Damien George 6c23c7587f extmod/vfs: Add ability for VFS sub-system to import using VfsFat. 2017-01-27 17:21:45 +11:00
Damien George fb3ae1784e extmod/vfs_fat: Rework to support new generic VFS sub-system.
The VfsFat object can now be mounted by the generic VFS sub-system.
2017-01-27 17:19:06 +11:00
Damien George dcb9ea7215 extmod: Add generic VFS sub-system.
This provides mp_vfs_XXX functions (eg mount, open, listdir) which are
agnostic to the underlying filesystem type, and just require an object with
the relevant filesystem-like methods (eg .mount, .open, .listidr) which can
then be mounted.

These mp_vfs_XXX functions would typically be used by a port to implement
the "uos" module, and mp_vfs_open would be the builtin open function.

This feature is controlled by MICROPY_VFS, disabled by default.
2017-01-27 17:19:06 +11:00
Damien George 32a1138b9f extmod: Rename vfs_fat_file.h to vfs_fat.h.
And move declaration of mp_fat_vfs_type to this file.
2017-01-27 15:04:17 +11:00
Damien George 143fa0ffeb unix: Get minimal version compiling again. 2017-01-27 13:32:15 +11:00
Damien George 8d5c6332c0 esp8266: Switch to use OO version of FatFs library. 2017-01-27 13:19:11 +11:00
Damien George 94d87fbb30 test/extmod: Update vfs_fat tests for new OO FatFs library.
The new version of FatFs requires a minimum of 50 blocks on the device.
Also, some tests no longer make sense with an OO vfs.
2017-01-27 13:19:10 +11:00
Damien George 5395f5bc71 unix: Switch to OO version of FatFS library. 2017-01-27 13:19:10 +11:00
Damien George f5f4cdae89 extmod/vfs_fat: Rework so it can optionally use OO version of FatFS.
If MICROPY_VFS_FAT is enabled by a port then the port must switch to using
MICROPY_FATFS_OO.  Otherwise a port can continue to use the FatFs code
without any changes.
2017-01-27 13:19:10 +11:00
Damien George d4464b0050 py/py.mk: Add CFLAGS_MOD flag to set config file for FatFs. 2017-01-27 13:19:10 +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
Damien George f1db8a3097 qemu-arm: Don't compile tests in "REPL" mode.
Previous to this patch the qemu-arm tests were compiled with is_relp=true
meaning that the __repl_print__ function was called for all lines of code
in the outer scope.  This is not the right behaviour for scripts that are
executed as though they were a file (eg tests).

With this fix the micropython/heapalloc_str.py test now works so it is
removed from the test blacklist.
2017-01-27 12:35:46 +11:00
Damien George cc4c1adf6e py/showbc: Make sure to set the const_table before printing bytecode. 2017-01-27 12:34:09 +11:00
Glenn Ruben Bakke 726fe1aa27 nrf5/examples: Updating game file to use ssd1305 display driver. 2017-01-26 23:37:19 +01:00
Paul Sokolovsky 4614403f63 tools/tinytest-codegen.py: Blacklist heapalloc_str.py test for qemu-arm. 2017-01-27 01:19:36 +03:00
Glenn Ruben Bakke d37d799204 nrf5/drivers: Updating examples in comment in oled ssd1305 object to use the draw module. 2017-01-26 22:56:30 +01:00
Paul Sokolovsky 9ffc3ae0e7 tests/heapalloc_str: Test for alloc-free string operations.
Starts with concatenation with an empty string.
2017-01-27 00:49:39 +03:00
Paul Sokolovsky e2e663291d py/objstr: Optimize string concatenation with empty string.
In this, don't allocate copy, just return non-empty string. This helps
with a standard pattern of buffering data in case of short reads:

    buf = b""
    while ...:
        s = f.read(...)
        buf += s
        ...

For a typical case when single read returns all data needed, there won't
be extra allocation. This optimization helps uasyncio.
2017-01-27 00:49:39 +03:00
Glenn Ruben Bakke 87e7ab8862 nrf5/hal: Fixing nrf51 SPI pin configuration to use pin member of struct. 2017-01-26 22:31:23 +01:00
Glenn Ruben Bakke 9009ad67b0 nrf5/boards: Updating boards to comply to new style of configuring pins for uart and spi. 2017-01-26 22:29:58 +01:00
Glenn Ruben Bakke 6387490e4a nrf5/boards: Updating board configuration for pca10056 (nrf52840) with new pin configuration scheme for SPI and UART. 2017-01-26 22:15:35 +01:00
Glenn Ruben Bakke 0b0cb19608 nrf5/hal: Updating hal QSPI header with define guard to filter out usage of undefined structures and names when compiling against non-52840 targets. 2017-01-26 22:10:36 +01:00
Glenn Ruben Bakke b4d53ad560 nrf5/drivers: Updating display objects to use new SPI pin configuration in print function. 2017-01-26 22:08:39 +01:00
Glenn Ruben Bakke 0254cab228 nrf5/hal: Updating SPI DMA variant with more frequencies, and allowing rx and tx buffers to be NULL. 2017-01-26 22:01:43 +01:00
Glenn Ruben Bakke 632afd1fa8 nrf5/uart: Updating uart module to use new config hal config structure members for pins. Changing board config provided pins to use const pointers from generated pins instead of pin name. 2017-01-26 21:59:37 +01:00
Glenn Ruben Bakke d87d0141b3 nrf5/hal: Updating uart hal to use pointers to Pin objects instead of uint pin and port number. 2017-01-26 21:58:12 +01:00
Glenn Ruben Bakke 3c6c6c6d05 nrf5/hal: Updating uart hal to use pointers to Pin objects instead of uint pin and port number. 2017-01-26 21:57:38 +01:00
Glenn Ruben Bakke afcf07ca76 nrf5: Updating modmachine to add SPI in globals dict when MICROPY_PY_MACHINE_HW_SPI define is set. This diverge from regular MICROPY_PY_MACHINE_SPI config. Fixes missing SPI in the machine module after renaming port SPI enable define. 2017-01-26 21:31:24 +01:00
Glenn Ruben Bakke f94836ef74 nrf5: Updating main.c to enable SPI if MICROPY_PY_MACHINE_HW_SPI is set. This diverge from regular MICROPY_PY_MACHINE_SPI config. Fixing missing init of SPI after renaming port SPI enable define. 2017-01-26 21:29:24 +01:00
Glenn Ruben Bakke 8653ac9ef8 nrf5/spi: Adding multiple instances of machine SPI depending on which chip is targeted (nrf51/nrf52832/nrf52540). Updating board config requirement to give variable name of const pointer to Pin instead of a Pin name. Adding support of giving keyword set mosi/miso/clk pin through constructor. 2017-01-26 21:27:59 +01:00
Glenn Ruben Bakke 437f3d2477 nrf5/hal: Updating SPI hal with full list of SPI interfaces as lookup tables for all devices. Updating init struct to pass Pin instance pointers instead of uint pin number and ports. 2017-01-26 21:24:31 +01:00
Damien George 221f88d1f3 tests/extmod: Add test for ure debug printing when compiling a regex. 2017-01-26 23:45:51 +11:00
Damien George e9cb1f8077 py/objmodule: Move module init/deinit code into runtime functions.
They are one-line functions and having them inline in mp_init/mp_deinit
eliminates the overhead of a function call, and matches how other state
is initialised in mp_init.
2017-01-26 23:30:38 +11:00
Glenn Ruben Bakke 197c052ca6 nrf5/drivers: Activate ssd1289 object in the display module. 2017-01-25 19:52:18 +01:00
Glenn Ruben Bakke 0fdcd2eac7 nrf5/boards: Adding ssd1289 lcd module in pca10040 (nrf52832) board. 2017-01-25 19:51:14 +01:00
Glenn Ruben Bakke 83b234f878 nrf5: Adding ssd1289 driver and python module into build. 2017-01-25 19:49:30 +01:00
Glenn Ruben Bakke c442588b92 nrf5/drivers: Adding ssd1289 lcd tft driver and python module. 2017-01-25 19:47:25 +01:00
Damien George bf51200bc1 tests/extmod/framebuf1: Fix test for framebuf invalid constructor. 2017-01-25 23:23:50 +11:00
Oleg Korsak 406fb3cb60 tests/extmod/framebuf4: Add tests for GS4_HMSB framebuf format. 2017-01-25 23:20:19 +11:00