aboutsummaryrefslogtreecommitdiff
path: root/ports/unix
AgeCommit message (Collapse)Author
2020-01-26unix: Release GIL during all system calls.David Lechner
Addition of GIL EXIT/ENTER pairs are: - modos: release the GIL during system calls. CPython does this as well. - moduselect: release the GIL during the poll() syscall. This call can be blocking, so it is important to allow other threads to run at this time. - modusocket: release the GIL during system calls. Many of these calls can be blocking, so it is important to allow other threads to run. - unix_mphal: release the GIL during the read and write syscalls in mp_hal_stdin_rx_chr and mp_hal_stdout_tx_strn. If we don't do this threads are blocked when the REPL or the builtin input function are used. - file, main, mpconfigport.h: release GIL during syscalls in built-in functions that could block.
2020-01-24unix/Makefile: Reserve CFLAGS_EXTRA/LDFLAGS_EXTRA for external use.Damien George
When CFLAGS_EXTRA/LDFLAGS_EXTRA (or anything) is set on the command line of a make invocation then it will completely override any setting or appending of these variables in the makefile(s). This means builds like the coverage variant will have their mpconfigvariant.mk settings overridden. Fix this by using CFLAGS/LDFLAGS exclusively in the makefile(s), reserving the CFLAGS_EXTRA/LDFLAGS_EXTRA variables for external command-line use only.
2020-01-24tests/unix: Add coverage tests for mp_obj_is_type() and variants.Yonatan Goldschmidt
2020-01-23tests/unix: Add coverage test for mp_obj_new_exception_args.Damien George
Because it's no longer called anywhere in the code.
2020-01-22tests/unix: Add coverage tests for pairheap data structure.Damien George
2020-01-14tests/unix: Add coverage test for new mp_obj_int_get_uint_checked func.Damien George
2020-01-12lib/mp-readline: Add word-based move/delete EMACS key sequences.Yonatan Goldschmidt
This commit adds backward-word, backward-kill-word, forward-word, forward-kill-word sequences for the REPL, with bindings to Alt+F, Alt+B, Alt+D and Alt+Backspace respectively. It is disabled by default and can be enabled via MICROPY_REPL_EMACS_WORDS_MOVE. Further enabling MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE adds extra bindings for these new sequences: Ctrl+Right, Ctrl+Left and Ctrl+W. The features are enabled on unix micropython-coverage and micropython-dev.
2020-01-12unix: Rename unix binaries to micropython-variant (not _variant).Jim Mussared
For consistency with mpy-cross, and other unix tools in general.
2020-01-12unix: Add placeholder DEV variant with settrace enabled.Jim Mussared
This will eventually become the "full featured" unix binary with more features enabled, specifically useful for development and testing.
2020-01-12unix: Add build variants, analogous to boards on bare-metal.Jim Mussared
Invoking "make" will still build the standard "micropython" executable, but other variants are now build using, eg, "make VARIANT=minimal". This follows how bare-metal ports specify a particular board, and allows running any make target (eg clean, test) with any variant. Convenience targets (eg "make coverage") are provided to retain the old behaviour, at least for now. See issue #3043.
2019-12-28py/objslice: Add support for indices() method on slice objects.Nicko van Someren
Instances of the slice class are passed to __getitem__() on objects when the user indexes them with a slice. In practice the majority of the time (other than passing it on untouched) is to work out what the slice means in the context of an array dimension of a particular length. Since Python 2.3 there has been a method on the slice class, indices(), that takes a dimension length and returns the real start, stop and step, accounting for missing or negative values in the slice spec. This commit implements such a indices() method on the slice class. It is configurable at compile-time via MICROPY_PY_BUILTINS_SLICE_INDICES, disabled by default, enabled on unix, stm32 and esp32 ports. This commit also adds new tests for slice indices and for slicing unicode strings.
2019-12-28unix/modos: Add uos.rename and uos.rmdir.Damien George
The existing uos.remove cannot be used to remove directories, instead uos.rmdir is needed. And also provide uos.rename to get a good set of filesystem functionality without requiring additional Python-level os functions (eg using ffi).
2019-12-28unix/modtime: Add utime.mktime function, to complement utime.localtime.Andrew Leech
This also adds it to the windows port.
2019-12-27py: Introduce MP_ROM_NONE macro for ROM to refer to None object.Damien George
This helps to prevent mistakes, and allows easily changing the ROM value of None if needed.
2019-11-21unix/modtermios: Fix output speed setter in tcsetattr.Laurens Valk
The input speed was being set twice and the output speed was not set.
2019-11-11extmod: Consolidate FAT FS config to MICROPY_VFS_FAT across all ports.Damien George
This commit removes the Makefile-level MICROPY_FATFS config and moves the MICROPY_VFS_FAT config to the Makefile level to replace it. It also moves the include of the oofatfs source files in the build from each port to a central place in extmod/extmod.mk. For a port to enabled VFS FAT support it should now set MICROPY_VFS_FAT=1 at the level of the Makefile. This will include the relevant oofatfs files in the build and set MICROPY_VFS_FAT=1 at the C (preprocessor) level.
2019-10-30extmod/vfs_lfs: Allow compiling in VfsLfs1 and VfsLfs2 separately.Damien George
These classes are enabled via the config options MICROPY_VFS_LFS1 and MICROPY_VFS_LFS2, which are disabled by default.
2019-10-29unix/mphalport.h: Define mp_hal_stdio_poll to dummy because it's unused.Damien George
And requires uintptr_t to declare the default version in py/mphal.h.
2019-10-29unix: Enable uos.VfsLfs1, uos.VfsLfs2 on coverage build.Damien George
2019-10-22unix,windows: Enable module weak links.Damien George
2019-10-21unix: Allow building without a manifest.Jim Mussared
2019-10-21tools/makemanifest.py: Eval relative paths w.r.t. current manifest file.Jim Mussared
When loading a manifest file, e.g. by include(), it will chdir first to the directory of that manifest. This means that all file operations within a manifest are relative to that manifest's location. As a consequence of this, additional environment variables are needed to find absolute paths, so the following are added: $(MPY_LIB_DIR), $(PORT_DIR), $(BOARD_DIR). And rename $(MPY) to $(MPY_DIR) to be consistent. Existing manifests are updated to match.
2019-10-15unix: Convert to use FROZEN_MANIFEST to specify frozen code.Damien George
Removes symlinks in modules directory, all frozen code is now specified by manifest.py.
2019-10-15ports: Add new make target "submodules" which inits required modules.Damien George
2019-10-01py/bc: Change mp_code_state_t.exc_sp to exc_sp_idx.Damien George
Change from a pointer to an index, to make space in mp_code_state_t.
2019-10-01unix/coverage: Add coverage tests for ringbuf.Jim Mussared
2019-09-26py: Rename MP_QSTR_NULL to MP_QSTRnull to avoid intern collisions.Josh Lloyd
Fixes #5140.
2019-08-30py: Integrate sys.settrace feature into the VM and runtime.Milan Rossa
This commit adds support for sys.settrace, allowing to install Python handlers to trace execution of Python code. The interface follows CPython as closely as possible. The feature is disabled by default and can be enabled via MICROPY_PY_SYS_SETTRACE.
2019-08-28py: Add global default_emit_opt variable to make emit kind persistent.Damien George
mp_compile no longer takes an emit_opt argument, rather this setting is now provided by the global default_emit_opt variable. Now, when -X emit=native is passed as a command-line option, the emitter will be set for all compiled modules (included imports), not just the top-level script. In the future there could be a way to also set this variable from a script. Fixes issue #4267.
2019-08-28unix/main: Only accept full emit cmd-line options if native enabled.Damien George
2019-08-19extmod/modure: Make regex dump-code debugging feature optional.Damien George
Enabled via MICROPY_PY_URE_DEBUG, disabled by default (but enabled on unix coverage build). This is a rarely used feature that costs a lot of code (500-800 bytes flash). Debugging of regular expressions can be done offline with other tools.
2019-08-17py/modmath: Implement math.isclose() for non-complex numbers.stijn
As per PEP 485, this function appeared in for Python 3.5. Configured via MICROPY_PY_MATH_ISCLOSE which is disabled by default, but enabled for the ports which already have MICROPY_PY_MATH_SPECIAL_FUNCTIONS enabled.
2019-08-16gitignore: Put build-*/ pattern in top-level gitignore file.Damien George
2019-08-15unix: Enable sys.atexit, triggered after the main script ends.Milan Rossa
2019-07-09unix/unix_mphal: Include time.h for CLOCK_MONOTONIC.Paul m. p. P
2019-06-26unix/unix_mphal: Use CLOCK_MONOTONIC for ticks_ms/us when available.Mikhail Zakharov
2019-06-05unix/mpconfigport.mk: Update comment about TLS implementations.Damien George
As long as the submodule is checked out, mbedTLS is now fully integrated into the unix build if MICROPY_SSL_MBEDTLS=1.
2019-05-28unix/modusocket: Raise ETIMEDOUT when connect or accept has timeout.Damien George
2019-05-17various: Update early copyright years to match actual edit history.Damien George
2019-05-17various: Add and update my copyright line based on git history.Paul Sokolovsky
For modules I initially created or made substantial contributions to.
2019-05-14py/objarray: Add support for memoryview.itemsize attribute.stijn
This allows figuring out the number of bytes in the memoryview object as len(memview) * memview.itemsize. The feature is enabled via MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE and is disabled by default.
2019-05-08unix/modusocket: Fix use of setsockopt in usocket.settimeout impl.Elad Namdar
The original code called setsockopt(SO_RCVTIMEO/SO_SNDTIMEO) with NULL timeout structure argument, which is an illegal usage of that function. The old code also didn't validate the return value of setsockopt, missing the bug completely.
2019-05-06extmod/moducryptolib: Add AES-CTR support.Yonatan Goldschmidt
Selectable at compile time via MICROPY_PY_UCRYPTOLIB_CTR. Disabled by default.
2019-05-03unix/coverage: Add test for printing literal % character.Damien George
2019-05-01unix/gcollect: Make sure stack/regs get captured properly for GC.stijn
When building with link time optimization enabled it is possible both gc_collect() and gc_collect_regs_and_stack() get inlined into gc_alloc() which can result in the regs variable being pushed on the stack earlier than some of the registers. Depending on the calling convention, those registers might however contain pointers to blocks which have just been allocated in the caller of gc_alloc(). Then those pointers end up higher on the stack than regs, aren't marked by gc_collect_root() and hence get sweeped, even though they're still in use. As reported in #4652 this happened for in 32-bit msvc release builds: mp_lexer_new() does two consecutive allocations and the latter triggered a gc_collect() which would sweep the memory of the first allocation again.
2019-03-27unix/mpthreadport: Use named semaphores on Mac OS X.Damiano Mazzella
Unnamed semaphores (via sem_init) are not supported on this OS. See #4465.
2019-03-08unix/Makefile: Update coverage tests to match those in Travis.Damien George
2019-03-05ports: Update to work with new oofatfs version.Damien George
2019-02-25unix/modffi: Eliminate unused-argument warning when debugging disabled.Damien George
2019-02-14extmod/moduwebsocket: Refactor `websocket` to `uwebsocket`.Yonatan Goldschmidt
As mentioned in #4450, `websocket` was experimental with a single intended user, `webrepl`. Therefore, we'll make this change without a weak link `websocket` -> `uwebsocket`.