aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-09-27extmod/vfs_fat: Add fat_vfs_statvfs(), reused from stmhal.Alex March
2016-09-27py/modmicropython: Add micropython.const, alias for identity function.Damien George
Having a micropython.const identity function, and writing "from micropython import const" at the start of scripts that use the const feature, allows to write scripts which are compatible with CPython, and with uPy builds that don't include const optimisation. This patch adds such a function and updates the tests to do the import.
2016-09-27tests/cmdline/cmd_showbc: Fix test now that 1 value is stored on stack.Damien George
This corresponds to the change in the way exception values are stored on the Python value stack.
2016-09-27py/vm: Use MP_OBJ_FROM_PTR to cast a type to an object.Damien George
2016-09-27tests/micropython: Add tests for const names being replaced in parser.Damien George
2016-09-27tests/basics: Add test case for overflowing Py stack in try-finally.Damien George
2016-09-27py: Only store the exception instance on Py stack in bytecode try block.Damien George
When an exception is raised and is to be handled by the VM, it is stored on the Python value stack so the bytecode can access it. CPython stores 3 objects on the stack for each exception: exc type, exc instance and traceback. uPy followed this approach, but it turns out not to be necessary. Instead, it is enough to store just the exception instance on the Python value stack. The only place where the 3 values are needed explicitly is for the __exit__ handler of a with-statement context, but for these cases the 3 values can be extracted from the single exception instance. This patch removes the need to store 3 values on the stack, and instead just stores the exception instance. Code size is reduced by about 50-100 bytes, the compiler and VM are slightly simpler, generate bytecode is smaller (by 2 bytes for each try block), and the Python value stack is reduced in size for functions that handle exceptions.
2016-09-24extmod/uzlib/: Update uzlib to v2.0.3.Paul Sokolovsky
Fixes for more pedantic warnings.
2016-09-24tests/uzlib_decompio_gz: Test for DecompIO with gzip bitstream.Paul Sokolovsky
2016-09-24extmod/moduzlib: DecompIO: Add support for gzip-formatted streams.Paul Sokolovsky
This uses extension introduced in CPython 3.5: if wbits (dictionary size code) has value 16 + 8..15, it means that gzip-formatted stream expected.
2016-09-24extmod/uzlib: Add tinfgzip.c (gzip header parsing) from upstream.Paul Sokolovsky
2016-09-23tools: Update upip to 0.8. Fixes IPv6 support.Paul Sokolovsky
2016-09-23py/py.mk: Add support for building modussl_mbedtls.Paul Sokolovsky
2016-09-23py/parse: Only replace constants that are standalone identifiers.Damien George
This fixes constant substitution so that only standalone identifiers are replaced with their constant value (if they have one). I.e. don't replace NAME in expressions like obj.NAME or NAME = expr.
2016-09-23docs/library/machine: Update description of disable/enable IRQ funcs.Damien George
2016-09-23py: Update opcode format table because 3 opcodes were removed, 1 added.Damien George
LIST_APPEND, MAP_ADD and SET_ADD have been removed, and STORE_COMP has been added in adaf0d865cd6c81fb352751566460506392ed55f.
2016-09-23py: Shrink mp_arg_t struct by using reduced-size integer members.Damien George
qstrs ids are restricted to fit within 2 bytes already (eg in persistent bytecode) so it's safe to use a uint16_t to store them in mp_arg_t. And the flags member only needs a maximum of 2 bytes so can also use uint16_t. Savings in code size can be significant when many mp_arg_t structs are used for argument parsing. Eg, this patch reduces stmhal by 480 bytes.
2016-09-23extmod/modussl_mbedtls: Add server_hostname param for wrap_socket().Paul Sokolovsky
In CPython, module-level .wrap_socket() function actually doesn't accept (or document) this param, only SSLContext.wrap_socket() has.
2016-09-22extmod/machine_i2c: Add clock stretching support.Radomir Dopieralski
When the clock is too fast for the i2c slave, it can temporarily hold down the scl line to signal to the master that it needs to wait. The master should check the scl line when it is releasing it after transmitting data, and wait for it to be released. This change has been tested with a logic analyzer and an i2c slace implemented on an atmega328p using its twi peripheral, clocked at 8Mhz. Without the change, the i2c communication works up to aboy 150kHz frequency, and above that results in the slave stuck in an unresponsive state. With this change, communication has been tested to work up to 400kHz.
2016-09-22stmhal: Remove STM32CubeF2 HAL files, they are unused/unsupported.Krzysztof Blazewicz
2016-09-22stmhal: Put common definitions from linker files to common.ld.Krzysztof Blazewicz
2016-09-22unix: Enable btree module for coverage build.Damien George
2016-09-22py/py.mk: Suppress some compiler warnings when building berkeley-db.Damien George
2016-09-22py/stream: Remove unnecessary check for NULL return from vstr_extend.Damien George
vstr_extend will now only return NULL if the vstr is a fixed buffer, which in this case it is not.
2016-09-22README: Remove issue-stats badges, the service is no longer available.Damien George
The issue-stats service is not well maintained and likely the situation won't improve in the future. See: https://github.com/hstove/issue_stats/issues/41 https://github.com/hstove/issue_stats/issues/46
2016-09-22extmod/modussl_mbedtls: Use 2-component include paths.Paul Sokolovsky
This is required to use mbedTLS versions from various sources, e.g. mainline vs embedded into Zephyr RTOS.
2016-09-22extmod/modussl_mbedtls: Implement key= and cert= args to wrap_socket().Paul Sokolovsky
Unlike standard keyfile= and certfile=, these accept byte buffer objects (to not depend on FS implementation).
2016-09-21extmod/modubinascii: Fix crc32() function on 32-bit platforms.Pavol Rusnak
2016-09-21extmod/uctypes: Allow full 32-bit address range.Stefan Agner
Use mp_obj_int_get_truncated to allow the full 32-bit address range as first parameter.
2016-09-21extmod/modussl_mbedtls: Initial implementation of mbedTLS ussl module.Paul Sokolovsky
2016-09-22all: Remove 'name' member from mp_obj_module_t struct.Damien George
One can instead lookup __name__ in the modules dict to get the value.
2016-09-20stmhal: Use attribute to avoid inlining.Stefan Agner
Use MP_NOINLINE macro to avoid inlining of init_flash_fs. This helps to keep stack usage of main() low.
2016-09-20py/builtinimport: Fix nanbox build after change to better handle -m modules.Paul Sokolovsky
2016-09-20builtinimport: add the module specified by -m to sys.modules as '__main__'Delio Brignoli
2016-09-20esp8266: Extend system microsecond counter to 64-bits; use in ticks_ms.Damien George
So now ticks_ms can count up to the full 30 bits. Fixes issue #2412.
2016-09-20travis: Run feature and coverage test for precompiled mpy files.Damien George
2016-09-20tests/run-tests: Add --via-mpy option to run test from precompiled code.Damien George
With mpy-cross built, tests can now be run by first compiling them to .mpy files, and then executing the .mpy file. Usage: ./run-tests --via-mpy
2016-09-20tests: Get cmdline verbose tests running again.Damien George
The showbc function now no longer uses the system printf so works correctly.
2016-09-20py/showbc: Make printf's go to the platform print stream.Damien George
The system printf is no longer used by the core uPy code. Instead, the platform print stream or DEBUG_printf is used. Using DEBUG_printf in the showbc functions would mean that the code can't be tested by the test suite, so use the normal output instead. This patch also fixes parsing of bytecode-line-number mappings.
2016-09-19tests/array1: Add tests for "l", "L" array types to improve coverage.Paul Sokolovsky
2016-09-19tests/struct1: Test "l" specifier to improve coverage.Paul Sokolovsky
2016-09-19py/qstr: Remove a comment.Damien George
qstrs are always null terminated so qstr_str will stay as part of the API.
2016-09-19stmhal/boards: For OLIMEX_E407, enable UART1 and fix I2C1 mapping.Damien George
UART1 can be used even if the switch is enabled. The schematics for this board make I2C1 available on PB8/PB9, even though it can also be mapped to PB6/PB7. See #2396 and #2427.
2016-09-19py/objnone: Use mp_generic_unary_op instead of custom one.Damien George
2016-09-19py/vstr: Remove vstr.had_error flag and inline basic vstr functions.Damien George
The vstr.had_error flag was a relic from the very early days which assumed that the malloc functions (eg m_new, m_renew) returned NULL if they failed to allocate. But that's no longer the case: these functions will raise an exception if they fail. Since it was impossible for had_error to be set, this patch introduces no change in behaviour. An alternative option would be to change the malloc calls to the _maybe variants, which return NULL instead of raising, but then a lot of code will need to explicitly check if the vstr had an error and raise if it did. The code-size savings for this patch are, in bytes: bare-arm:188, minimal:456, unix(NDEBUG,x86-64):368, stmhal:228, esp8266:360.
2016-09-19py: Combine 3 comprehension opcodes (list/dict/set) into 1.Damien George
With the previous patch combining 3 emit functions into 1, it now makes sense to also combine the corresponding VM opcodes, which is what this patch does. This eliminates 2 opcodes which simplifies the VM and reduces code size, in bytes: bare-arm:44, minimal:64, unix(NDEBUG,x86-64):272, stmhal:92, esp8266:200. Profiling (with a simple script that creates many list/dict/set comprehensions) shows no measurable change in performance.
2016-09-19py: Combine 3 comprehension emit functions (list/dict/set) into 1.Damien George
The 3 kinds of comprehensions are similar enough that merging their emit functions reduces code size. Decreases in code size in bytes are: bare-arm:24, minimal:96, unix(NDEBUG,x86-64):328, stmhal:80, esp8266:76.
2016-09-19esp8266/esp_mphal: Add tentative change to mp_hal_stdin_rx_chr() to wait IRQ.Paul Sokolovsky
Instead of busy-looping waiting for UART input. Not enabled by default, needs more testing.
2016-09-18esp8266/ets_alt_task: ets_post: Should return 0 on success, !0 - failure.Paul Sokolovsky
2016-09-18docs/library/pyb.SPI: init(): Describe "bits" argument.Paul Sokolovsky
Based on https://github.com/micropython/micropython/pull/2210 .