summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpconfig.h
Commit message (Collapse)AuthorAge
...
* py/mpconfig.h: MP_NOINLINE is universally useful, move from unix port.Paul Sokolovsky2016-06-15
|
* extmod/machine: Add MICROPY_PY_MACHINE_PULSE config for time_pulse_us.Damien George2016-05-31
| | | | | Since not all ports that enable the machine module have the pin HAL functions.
* py/objstr: Implement str.center().Paul Sokolovsky2016-05-22
| | | | | | Disabled by default, enabled in unix port. Need for this method easily pops up when working with text UI/reporting, and coding workalike manually again and again counter-productive.
* py: Add uerrno module, with errno constants and dict.Damien George2016-05-10
|
* py: Add mperrno.h file with uPy defined errno constants.Damien George2016-05-10
|
* py: Add ability to have frozen persistent bytecode from .mpy files.Damien George2016-04-13
| | | | | | | The config variable MICROPY_MODULE_FROZEN is now made of two separate parts: MICROPY_MODULE_FROZEN_STR and MICROPY_MODULE_FROZEN_MPY. This allows to have none, either or both of frozen strings and frozen mpy files (aka frozen bytecode).
* py: add async/await/async for/async with syntaxpohmelie2016-04-13
| | | | | | | | They are sugar for marking function as generator, "yield from" and pep492 python "semantically equivalents" respectively. @dpgeorge was the original author of this patch, but @pohmelie made changes to implement `async for` and `async with`.
* extmod: Add generic machine.I2C class, with bit-bang I2C.Damien George2016-04-12
| | | | Should work on any machine that provides the correct pin functions.
* extmod: Add initial framebuf module.Damien George2016-04-12
|
* py/modio: Initial implementation of io.BufferedWriter class.Paul Sokolovsky2016-03-25
| | | | Just .write() method implemented currently.
* extmod/modwebsocket: Start module for WebSocket helper functions.Paul Sokolovsky2016-03-24
| | | | Currently, only write support is implemented (of limited buffer size).
* py: Add MICROPY_DYNAMIC_COMPILER option to config compiler at runtime.Damien George2016-02-25
| | | | | | | | | | | | | | This new compile-time option allows to make the bytecode compiler configurable at runtime by setting the fields in the mp_dynamic_compiler structure. By using this feature, the compiler can generate bytecode that targets any MicroPython runtime/VM, regardless of the host and target compile-time settings. Options so far that fall under this dynamic setting are: - maximum number of bits that a small int can hold; - whether caching of lookups is used in the bytecode; - whether to use unicode strings or not (lexer behaviour differs, and therefore generated string constants differ).
* py/vm: Add macros to hook into various points in the VM.Damien George2016-02-17
| | | | | | | | | | | | | | | | | | | | These can be used to insert arbitrary checks, polling, etc into the VM. They are left general because the VM is a highly tuned loop and it should be up to a given port how that port wants to modify the VM internals. One common use would be to insert a polling check, but only done after a certain number of opcodes were executed, so as not to slow down the VM too much. For example: #define MICROPY_VM_HOOK_COUNT (30) #define MICROPY_VM_HOOK_INIT static uint vm_hook_divisor = MICROPY_VM_HOOK_COUNT #define MICROPY_VM_HOOK_POLL if (--vm_hook_divisor == 0) { \ vm_hook_divisor = MICROPY_VM_HOOK_COUNT; extern void vm_hook_function(void); vm_hook_function(); } #define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL #define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL
* py/mpz: Complete implementation of mpz_{and,or,xor} for negative args.Doug Currie2016-02-03
| | | | | | | | | | | | For these 3 bitwise operations there are now fast functions for positive-only arguments, and general functions for arbitrary sign arguments (the fast functions are the existing implementation). By default the fast functions are not used (to save space) and instead the general functions are used for all operations. Enable MICROPY_OPT_MPZ_BITWISE to use the fast functions for positive arguments.
* extmod/modurandom: Add some extra random functions.Damien George2016-01-26
| | | | | | | | | | | | | Functions added are: - randint - randrange - choice - random - uniform They are enabled with configuration variable MICROPY_PY_URANDOM_EXTRA_FUNCS, which is disabled by default. It is enabled for unix coverage build and stmhal.
* extmod/modurandom: Add "urandom" module.Paul Sokolovsky2016-01-17
| | | | | | | | Seedable and reproducible pseudo-random number generator. Implemented functions are getrandbits(n) (n <= 32) and seed(). The algorithm used is Yasmarang by Ilya Levin: http://www.literatecode.com/yasmarang
* py: Clean up instantiation of dupterm object.Paul Sokolovsky2016-01-01
| | | | To comply with already established scheme for extmod's.
* py/mpconfig: Make configuration of dupterm object reusable.Paul Sokolovsky2016-01-01
|
* unix/unix_mphal: Raise KeyboardInterrupt straight from signal handler.Paul Sokolovsky2015-12-23
| | | | | | | | POSIX doesn't guarantee something like that to work, but it works on any system with careful signal implementation. Roughly, the requirement is that signal handler is executed in the context of the process, its main thread, etc. This is true for Linux. Also tested to work without issues on MacOSX.
* py/mpprint: Fix printing of 64bit integers for 64bit windows buildsstijn2015-12-19
| | | | | | | | | | | | | | | | This makes all tests pass again for 64bit windows builds which would previously fail for anything printing ranges (builtin_range/unpack1) because they were printed as range( ld, ld ). This is done by reusing the mp_vprintf implementation for MICROPY_OBJ_REPR_D for 64bit windows builds (both msvc and mingw-w64) since the format specifier used for 64bit integers is also %lld, or %llu for the unsigned version. Note these specifiers used to be fetched from inttypes.h, which is the C99 way of working with printf/scanf in a portable way, but mingw-w64 wants to be backwards compatible with older MS C runtimes and uses the non-portable %I64i instead of %lld in inttypes.h, so remove the use of said header again in mpconfig.h and define the specifiers manually.
* py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts.Damien George2015-12-18
| | | | | | | | | | | | MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler, which is useful when only loading of pre-compiled bytecode is supported. It is enabled by default. MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin functions. By default they are only included if MICROPY_ENABLE_COMPILER is enabled. Disabling both options saves about 40k of code size on 32-bit x86.
* py: Add MICROPY_PY_BUILTINS_MIN_MAX, disable for minimal ports.pohmelie2015-12-07
|
* py/modsys: Implement sys.modules.Paul Sokolovsky2015-12-05
| | | | | This for example will allow people to reload modules which didn't load successfully (e.g. due to syntax error).
* py/mpconfig: Actually allow to override MICROPY_BYTES_PER_GC_BLOCK.Paul Sokolovsky2015-12-03
|
* py/gc: Make GC block size be configurable.Paul Sokolovsky2015-12-03
|
* py: Add support for 64-bit NaN-boxing object model, on 32-bit machine.Damien George2015-11-29
| | | | | | | | | | | | | To use, put the following in mpconfigport.h: #define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_D) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) typedef int64_t mp_int_t; typedef uint64_t mp_uint_t; #define UINT_FMT "%llu" #define INT_FMT "%lld" Currently does not work with native emitter enabled.
* py/mpconfig.h: Allow to build without alloca() for ANSI C compliance.Paul Sokolovsky2015-11-25
| | | | | Define MICROPY_NO_ALLOCA=1 and memory will be allocated from heap instead and freed by garbage collection.
* extmod/fsusermount: Make configurable with MICROPY_FSUSERMOUNT.Paul Sokolovsky2015-11-25
|
* windows/py: Support 64bit mingw-w64 buildsstijn2015-11-24
| | | | | | | | - add mp_int_t/mp_uint_t typedefs in mpconfigport.h - fix integer suffixes/formatting in mpconfig.h and mpz.h - use MICROPY_NLR_SETJMP=1 in Makefile since the current nlrx64.S implementation causes segfaults in gc_free() - update README
* py: Add MICROPY_PERSISTENT_CODE_LOAD/SAVE to load/save bytecode.Damien George2015-11-13
| | | | | | MICROPY_PERSISTENT_CODE must be enabled, and then enabling MICROPY_PERSISTENT_CODE_LOAD/SAVE (either or both) will allow loading and/or saving of code (at the moment just bytecode) from/to a .mpy file.
* py: Add MICROPY_PERSISTENT_CODE so code can persist beyond the runtime.Damien George2015-11-13
| | | | | | | | | | | Main changes when MICROPY_PERSISTENT_CODE is enabled are: - qstrs are encoded as 2-byte fixed width in the bytecode - all pointers are removed from bytecode and put in const_table (this includes const objects and raw code pointers) Ultimately this option will enable persistence for not just bytecode but also native code.
* py: Adjust object repr C (30-bit stuffed float) to reduce code size.Damien George2015-11-06
| | | | | | | | | | This patch adds/subtracts a constant from the 30-bit float representation so that str/qstr representations are favoured: they now have all the high bits set to zero. This makes encoding/decoding qstr strings more efficient (and they are used more often than floats, which are now slightly less efficient to encode/decode). Saves about 300 bytes of code space on Thumb 2 arch.
* py: Add object repr "C", where 30-bit floats are stuffed in obj word.Damien George2015-10-20
| | | | | | This new object representation puts floats into the object word instead of on the heap, at the expense of reducing their precision to 30 bits. It only makes sense when the word size is 32-bits.
* py: Add option for inline assembler to support ARMv7-M instructions.Damien George2015-10-16
| | | | | | Cortex-M0, M0+ and M1 only have ARMv6-M Thumb/Thumb2 instructions. M3, M4 and M7 have a superset of these, named ARMv7-M. This patch adds a config option to enable support of the superset of instructions.
* py: Remove dependency on printf/fwrite in mp_plat_print.Damien George2015-10-15
| | | | See issue #1500.
* py: Add support to call __init__ from a builtin module on first import.Damien George2015-10-12
|
* py: Move constant folding from compiler to parser.Damien George2015-10-12
| | | | | | | | | | It makes much more sense to do constant folding in the parser while the parse tree is being built. This eliminates the need to create parse nodes that will just be folded away. The code is slightly simpler and a bit smaller as well. Constant folding now has a configuration option, MICROPY_COMP_CONST_FOLDING, which is enabled by default.
* modussl: SSL socket wrapper module based on axTLS.Paul Sokolovsky2015-10-06
|
* py: Allocate parse nodes in chunks to reduce fragmentation and RAM use.Damien George2015-10-02
| | | | | | | | With this patch parse nodes are allocated sequentially in chunks. This reduces fragmentation of the heap and prevents waste at the end of individually allocated parse nodes. Saves roughly 20% of RAM during parse stage.
* py/objslice: Make slice attributes (start/stop/step) readable.Tom Soulanille2015-09-15
| | | | Configurable with MICROPY_PY_BUILTINS_SLICE_ATTRS. Disabled by default.
* lib/mp-readline: Add auto-indent support.Damien George2015-09-12
| | | | | | | | | 4 spaces are added at start of line to match previous indent, and if previous line ended in colon. Backspace deletes 4 space if only spaces begin a line. Configurable via MICROPY_REPL_AUTO_INDENT. Disabled by default.
* py: Add MICROPY_PY_BUILTINS_FILTER, disable for minimal ports.Paul Sokolovsky2015-08-20
| | | | Saves 320 bytes on x86.
* unix-cpy: Remove unix-cpy. It's no longer needed.Damien George2015-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unix-cpy was originally written to get semantic equivalent with CPython without writing functional tests. When writing the initial implementation of uPy it was a long way between lexer and functional tests, so the half-way test was to make sure that the bytecode was correct. The idea was that if the uPy bytecode matched CPython 1-1 then uPy would be proper Python if the bytecodes acted correctly. And having matching bytecode meant that it was less likely to miss some deep subtlety in the Python semantics that would require an architectural change later on. But that is all history and it no longer makes sense to retain the ability to output CPython bytecode, because: 1. It outputs CPython 3.3 compatible bytecode. CPython's bytecode changes from version to version, and seems to have changed quite a bit in 3.5. There's no point in changing the bytecode output to match CPython anymore. 2. uPy and CPy do different optimisations to the bytecode which makes it harder to match. 3. The bytecode tests are not run. They were never part of Travis and are not run locally anymore. 4. The EMIT_CPYTHON option needs a lot of extra source code which adds heaps of noise, especially in compile.c. 5. Now that there is an extensive test suite (which tests functionality) there is no need to match the bytecode. Some very subtle behaviour is tested with the test suite and passing these tests is a much better way to stay Python-language compliant, rather than trying to match CPy bytecode.
* py: Disable REPL EMACS key bindings by default.Damien George2015-07-26
|
* lib/mp-readline: Add emacs-style control characters for cursor movement.Tom Soulanille2015-07-26
| | | | Disabled by default. Adds 108 bytes to Thumb2 arch when enabled.
* py: Make qstr hash size configurable, defaults to 2 bytes.Damien George2015-07-20
| | | | | | | This patch makes configurable, via MICROPY_QSTR_BYTES_IN_HASH, the number of bytes used for a qstr hash. It was originally fixed at 2 bytes, and now defaults to 2 bytes. Setting it to 1 byte will save ROM and RAM at a small expense of hash collisions.
* py: Improve allocation policy of qstr data.Damien George2015-07-14
| | | | | | | | | | | | | | | | | | | | Previous to this patch all interned strings lived in their own malloc'd chunk. On average this wastes N/2 bytes per interned string, where N is the number-of-bytes for a quanta of the memory allocator (16 bytes on 32 bit archs). With this patch interned strings are concatenated into the same malloc'd chunk when possible. Such chunks are enlarged inplace when possible, and shrunk to fit when a new chunk is needed. RAM savings with this patch are highly varied, but should always show an improvement (unless only 3 or 4 strings are interned). New version typically uses about 70% of previous memory for the qstr data, and can lead to savings of around 10% of total memory footprint of a running script. Costs about 120 bytes code size on Thumb2 archs (depends on how many calls to gc_realloc are made).
* py: Add TimeoutError exception subclassed from OSError.Daniel Campora2015-07-02
| | | | | | | The TimeoutError is useful for some modules, specially the the socket module. TimeoutError can then be alised to socket.timeout and then Python code can differentiate between socket.error and socket.timeout.
* py: Use a wrapper to explicitly check self argument of builtin methods.Damien George2015-06-20
| | | | | | | | | | | | | | | Previous to this patch a call such as list.append(1, 2) would lead to a seg fault. This is because list.append is a builtin method and the first argument to such methods is always assumed to have the correct type. Now, when a builtin method is extracted like this it is wrapped in a checker object which checks the the type of the first argument before calling the builtin function. This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and is enabled by default. See issue #1216.
* py: Add further autodetection of endianess in mpconfig.h.Damien George2015-05-30
| | | | This patch was needed for gcc 4.4.