summaryrefslogtreecommitdiffstatshomepage
path: root/ports/unix/variants
Commit message (Collapse)AuthorAge
* unix/variants: Enable os.uname() in coverage build for tests.Yoctopuce dev2025-04-21
| | | | | | | In order to provide test coverage for the previous commit, `os.uname()` support is added to the unix coverage build. Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
* unix/main: Add coverage test for mounting ROMFS filesystem at startup.Damien George2025-03-06
| | | | Signed-off-by: Damien George <damien@micropython.org>
* extmod/modvfs: Add vfs.rom_ioctl function and its ioctl constants.Damien George2025-03-06
| | | | | | | This is a generic interface to allow querying and modifying the read-only memory area of a device, if it has such an area. Signed-off-by: Damien George <damien@micropython.org>
* unix: Enable VfsRom on standard and coverage variants.Damien George2024-12-23
| | | | Signed-off-by: Damien George <damien@micropython.org>
* extmod/modos: Include os.sep entry if MICROPY_VFS is enabled.Damien George2024-07-20
| | | | | | | | | | | This simplifies configuration by removing the `MICROPY_PY_OS_SEP` option and instead including `os.sep` if `MICROPY_VFS` is enabled. That matches the configuration of all existing ports that enabled `os.sep` (they also had `MICROPY_VFS` enabled), and brings consistency to other ports. Fixes issue #15116. Signed-off-by: Damien George <damien@micropython.org>
* unix/variants: Don't use native _Float16 type.Damien George2024-03-20
| | | | | | Using it increases code size by about 2k. Signed-off-by: Damien George <damien@micropython.org>
* tests/ports/unix: Add coverage test for frozen functions and generators.Damien George2024-02-16
| | | | Signed-off-by: Damien George <damien@micropython.org>
* unix/variants: Prefer unix-ffi packages when loading the manifest.Damien George2024-02-08
| | | | Signed-off-by: Damien George <damien@micropython.org>
* extmod/modtls: Move the native ssl module to tls.Felix Dörre2024-02-07
| | | | | | | | | | | | | The current `ssl` module has quite a few differences to the CPython implementation. This change moves the MicroPython variant to a new `tls` module and provides a wrapper module for `ssl` (in micropython-lib). Users who only rely on implemented comparible behavior can continue to use `ssl`, while users that rely on non-compatible behavior should switch to `tls`. Then we can make the facade in `ssl` more strictly adhere to CPython. Signed-off-by: Felix Dörre <felix@dogcraft.de>
* py/mpconfig: Disable qstr hashing at minimum feature level.Jim Mussared2024-01-25
| | | | | | | | | | | | | | | | | | | | | | | | | This will apply to bare-arm and minimal, as well as the minimal unix variant. Change the default to MICROPY_QSTR_BYTES_IN_HASH=1 for the CORE,BASIC levels, 2 for >=EXTRA. Removes explicit setting of MICROPY_QSTR_BYTES_IN_HASH==1 in ports that don't set the feature level (because 1 is implied by the default level, CORE). Applies to cc3200, pic16bt, powerpc. Removes explicit setting for nRF (which sets feature level). Also for samd, which sets CORE for d21 and FULL for d51. This means that d21 is unchanged with MICROPY_QSTR_BYTES_IN_HASH==1, but d51 now moves from 1 to 2 (roughly adds 1kiB). The only remaining port which explicitly set bytes-in-hash is rp2 because it's high-flash (hence CORE level) but lowish-SRAM, so it's worthwhile saving the RAM for runtime qstrs. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* extmod/modmachine: Add MICROPY_PY_MACHINE_PIN_BASE option.Damien George2023-11-30
| | | | | | And use it in qemu-arm, unix and windows ports to enable PinBase. Signed-off-by: Damien George <damien@micropython.org>
* extmod/modselect: Add optimisation to use system poll when possible.Damien George2023-08-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous commit removed the unix-specific select module implementation and made unix use the common one. This commit adds an optimisation so that the system poll function is used when polling objects that have a file descriptor. With this optimisation enabled, if code registers both file-descriptor-based objects, and non- file-descriptor-based objects with select.poll() then the following occurs: - the system poll is called for all file-descriptor-based objects with a timeout of 1ms - then the bare-metal polling implementation is used for remaining objects, which calls into their ioctl method (which can be in C or Python) In the case where all objects have file descriptors, the system poll is called with the full timeout requested by the caller. That makes it as efficient as possible in the case everything has a file descriptor. Benefits of this approach: - all ports use the same select module implementation - the unix port now supports polling of all objects and matches bare metal implementations - it's still efficient for existing cases where only files and sockets are polled (on unix) - the bare metal implementation does not change - polling of SSL objects will now work on unix by calling in to the ioctl method on SSL objects (this is required for asyncio ssl support) Note that extmod/vfs_posix_file.c has poll disable when the optimisation is enabled, because the code is not reachable when the optimisation is used. Signed-off-by: Damien George <damien@micropython.org>
* unix/modselect: Remove unix-specific implementation of select module.Damien George2023-08-07
| | | | | | | | | | | | | | | The unix port has a custom select module which only works with objects that have a file descriptor, eg files and sockets. On the other hand, bare metal ports use the common extmod/modselect.c implementation of the select module that supports polling of arbitrary objects, as long as those objects provide a MP_STREAM_POLL in their ioctl implementation (which can be done in C or Python). This commit removes the unix-specific code and makes unix use the common one provided by extmod/modselect.c instead. All objects with file descriptors implement MP_STREAM_POLL so they continue to work. Signed-off-by: Damien George <damien@micropython.org>
* extmod/asyncio: Rename uasyncio to asyncio.Jim Mussared2023-06-19
| | | | | | | | | | | | | | The asyncio module now has much better CPython compatibility and deserves to be just called "asyncio". This will avoid people having to write `from uasyncio import asyncio`. Renames all files, and updates port manifests to use the new path. Also renames the built-in _uasyncio to _asyncio. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* extmod/modtimeq: Remove timeq module.Jim Mussared2023-06-08
| | | | | | | | This is a MicroPython-specific module that existed to support the old version of uasyncio. It's undocumented and not enabled on all ports and takes up code size unnecessarily. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* all: Rename *umodule*.c to remove the "u" prefix.Jim Mussared2023-06-08
| | | | | | | | | | | Updates any includes, and references from Makefiles/CMake. This essentially reverts what was done long ago in commit 136b5cbd7669e8318f8455fc2706da97a5b7994c This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* all: Rename UMODULE to MODULE in preprocessor/Makefile vars.Jim Mussared2023-06-08
| | | | | | This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* all: Rename mp_umodule*, mp_module_umodule* to remove the "u" prefix.Jim Mussared2023-06-08
| | | | | | This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* all: Fix spelling mistakes based on codespell check.Damien George2023-04-27
| | | | Signed-off-by: Damien George <damien@micropython.org>
* unix/modutime: Use extmod version of time module.Damien George2023-04-27
| | | | | | No API or functional change. Signed-off-by: Damien George <damien@micropython.org>
* extmod/btstack: Fix indicate/notify queuing.Jim Mussared2023-04-26
| | | | | | | | | | | This adds a mechanism to track a pending notify/indicate operation that is deferred due to the send buffer being full. This uses a tracked alloc that is passed as the content arg to the callback. This replaces the previous mechanism that did this via the global pending op queue, shared with client read/write ops. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* unix/variants: Change mip package to mip-cmdline.Damien George2022-11-09
| | | | | | | mip-cmdline adds command-line support to mip, useful for the unix port, via micropython -m mip ... Signed-off-by: Damien George <damien@micropython.org>
* top: Replace upip with mip everywhere.Jim Mussared2022-09-30
| | | | | | | | | | Updates all README.md and docs, and manifests to `require("mip")`. Also extend and improve the documentation on freezing and packaging. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* unix/variants/coverage: Add test for manifest freeze_mpy().Jim Mussared2022-09-19
| | | | | | | | | | | | This uses the frozentest.mpy that is also used by ports/minimal. Also fixes two bugs that these new tests picked up: - File extension matching in manifestfile.py. - Handling of freeze_mpy results in makemanifest. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* unix: Refactor mpconfigvariant.mk.Jim Mussared2022-09-13
| | | | | | | All variants (except minimal) enable text compression and fat/lfs, so move them to the common mpconfigport.mk. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* py/mpconfig: Add "everything" features from unix coverage.Jim Mussared2022-09-13
| | | | Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* unix: Refactor mpconfigport.h and mpconfigvariant.h.Jim Mussared2022-09-13
| | | | | | | | | This is a no-op for coverage and minimal. The standard and dev variants have been merged and enable the same feature set as a typical bare-metal board. And remove the CI for the dev build. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* unix/variants: Remove freedos and fast variants.Jim Mussared2022-09-13
| | | | | | | The freedos variant is untested by CI and is difficult to maintain. The fast variant is not a good name for what it does. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* unix/mpconfigport: Enable MICROPY_ENABLE_FINALISER when VFS is used.Andrew Leech2022-09-13
|
* all: Update all manifest.py files to use new features.Jim Mussared2022-09-05
| | | | | | | | | | | | | | | | | | | | | Changes in this commit: - Manifest include's now use the directory path where possible (no longer necessary to include the manifest.py file explicitly). - Add manifest.py for all drivers and components that are referenced by port/board manifests. - Replace all uses of freeze() with package()/module(), except for port and board modules. - Use opt=3 everywhere, for consistency and to reduce code size. - Use require() instead of include() for all micropython-lib references. - Remove support for optional board-level manifest.py in mimxrt port, to make it behave the same as other ports (the board must set FROZEN_MANIFEST to a custom manifest.py, which can optionally include the default, port-level manifest). - Also reinstates modules that were accidentally removed from the esp8266 512k build in fbe9417b90474dd1a08749b3a79311a8007a98fb. Signed-off-by: Jim Mussared <jim.mussared@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
* all: Remove MICROPY_PY_IO_FILEIO config option.Damien George2022-08-18
| | | | | | | | | | | | | | | | | | | | | | Since commit e65d1e69e88268145ff0e7e73240f028885915be there is no longer an io.FileIO class, so this option is no longer needed. This option also controlled whether or not files supported being opened in binary mode (eg 'rb'), and could, if disabled, lead to confusion as to why opening a file in binary mode silently did the wrong thing (it would just open in text mode if MICROPY_PY_IO_FILEIO was disabled). The various VFS implementations (POSIX, FAT, LFS) were the only places where enabling this option made a difference, and in almost all cases where one of these filesystems were enabled, MICROPY_PY_IO_FILEIO was also enabled. So it makes sense to just unconditionally enable this feature (ability to open a file in binary mode) in all cases, and so just remove this config option altogether. That makes configuration simpler and means binary file support always exists (and opening a file in binary mode is arguably more fundamental than opening in text mode, so if anything should be configurable then it should be the ability to open in text mode). Signed-off-by: Damien George <damien@micropython.org>
* unix/variants: Remove variant suffix from executable filename.Damien George2022-08-11
| | | | | | | | The executable now lives in the build directory, and since the build directory already contains the variant name there is no need to also add it to the executable. Signed-off-by: Damien George <damien@micropython.org>
* ports: Remove unused mp_type_{fileio/textio} macros in mpconfigport.h.Jim Mussared2022-07-26
| | | | Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* unix: Enable MICROPY_GC_SPLIT_HEAP on coverage build.Rob Knegjens2022-07-23
| | | | | | With a new option to evenly split the GC heap over multiple areas. This adds code coverage for gc_add() and code associated with MICROPY_GC_SPLIT_HEAP.
* py/mpstate: Drop MICROPY_PORT_ROOT_POINTERS from mp_state_vm_t.David Lechner2022-07-18
| | | | | | | | | All in-tree uses of MICROPY_PORT_ROOT_POINTERS have been replaced with MP_REGISTER_ROOT_POINTER(), so now we can remove both MICROPY_PORT_ROOT_POINTERS and MICROPY_BOARD_ROOT_POINTERS from the code and remaining config files. Signed-off-by: David Lechner <david@pybricks.com>
* unix/variants/dev: Allow all config options to be overridden.Damien George2022-06-29
| | | | | | They can be overridden on the make command line, for example. Signed-off-by: Damien George <damien@micropython.org>
* unix/variants/coverage: Change config to use ROM level everything.Damien George2022-06-29
| | | | | | | | This ROM level is not yet fully defined, but it at least enables MICROPY_PY_SYS_TRACEBACKLIMIT. The coverage build should have everything enabled, so it makes sense to use this ROM level for it. Signed-off-by: Damien George <damien@micropython.org>
* unix/variants: Enable remaining options on dev,coverage from ROM extra.Damien George2022-06-29
| | | | | | | | | | So that the default configuration for the dev and coverage variants includes all options set by MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES. Note that enabling MICROPY_PY_SYS_STDIO_BUFFER on unix doesn't do anything because unix doesn't use shared/runtime/sys_stdio_mphal.c. Signed-off-by: Damien George <damien@micropython.org>
* unix/variants: Move setting of MICROPY_PY_USELECT to port config file.Damien George2022-06-29
| | | | | | | | | | The default is the same as before: MICROPY_PY_USELECT=0 and MICROPY_PY_USELECT_POSIX=1. But now this can be easily overridden at the make command-line using, eg: make VARIANT=dev CFLAGS_EXTRA=-DMICROPY_PY_USELECT=1 Signed-off-by: Damien George <damien@micropython.org>
* unix/variants: Enable seeding random module on import in dev, coverage.Damien George2022-06-07
| | | | Signed-off-by: Damien George <damien@micropython.org>
* ports: Use default VFS config for import_stat and builtin_open.Damien George2022-05-25
| | | | | | | | | | | | | | | For ports with MICROPY_VFS and MICROPY_PY_IO enabled their configuration can now be simplified to use the defaults for mp_import_stat and mp_builtin_open. This commit makes no functional change, except for the following minor points: - the built-in "open" is removed from the minimal port (it previously did nothing) - the duplicate built-in "input" is removed from the esp32 port - qemu-arm now delegates to VFS import/open Signed-off-by: Damien George <damien@micropython.org>
* py/malloc: Introduce m_tracked_calloc, m_tracked_free functions.Damien George2022-05-05
| | | | | | Enabled by MICROPY_TRACKED_ALLOC. Signed-off-by: Damien George <damien@micropython.org>
* ports: Reformat more C and Python source code.Damien George2022-04-20
| | | | | | | These files that are reformatted only now fall under the list of files to apply uncrustify/black formatting to. Signed-off-by: Damien George <damien@micropython.org>
* unix/variants: Enable a few optimisations and features on dev, coverage.Damien George2022-03-10
| | | | Signed-off-by: Damien George <damien@micropython.org>
* unix/variants: Use rom feature config for standard, dev, coverage.Damien George2022-03-10
| | | | | | This change is a no-op in terms of functionality. Signed-off-by: Damien George <damien@micropython.org>
* py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them.Damien George2022-03-10
| | | | | | This allows customising the REPL prompt strings. Signed-off-by: Damien George <damien@micropython.org>
* py/modsys: Add optional sys.tracebacklimit attribute.Damien George2022-03-10
| | | | | | With behaviour as per CPython. Signed-off-by: Damien George <damien@micropython.org>
* unix/moduos: Convert module to use extmod version.Damien George2022-03-09
| | | | | | | | | | | | | All variants now use extmod/moduos.c as their uos module implementation. In particular this means they all have MICROPY_VFS enabled and use VfsPosix for their filesystem. As part of this, the available functions in uos become more consistent with other ports: - coverage variant gets uos.urandom - minimal and standard variant get: unlink, chdir, getcwd, listdir Signed-off-by: Damien George <damien@micropython.org>
* tests/unix: Add coverage test for freezing various objects.Damien George2022-02-28
| | | | Signed-off-by: Damien George <damien@micropython.org>
* py/modmath: Add math.tau, math.nan and math.inf constants.stijn2022-01-23
| | | | Configurable by the new MICROPY_PY_MATH_CONSTANTS option.