aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-01-12docs/library: Add / to indicate positional-only args in library docs.Jason Neal
Removes the confusion of positional-only arguments which have defaults that look like keyword arguments.
2020-01-12esp32/modmachine: Add implementation of machine.soft_reset().Thorsten von Eicken
2020-01-12docs/library/machine: Document machine.soft_reset() function.Thorsten von Eicken
2020-01-12py/runtime: Move MICROPY_PORT_INIT_FUNC near the end of mp_init().David Lechner
This moves the MICROPY_PORT_INIT_FUNC hook to the end of mp_init(), just before MP_THREAD_GIL_ENTER(), so that everything (in particular the GIL mutex) is intialized before the hook is called. MICROPY_PORT_DEINIT_FUNC is also moved to be symmetric (but there is no functional change there). If a port needs to perform initialisation earlier than MICROPY_PORT_INIT_FUNC then it can do it before calling mp_init().
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-12lib/mp-readline: Add an assert() to catch buffer overflows.Yonatan Goldschmidt
During readline development, this function may receive bad `pos` values. It's easier to understand the assert() failing error than to have a "stack smashing detected" message.
2020-01-12py/unicode: Add unichar_isalnum().Yonatan Goldschmidt
2020-01-12docs/README: Add short paragraph about using readthedocs.Thorsten von Eicken
This adds a short paragraph on how to hook readthedocs.org up. The main goal is to make people aware of the option, to help with contributing to the documentation.
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-12travis: Update travis to specify which unix variant to build.Jim Mussared
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.
2020-01-12py/mkenv.mk: Move usage of 32-bit flags to py.mk.Jim Mussared
This allows ports/variants to configure MICROPY_FORCE_32BIT after including mkenv.mk, but before py.mk.
2020-01-09py: Make mp_obj_get_type() return a const ptr to mp_obj_type_t.Damien George
Most types are in rodata/ROM, and mp_obj_base_t.type is a constant pointer, so enforce this const-ness throughout the code base. If a type ever needs to be modified (eg a user type) then a simple cast can be used.
2020-01-07stm32/boards/PYBD: Change RTC asynch prediv from 1 to 4.Damien George
This change has the following effects: - Reduces the resolution of the RTC sub-second counter from 30.52us to 122.07us. - Allows RTC.calibration() to now support positive values (as well as negative values). - Reduces VBAT current consumption in standby mode by a small amount. For general purpose use 122us resolution of the sub-second counter is good enough, and the benefits of full range calibration and minor reduction in VBAT consumption are worth the change.
2020-01-06tests/unix: Make unix time test pass on more platforms.stijn
As the mktime documentation for CPython states: "The earliest date for which it can generate a time is platform-dependent". In particular on Windows this depends on the timezone so e.g. for UTC+2 the earliest is 2 hours past midnight January 1970. So change the reference to the earliest possible, for UTC+14.
2020-01-06tests/cpydiff: Add CPy diff-test for using dict.keys() as a set.Damien George
See issue #5493.
2020-01-06esp32/Makefile: Assign result of $call to dummy var for older make.Damien George
Make version 4.1 and lower does not allow $call as the main expression on a line, so assign the result of the $call to a dummy variable. Fixes issue #5426.
2020-01-06docs/library/machine.UART.rst: Detail timeout behaviour of read methods.Jason Neal
Also document existence of "invert" argument to constructor.
2020-01-06docs/library/machine.I2C.rst: Use positional-only arguments syntax.Jason Neal
Addresses issue #5196.
2020-01-06tests/run-tests: Handle 'CRASH' return by float.py feature test.David Lechner
It is possile for `run_feature_check(pyb, args, base_path, 'float.py')` to return `b'CRASH'`. This causes an unhandled exception in `int()`. This commit fixes the problem by first testing for `b'CRASH'` before trying to convert the return value to an integer.
2020-01-06docs: More consistent capitalization and use of articles in headings.Jason Neal
See issue #3188.
2020-01-06tools/gen-cpydiff.py: Adjust subsections to sentence case.Jason Neal
2019-12-29py/objslice: Inline fetching of slice paramters in str_subscr().Nicko van Someren
To reduce code size.
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-28nrf/examples: Fix typo in mountsd.py, wireing -> wiring.Tim Gates
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-28py: Clean up commented-out code and comments about exception hierarchy.Damien George
In CPython, EnvironmentError and IOError are now aliases of OSError so no need to have them listed in the code. OverflowError inherits from ArithmeticError because it's intended to be raised "when the result of an arithmetic operation is too large to be represented" (per CPython docs), and MicroPython aims to match the CPython exception hierarchy.
2019-12-28nrf/main: Remove unnecessary repl_info(0) call.Yonatan Goldschmidt
It's statically initialized to 0.
2019-12-28lib/utils/pyexec: Introduce MICROPY_REPL_INFO, wrap debug prints in it.Yonatan Goldschmidt
For the 3 ports that already make use of this feature (stm32, nrf and teensy) this doesn't make any difference, it just allows to disable it from now on. For other ports that use pyexec, this decreases code size because the debug printing code is dead (it can't be enabled) but the compiler can't deduce that, so code is still emitted.
2019-12-27extmod/modbluetooth: Fix func prototype, empty args should be (void).Yonatan Goldschmidt
This fixes a -Wstrict-prototypes error.
2019-12-27ports: Allow overriding CROSS_COMPILE in a custom makefile.David Lechner
Many ports already allow overriding CROSS_COMPILE. This modifies the remaining ports to allow it as well.
2019-12-27py/obj.h: Use 32-bit shift in MP_OBJ_NEW_QSTR calc for obj-repr D.Damien George
The qst value is always small enough to fit in 31-bits (even less) and using a 32-bit shift rather than a 64-bit shift reduces code size by about 300 bytes.
2019-12-27py/objstr: Don't use inline GET_STR_DATA_LEN for object-repr D.Damien George
Changing to use the helper function mp_obj_str_get_data_no_check() reduces code size of nan-boxing builds by about 1000 bytes.
2019-12-27travis: Add stm32 build in nanbox mode.Damien George
2019-12-27stm32: Add configuration to build in nanbox mode.Damien George
Most stm32 boards can now be built in nan-boxing mode via: $ make NANBOX=1 Note that if float is enabled then it will be forced to double-precision. Also, native emitters will be disabled.
2019-12-27stm32: Fix to build in nanbox mode.Damien George
2019-12-27drivers/cyw43: Fix to build in nanbox mode.Damien George
2019-12-27extmod: Fix modbluetooth and modwebrepl to build in nanbox mode.Damien George
2019-12-27py/objobject: Fix __setattr__/__delattr__ to build in nanbox mode.Damien George
2019-12-27py: Introduce MP_ROM_FALSE/MP_ROM_TRUE for ROM to refer to bool objects.Damien George
This helps to prevent mistakes, and allows easily changing the ROM value of False/True if needed.
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-12-27py/objsingleton: Use mp_generic_unary_op for singleton objects.Damien George
So these types more closely match NoneType, eg they can be hashed, like in CPython.
2019-12-27tests/micropython: Add test for yield-from while heap is locked.Damien George
2019-12-27py/runtime: Don't allocate iter buf for user-defined types.Damien George
A user-defined type that defines __iter__ doesn't need any memory to be pre-allocated for its iterator (because it can't use such memory). So optimise for this case by not allocating the iter-buf.
2019-12-27travis: Add new job to build and test unix coverage in 32-bit mode.Damien George
2019-12-27tests/extmod: Split out VfsFat finaliser tests to separate test file.Damien George
It tests independent functionality and may need to be skipped for a given port.
2019-12-27tests/run-tests: Add "--mpy-cross-flags" arg to specify mpy-cross flags.Damien George
2019-12-27py/asmx86: Remove unused 5th argument facility.Damien George
In commit 71a3d6ec3bd02c5bd13334537e1bd146bb643bad mp_setup_code_state was changed from a 5-arg function to a 4-arg function, and at that point 5-arg calls in native code were no longer needed. See also commit 4f9842ad80c235188955fd83317f715033a596c0.