aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-09-21stm32/usbdev: Simplify pointers to MSC state and block dev operations.Damien George
2017-09-21stm32/usbdev: Put all state for the USB device driver in a struct.Damien George
2017-09-21stm32/usbdev/core: Add state parameter to all callback functions.Damien George
2017-09-21stm32/usbdev: Simplify HID tx/rx buffer passing.Damien George
2017-09-21stm32/usbdev: Simplify CDC tx/rx buffer passing.Damien George
2017-09-21stm32/usbdev: Put all HID state in a struct.Damien George
2017-09-21stm32/usbdev: Put all CDC state in a struct.Damien George
2017-09-21py/vstr: Raise a RuntimeError if fixed vstr buffer overflows.Damien George
Current users of fixed vstr buffers (building file paths) assume that there is no overflow and do not check for overflow after building the vstr. This has the potential to lead to NULL pointer dereferences (when vstr_null_terminated_str returns NULL because it can't allocate RAM for the terminating byte) and stat'ing and loading invalid path names (due to the path being truncated). The safest and simplest thing to do in these cases is just raise an exception if a write goes beyond the end of a fixed vstr buffer, which is what this patch does. It also simplifies the vstr code.
2017-09-21py/stream: Remove unnecessary checks for NULL return from vstr_add_len.Damien George
The vstr argument to the calls to vstr_add_len are dynamically allocated (ie fixed_buf=false) and so vstr_add_len will never return NULL. So there's no need to check for it. Any out-of-memory errors are raised by the call to m_renew in vstr_ensure_extra.
2017-09-21py/objexcept: Prevent infinite recursion when allocating exceptions.Damien George
The aim of this patch is to rewrite the functions that create exception instances (mp_obj_exception_make_new and mp_obj_new_exception_msg_varg) so that they do not call any functions that may raise an exception. Otherwise it's possible to create infinite recursion with an exception being raised while trying to create an exception object. The two main things that are done to accomplish this are: 1. Change mp_obj_new_exception_msg_varg to just format the string, then call mp_obj_exception_make_new to actually create the exception object. 2. In mp_obj_exception_make_new and mp_obj_new_exception_msg_varg try to allocate all memory first using functions that don't raise exceptions If any of the memory allocations fail (return NULL) then degrade gracefully by trying other options for memory allocation, eg using the emergency exception buffer. 3. Use a custom printer backend to conservatively format strings: if it can't allocate memory then it just truncates the string. As part of this rewrite, raising an exception without a message, like KeyError(123), will now use the emergency buffer to store the arg and traceback data if there is no heap memory available. Memory use with this patch is unchanged. Code size is increased by: bare-arm: +136 minimal x86: +124 unix x64: +72 unix nanbox: +96 stm32: +88 esp8266: +92 cc3200: +80
2017-09-20stm32/usbdev: Change static function variable to non-static.Damien George
It's written straight away in the function on every call so it doesn't need to be static.
2017-09-20stm32/usbdev: Make the USBD callback struct const so it can go in ROM.Damien George
2017-09-19py/objstr: strip: Don't strip "\0" by default.Paul Sokolovsky
An issue was due to incorrectly taking size of default strip characters set.
2017-09-18py/mpconfig.h: Add note that using computed gotos in VM is not C99.Damien George
2017-09-18py/{objfloat,objcomplex}: Optimise MP_UNARY_OP_ABS by reusing variables.Damien George
2017-09-18py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS.Paul Sokolovsky
This allows user classes to implement __abs__ special method, and saves code size (104 bytes for x86_64), even though during refactor, an issue was fixed and few optimizations were made: * abs() of minimum (negative) small int value is calculated properly. * objint_longlong and objint_mpz avoid allocating new object is the argument is already non-negative.
2017-09-17docs/btree: Describe page caching policy of the underlying implementation.Paul Sokolovsky
2017-09-16tests/cpydiff: Add cases for locals() discrepancies.Paul Sokolovsky
MicroPython doesn't maintain local symbolic environment, so any feature depending on it won't work as expected.
2017-09-13py/emitbc: Remove stray semicolon in outer scope.Damien George
2017-09-13py/runtime.h: Change empty mp_warning macro so var-args are non empty.Damien George
Variable arguments in a macro should take at least 1 argument.
2017-09-13stm32/mpconfigport.h: Add configuration for max periphs on L4 series.Damien George
2017-09-13docs/library/framebuf.rst: Generalise constructor to all colour formats.Peter Hinch
2017-09-13stm32/timer: Make pyb.Timer() instances persistent.Damien George
Prior to this patch calling pyb.Timer(id) would always create a new timer instance, even if there was an existing one. This patch fixes this behaviour to match other peripherals, like UART, such that constructing a timer with just the id will retrieve any existing instances. The patch also refactors the way timers are validated on construction to simplify and reduce code size.
2017-09-12py/builtinhelp: Change signature of help text var from pointer to array.Damien George
As a pointer (const char *) it takes up an extra word of storage which is in RAM.
2017-09-12extmod/machine_pinbase: Put PinBase singleton in ROM.Damien George
This patch also removes the empty type "pinbase_type" (which crashes if accessed) and uses "machine_pinbase_type" instead as the type of the PinBase singleton.
2017-09-12py/nlrx86: Fix building for Android/x86.ASM
Tested using Clang on self-hosted Termux environment https://termux.com/.
2017-09-12stm32/make-stmconst.py: Make sure mpz const data lives in ROM.Damien George
2017-09-11README: Update "Dependencies" section.Paul Sokolovsky
Given that various ports now require submodules, rewrite the section to be more generic. Also, add git submodule update command to other sections for easy user start.
2017-09-10tests/run-tests: Fix copy-paste mistake in var name.Paul Sokolovsky
2017-09-10tests/run-tests: Skip class_inplace_op for minimal profile.Paul Sokolovsky
Don't assume that MICROPY_PY_ALL_SPECIAL_METHODS is defined, as required for inplace special methods. Fixes Zephyr tests.
2017-09-10zephyr/Makefile: Revamp "test" target after ports were moved to ports/.Paul Sokolovsky
2017-09-10tests/class_reverse_op: Test for reverse arith ops special methods.Paul Sokolovsky
This test should be run only if support for reverse ops is enabled, so the corresponding feature_check is added to run-tests.
2017-09-10py/runtime: Implement dispatch for "reverse op" special methods.Paul Sokolovsky
If, for class X, X.__add__(Y) doesn't exist (or returns NotImplemented), try Y.__radd__(X) instead. This patch could be simpler, but requires undoing operand swap and operation switch to get non-confusing error message in case __radd__ doesn't exist.
2017-09-10travis: Use --upgrade when pip is installing cpp-coveralls.Damien George
So that the latest urllib3 is retrieved, which has improved SSL security. This fixes the temporary path from f578947ae3fee5610c5bc1123baf878b92eaa248
2017-09-10esp8266: Set DEFPSIZE=1024, MINCACHE=3 for "btree" module.Paul Sokolovsky
Defaults of 4096 and 5 respectively are too high to esp8266, causing out of memory with a database beyond couple of pages.
2017-09-10berkeley-db-1.xx: Update, allow to override MINCACHE, DEFPSIZE.Paul Sokolovsky
2017-09-10esp8266/posix_helpers: Set ENOMEM on memory alloc failure.Paul Sokolovsky
POSIX requires malloc(), etc. to set ENOMEM on the failure, and e.g. BerkeleyDB relies on this: http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html This should fix confusing OSError exceptions with 0 error code when working with btree module.
2017-09-10esp8266: Rename axtls_helpers.c to posix_helpers.c.Paul Sokolovsky
As it's used by BerkeleyDB, etc.
2017-09-10stm32/boards: Add new board B_L475E_IOT01A based on STM32L475.Tobias Badertscher
2017-09-10py/builtinhelp: Simplify code slightly by extracting object type.Damien George
Reduces code size by about 10 bytes.
2017-09-09docs/reference/isr_rules.rst Add tutorial on use of micropython.schedule().Peter Hinch
2017-09-08stm32/modnwwiznet5k: Release the GIL on blocking network operations.Damien George
connect, send, recv, sendto and recvfrom now release the GIL. accept already releases the GIL because it calls mp_hal_delay_ms() within its busy-wait loop.
2017-09-08tests/run-bench-tests: Update locations of executables, now in ports/.Damien George
2017-09-08stm32/i2c: When scanning for I2C devices only do 1 probe per address.Damien George
Previous to this patch the i2c.scan() method would do up to 100 probes per I2C address, to detect the devices on the bus. This repeated probing was a relic from when the code was copied from the accelerometer initialisation, which requires to do repeated probes while waiting for the accelerometer chip to turn on. But I2C devices shouldn't need more than 1 probe to detect their presence, and the generic software I2C implementation uses 1 probe successfully. So this patch changes the implementation to use 1 probe per address, which significantly speeds up the scan operation.
2017-09-08py/runtime0.h: Put inplace arith ops in front of normal operations.Paul Sokolovsky
This is to allow to place reverse ops immediately after normal ops, so they can be tested as one range (which is optimization for reverse ops introduction in the next patch).
2017-09-07py/runtime0.h: Regroup operations a bit.Paul Sokolovsky
Originally, there were grouped in blocks of 5, to make it easier e.g. to assess and numeric code of each. But now it makes more sense to group it by semantics/properties, and then split in chunks still, which usually leads to chunks of ~6 ops.
2017-09-07py/objtype: Make sure mp_binary_op_method_name has full size again.Paul Sokolovsky
After recent refactorings to mp_binary_op_t, and make it future refactoring proof for now, at the cost of extra element in the array.
2017-09-07py/runtime0.h: Move MP_BINARY_OP_DIVMOD to the end of mp_binary_op_t.Paul Sokolovsky
It starts a dichotomy of mp_binary_op_t values which can't appear in the bytecode. Another reason to move it is to VALUES of OP_* and OP_INPLACE_* nicely adjacent. This also will be needed for OP_REVERSE_*, to be soon introduced.
2017-09-07py/runtime0.h: Move relational ops to the beginning of mp_binary_op_t.Paul Sokolovsky
This is to allow to encode arithmetic operations more efficiently, in preparation to introduction of __rOP__ method support.
2017-09-07py/objlist: Properly implement comparison with incompatible types.Paul Sokolovsky
Should raise TypeError, unless it's (in)equality comparison.