aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-01-23tools/pydfu.py: Clean up syntax, update comments and docstrings.c0rejump
Some parts of code have been aligned to increase readability. In general '' instead of "" were used wherever possible to keep the same convention for entire file. Import inspect line has been moved to the top according to hints reported by pep8 tools. A few extra spaces were removed, a few missing spaces were added. Comments have been updated, mostly in "read_dfu_file" function. Some other comments have been capitalized and/or slightly updated. A few docstrings were fixed as well. No real code changes intended.
2020-01-23tools: Add metrics.py script to build and compute port sizes/metrics.Damien George
2020-01-22tests/unix: Add coverage tests for pairheap data structure.Damien George
2020-01-22tests/extmod: Add basic machine.Timer test.Damien George
2020-01-22stm32/softtimer: Change linear linked list to a pairing heap.Damien George
2020-01-22py/pairheap: Add generic implementation of pairing heap data structure.Damien George
2020-01-22windows: Support word-based move/delete key sequences for REPL.stijn
Translate common Ctrl-Left/Right/Delete/Backspace to the EMACS-style sequences (i.e. Alt key based) for forward-word, backward-word, forwad-kill and backward-kill. Requires MICROPY_REPL_EMACS_WORDS_MOVE to be defined so the readline implementation interprets these.
2020-01-22esp32/modnetwork: Add max_clients kw-arg to WLAN.config for AP setting.adzierzanowski
This allows the user to configure the maximum number of clients that are connected to the access point. Resolves #5125.
2020-01-22docs/library/uos.rst: Improve block devices section, and ioctl ret vals.Peter Hinch
2020-01-22tests: Make run-tests help and README be more descriptive of behaviour.Thorsten von Eicken
2020-01-15esp32: Enable NimBLE support on all builds (IDF 3.3 and 4.0).Jim Mussared
This commit updates the IDFv3 version to v3.3.1, and enables the "ubluetooth" module by default on IDFv3 builds.
2020-01-14esp8266/modules: Fix AttributeError in _boot.py if flash not formatted.JensDiemer
Prior to this commit, if the flash filesystem was not formatted then it would error: "AttributeError: 'FlashBdev' object has no attribute 'mount'". That is due to it not being able to detect the filesystem on the block device and just trying to mount the block device directly. This commit fixes the issue by just catching all exceptions. Also it's not needed to try the mount if `flashbdev.bdev` is None.
2020-01-14ports: Modify mp_hal_pin_write macro so it can be used as a function.Memiks
Even though it doesn't return anything it could still be used like a function. Addresses issue #5501.
2020-01-14tests/unix: Add coverage test for new mp_obj_int_get_uint_checked func.Damien George
2020-01-14py/objint: Add mp_obj_int_get_uint_checked() helper.Yonatan Goldschmidt
Can be used where mp_obj_int_get_checked() will overflow due to the sign-bit solely. This returns an mp_uint_t, so it also verifies the given integer is not negative. Currently implemented only for mpz configurations.
2020-01-12py/mpconfig.h: Define BITS_PER_BYTE only if not already defined.Yonatan Goldschmidt
It's a common macro that is possibly defined in headers of systems/SDKs MicroPython is embedded into.
2020-01-13py/obj: Optimise mp_obj_get_type for immediate objs with repr A and C.Damien George
This function is called often and with immediate objects enabled it has more cases, so optimise it for speed. With this optimisation the runtime is now slightly faster with immediate objects enabled than with them disabled.
2020-01-13py/obj: Add MICROPY_OBJ_IMMEDIATE_OBJS option to reduce code size.Damien George
This option (enabled by default for object representation A, B, C) makes None/False/True objects immediate objects, ie they are no longer a concrete object in ROM but are rather just values, eg None=0x6 for representation A. Doing this saves a considerable amount of code size, due to these objects being widely used: bare-arm: -392 -0.591% minimal x86: -252 -0.170% [incl +52(data)] unix x64: -624 -0.125% [incl -128(data)] unix nanbox: +0 +0.000% stm32: -1940 -0.510% PYBV10 cc3200: -1216 -0.659% esp8266: -404 -0.062% GENERIC esp32: -732 -0.064% GENERIC[incl +48(data)] nrf: -988 -0.675% pca10040 samd: -564 -0.556% ADAFRUIT_ITSYBITSY_M4_EXPRESS Thanks go to @Jongy aka Yonatan Goldschmidt for the idea.
2020-01-13py/obj.h: Redefine qstr object encoding to add immediate obj encoding.Damien George
This commit adjusts the definition of qstr encoding in all object representations by taking a single bit from the qstr space and using it to distinguish between qstrs and a new kind of literal object: immediate objects. In other words, the qstr space is divided in two pieces, one half for qstrs and the other half for immediate objects. There is still enough room for qstr values (29 bits in representation A on a 32-bit architecture, and 19 bits in representation C) and the new immediate objects can be used for things like None, False and True.
2020-01-12py/nativeglue: Use mp_const_X instead of &mp_const_X_obj.Damien George
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.