aboutsummaryrefslogtreecommitdiff
path: root/unix/mpconfigport.h
AgeCommit message (Collapse)Author
2015-12-18unix: machine_mem improvementsDave Hylands
This basically introduces the MICROPY_MACHINE_MEM_GET_READ_ADDR and MICROPY_MACHINE_MEM_GET_WRITE_ADDR macros. If one of them is not defined, then a default identity function is provided.
2015-12-18ports: Rename "machine" module to "umachine".Paul Sokolovsky
To let unix port implement "machine" functionality on Python level, and keep consistent naming in other ports (baremetal ports will use magic module "symlinking" to still load it on "import machine"). Fixes #1701.
2015-12-16unix: Change define logic of _DIRENT_HAVE_D_INO to match other macros.Damien George
2015-12-14unix/modos: Implement ilistdir().Paul Sokolovsky
ilistdir() returns iterator which yields triples of (name, type, ino) where ino is inode number for entry's data, type of entry (file/dir/etc.), and name of file/dir. listdir() can be easily implemented in terms of this iterator (which is otherwise more efficient in terms of memory use and may save expensive call to stat() for each returned entry). CPython has os.scandir() which also returns an iterator, but it yields more complex objects of DirEntry type. scandir() can also be easily implemented in terms of ilistdir().
2015-12-13unix/moduselect: Make configurable with MICROPY_PY_USELECT.Paul Sokolovsky
2015-12-13unix: Move modmachine into unix directoryDave Hylands
This leaves behind the common functionality in extmod/machine_mem.c which can be used by all ports.
2015-12-12unix: Rename "_os" module to "uos" for consistency with baremetal ports.Paul Sokolovsky
2015-12-03unix/mpconfigport: Typo fix in comment.Paul Sokolovsky
2015-12-02unix/mpconfigport.h: For MICROPY_NO_ALLOCA=1, don't even include alloca.h.Paul Sokolovsky
2015-11-29py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George
2015-11-29unix/modtime: sleep(): Automatically restart after receiving EINTR.Paul Sokolovsky
THis is required to deal well with signals, signals being the closest analogue of hardware interrupts for POSIX. This is also CPython 3.5 compliant behavior (PEP 475). The main problem implementing this is to figure out how much time was spent in waiting so far/how much is remaining. It's well-known fact that Linux updates select()'s timeout value when returning with EINTR to the remaining wait time. Here's what POSIX-based standards say about this: (http://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html): "Upon successful completion, the select() function may modify the object pointed to by the timeout argument." I.e. it allows to modify timeout value, but doesn't say how exactly it is modified. And actually, it allows such modification only "upon successful completion", which returning with EINTR error hardly is. POSIX also allows to request automatic EINTR restart for system calls using sigaction call with SA_RESTART flag, but here's what the same document says about it: "If SA_RESTART has been set for the interrupting signal, it is implementation-defined whether the function restarts or returns with [EINTR]." In other words, POSIX doesn't leave room for both portable and efficient handling of this matter, so the code just allows to manually select Linux-compatible behavior with MICROPY_SELECT_REMAINING_TIME option, or otherwise will just raise OSError. When systems with non-Linux behavior are found, they can be handled separately.
2015-11-22unix: Use printf() implementation in terms of mp_printf().Paul Sokolovsky
In other words, unix port now uses overriden printf(), instead of using libc's. This should remove almost all dependency on libc stdio (which is bloated).
2015-11-17unix: Add "uselect" module, with poll() function.Paul Sokolovsky
Underlyingly, uses standard POSIX poll() for portability.
2015-11-13unix: Use standard mphalport.h header.Paul Sokolovsky
This also unbreaks "make minimal".
2015-11-13unix: Allow to override MICROPY_PY_MATH_SPECIAL_FUNCTIONS from command-line.Paul Sokolovsky
2015-11-13unix/mpconfigport: Move log2() definition to modmath.c.Paul Sokolovsky
It's safer to define it where it's used, defining it for all source files may lead to hard to diagnose conflicts in corner cases.
2015-10-31all: Add py/mphal.h and use it in all ports.Damien George
py/mphal.h contains declarations for generic mp_hal_XXX functions, such as stdio and delay/ticks, which ports should provide definitions for. A port will also provide mphalport.h with further HAL declarations.
2015-10-18unix/modos: Add statvfs() function.Paul Sokolovsky
Another function (like stat) which is problematic to deal with on ABI level (FFI), as struct statvfs layout may differ unpredictably between OSes and even different versions of a same OS. So, implement it in C, returning a 10-element tuple of f_bsize, f_frsize, f_blocks, f_bfree, f_bavail, f_files, f_ffree, f_favail, f_flag, f_namemax. This is exactly the order described in Python3 docs, https://docs.python.org/3/library/os.html#os.statvfs (but note that os.statvfs() should make these values available as attributes).
2015-10-15unix: Fix coverage build now that mp_plat_print uses write.Damien George
2015-10-15py: Remove dependency on printf/fwrite in mp_plat_print.Damien George
See issue #1500.
2015-10-15unix: Allow to build against Android down to 1.5.Paul Sokolovsky
Bionic libc in Android 1.5 missed log2() and nan() functions.
2015-09-15py/objslice: Make slice attributes (start/stop/step) readable.Tom Soulanille
Configurable with MICROPY_PY_BUILTINS_SLICE_ATTRS. Disabled by default.
2015-09-12unix: Enable REPL auto-indent.Damien George
2015-09-11unix/modjni: "jni" module to interface to JNI-compliant JavaVM.Paul Sokolovsky
This includes Android Dalvik VM for example. Example usage: import jni System = jni.cls("java/lang/System") System.out.println("Hello, Java!")
2015-08-05unix/mpconfigport.h: set MICROPY_PY_SYS_PLATFORM to "darwin" if compiled on OSXblmorris
This change allows micropython to return the same value as CPython for sys.platform
2015-07-26lib/mp-readline: Add emacs-style control characters for cursor movement.Tom Soulanille
Disabled by default. Adds 108 bytes to Thumb2 arch when enabled.
2015-07-08modmachine: Implement physical memory access using /dev/mem (Linux, etc).Paul Sokolovsky
This requires root access. And on recent Linux kernels, with CONFIG_STRICT_DEVMEM option enabled, only address ranges listed in /proc/iomem can be accessed. The above compiled-time option can be however overriden with boot-time option "iomem=relaxed". This also removed separate read/write paths - there unlikely would be a case when they're different.
2015-06-02unix: Include upip as fronzen modules inside the standard interpreter.Paul Sokolovsky
MicroPython doesn't come with standard library included, so it is important to be able to easily install needed package in a seamless manner. Bundling package manager (upip) inside an executable solves this issue. upip is bundled only with standard executable, not "minimal" or "fast" builds.
2015-05-27unix: Add option to use uPy readline, and enable by default.Damien George
This gets uPy readline working with unix port, with tab completion and history. GNU readline is still supported, configure using MICROPY_USE_READLINE variable.
2015-05-17Revert "unix: Include stdio.h to allow easy debugging with printf()."Paul Sokolovsky
This reverts commit 8fbabab1a80efa8b9c0654f63b2157d8f8299955. Turned to cause problems on MacOSX.
2015-05-10unix: Include stdio.h to allow easy debugging with printf().Paul Sokolovsky
2015-05-08unix: Fix thumb2 vs arm native emitter auto-detection.Paul Sokolovsky
Make thumb2 have priority over arm.
2015-05-04modbuiltins: Add NotImplemented builtin constant.Paul Sokolovsky
From https://docs.python.org/3/library/constants.html#NotImplemented : "Special value which should be returned by the binary special methods (e.g. __eq__(), __lt__(), __add__(), __rsub__(), etc.) to indicate that the operation is not implemented with respect to the other type; may be returned by the in-place binary special methods (e.g. __imul__(), __iand__(), etc.) for the same purpose. Its truth value is true." Some people however appear to abuse it to mean "no value" when None is a legitimate value (don't do that).
2015-05-04modmachine: Add new module to access hardware, starting with physical memory.Paul Sokolovsky
Refactored from "stm" module, provides mem8, mem16, mem32 objects with array subscript syntax.
2015-04-25modsys: Add basic sys.exc_info() implementation.Paul Sokolovsky
The implementation is very basic and non-compliant and provided solely for CPython compatibility. The function itself is bad Python2 heritage, its usage is discouraged.
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
2015-04-04objstr: Add .splitlines() method.Paul Sokolovsky
splitlines() occurs ~179 times in CPython3 standard library, so was deemed worthy to implement. The method has subtle semantic differences from just .split("\n"). It is also defined as working for any end-of-line combination, but this is currently not implemented - it works only with LF line-endings (which should be OK for text strings on any platforms, but not OK for bytes).
2015-04-03unix: Add stackless config settings, for easy access.Paul Sokolovsky
2015-03-26py: Add optional support for descriptors' __get__ and __set__ methods.stijn
Disabled by default. Enabled on unix and windows ports.
2015-03-20py: Allow retrieving a function's __name__.stijn
Disabled by default. Enabled on unix and stmhal ports.
2015-03-20py: Implement core of OrderedDict type.Paul Sokolovsky
Given that there's already support for "fixed table" maps, which are essentially ordered maps, the implementation of OrderedDict just extends "fixed table" maps by adding an "is ordered" flag and add/remove operations, and reuses 95% of objdict code, just making methods tolerant to both dict and OrderedDict. Some things are missing so far, like CPython-compatible repr and comparison. OrderedDict is Disabled by default; enabled on unix and stmhal ports.
2015-03-14py: Add MICROPY_COMP_{DOUBLE,TRIPLE}_TUPLE_ASSIGN config options.Damien George
These allow to fine-tune the compiler to select whether it optimises tuple assignments of the form a, b = c, d and a, b, c = d, e, f. Sensible defaults are provided.
2015-03-13unix: Support readline history saving to file, improves interactive usage.Paul Sokolovsky
2015-03-03py: Add MICROPY_MALLOC_USES_ALLOCATED_SIZE to allow simpler malloc API.Damien George
2015-02-27objarray: Implement array slice assignment.Paul Sokolovsky
This is rarely used feature which takes enough code to implement, so is controlled by MICROPY_PY_ARRAY_SLICE_ASSIGN config setting, default off. But otherwise it may be useful, as allows to update arbitrary-sized data buffers in-place. Slice is yet to implement, and actually, slice assignment implemented in such a way that RHS of assignment should be array of the exact same item typecode as LHS. CPython has it more relaxed, where RHS can be any sequence of compatible types (e.g. it's possible to assign list of int's to a bytearray slice). Overall, when all "slice write" features are implemented, it may cost ~1KB of code.
2015-02-22py: Make math special functions configurable and disabled by default.Damien George
The implementation of these functions is very large (order 4k) and they are rarely used, so we don't enable them by default. They are however enabled in stmhal and unix, since we have the room.
2015-01-31py: Add MICROPY_PY_ALL_SPECIAL_METHODS and __iadd__ special method under it.Paul Sokolovsky
2015-01-16unix: Add target to build "minimal" uPy interpreter.Damien George
2015-01-14py, unix: Trace root pointers with native emitter under unix port.Damien George
Native code has GC-heap pointers in it so it must be scanned. But on unix port memory for native functions is mmap'd, and so it must have explicit code to scan it for root pointers.
2015-01-10py: Add config option MICROPY_COMP_MODULE_CONST for module consts.Damien George
Compiler optimises lookup of module.CONST when enabled (an existing feature). Disabled by default; enabled for unix, windows, stmhal. Costs about 100 bytes ROM on stmhal.