Damien George
71fec076dc
py/vm: Use MP_OBJ_FROM_PTR to cast a type to an object.
2016-09-27 13:21:23 +10:00
Damien George
38b54b65d4
tests/micropython: Add tests for const names being replaced in parser.
2016-09-27 13:03:53 +10:00
Damien George
3f0c1c2452
tests/basics: Add test case for overflowing Py stack in try-finally.
2016-09-27 12:46:50 +10:00
Damien George
f040685b0c
py: Only store the exception instance on Py stack in bytecode try block.
...
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-27 12:37:21 +10:00
Scott Shawcroft
ed34c35509
atmel-samd21: Support loading mpy files.
2016-09-26 15:43:52 -07:00
Scott Shawcroft
b1be9f50ab
atmel-samd: Remove module name from struct.
2016-09-26 15:02:16 -07:00
Scott Shawcroft
12b6b786fd
Merge remote-tracking branch 'micropython/master'
2016-09-26 14:34:26 -07:00
Paul Sokolovsky
67d52d8cb9
extmod/uzlib/: Update uzlib to v2.0.3.
...
Fixes for more pedantic warnings.
2016-09-24 16:07:18 +03:00
Paul Sokolovsky
d46de80162
tests/uzlib_decompio_gz: Test for DecompIO with gzip bitstream.
2016-09-24 15:43:23 +03:00
Paul Sokolovsky
7b901d6fb7
extmod/moduzlib: DecompIO: Add support for gzip-formatted streams.
...
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-24 15:30:11 +03:00
Paul Sokolovsky
d8a4d9d67c
extmod/uzlib: Add tinfgzip.c (gzip header parsing) from upstream.
2016-09-24 15:28:51 +03:00
Paul Sokolovsky
4c63986101
tools: Update upip to 0.8. Fixes IPv6 support.
2016-09-23 15:35:06 +03:00
Paul Sokolovsky
9cc8ec843e
py/py.mk: Add support for building modussl_mbedtls.
2016-09-23 14:30:46 +03:00
Damien George
6d310a5552
py/parse: Only replace constants that are standalone identifiers.
...
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-23 17:23:16 +10:00
Damien George
eeb9d99333
docs/library/machine: Update description of disable/enable IRQ funcs.
2016-09-23 13:15:58 +10:00
Damien George
7df9291b6c
py: Update opcode format table because 3 opcodes were removed, 1 added.
...
LIST_APPEND, MAP_ADD and SET_ADD have been removed, and STORE_COMP has
been added in adaf0d865c
.
2016-09-23 12:48:57 +10:00
Damien George
e97df97600
py: Shrink mp_arg_t struct by using reduced-size integer members.
...
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-23 12:13:51 +10:00
Scott Shawcroft
eda33385e6
atmel-samd: Correct the stack_top pointer used in garbage collection.
...
Without this fix the gc will consider a large, random section of memory
and it may never finish.
2016-09-22 18:24:06 -07:00
Scott Shawcroft
ffdc3f81df
atmel-samd: Note a potential REPL ram savings.
2016-09-22 18:23:27 -07:00
Paul Sokolovsky
46ab042230
extmod/modussl_mbedtls: Add server_hostname param for wrap_socket().
...
In CPython, module-level .wrap_socket() function actually doesn't accept
(or document) this param, only SSLContext.wrap_socket() has.
2016-09-23 01:44:23 +03:00
Scott Shawcroft
bbeed82378
atmel-samd: Run boot.py and main.py at startup and soft reboot.
2016-09-22 13:56:26 -07:00
Scott Shawcroft
e56948650f
atmel-samd: Enable mem_info display.
2016-09-22 13:16:13 -07:00
Radomir Dopieralski
ec078af985
extmod/machine_i2c: Add clock stretching support.
...
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-22 14:10:02 +10:00
Krzysztof Blazewicz
1f69b16d3f
stmhal: Remove STM32CubeF2 HAL files, they are unused/unsupported.
2016-09-22 12:11:01 +10:00
Krzysztof Blazewicz
9310dad15d
stmhal: Put common definitions from linker files to common.ld.
2016-09-22 12:03:12 +10:00
Damien George
c4a69c75a5
unix: Enable btree module for coverage build.
2016-09-22 11:10:11 +10:00
Damien George
6c79980b0e
py/py.mk: Suppress some compiler warnings when building berkeley-db.
2016-09-22 11:09:21 +10:00
Damien George
79ec869f95
py/stream: Remove unnecessary check for NULL return from vstr_extend.
...
vstr_extend will now only return NULL if the vstr is a fixed buffer, which
in this case it is not.
2016-09-22 10:50:47 +10:00
Damien George
c528489eee
README: Remove issue-stats badges, the service is no longer available.
...
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-22 10:38:49 +10:00
Paul Sokolovsky
080e4d44f3
extmod/modussl_mbedtls: Use 2-component include paths.
...
This is required to use mbedTLS versions from various sources, e.g.
mainline vs embedded into Zephyr RTOS.
2016-09-22 01:30:48 +03:00
Scott Shawcroft
0e1fd9a12c
atmel-samd: Support ampy get and fix USB dropping characters.
...
Fixes #2 .
2016-09-21 15:13:37 -07:00
Paul Sokolovsky
5f0ecb72c2
extmod/modussl_mbedtls: Implement key= and cert= args to wrap_socket().
...
Unlike standard keyfile= and certfile=, these accept byte buffer objects
(to not depend on FS implementation).
2016-09-22 00:17:44 +03:00
Pavol Rusnak
7f5a541b84
extmod/modubinascii: Fix crc32() function on 32-bit platforms.
2016-09-21 21:40:18 +03:00
Stefan Agner
b84e1231c9
extmod/uctypes: Allow full 32-bit address range.
...
Use mp_obj_int_get_truncated to allow the full 32-bit address range
as first parameter.
2016-09-21 21:37:08 +03:00
Paul Sokolovsky
9ea2882317
extmod/modussl_mbedtls: Initial implementation of mbedTLS ussl module.
2016-09-21 21:25:33 +03:00
Damien George
93c4a6a3f7
all: Remove 'name' member from mp_obj_module_t struct.
...
One can instead lookup __name__ in the modules dict to get the value.
2016-09-22 00:23:16 +10:00
Stefan Agner
b0a46900de
stmhal: Use attribute to avoid inlining.
...
Use MP_NOINLINE macro to avoid inlining of init_flash_fs. This helps
to keep stack usage of main() low.
2016-09-20 20:41:11 -07:00
Scott Shawcroft
33b796ed3a
extmod: Fix typo.
2016-09-20 15:17:31 -07:00
Scott Shawcroft
dbbb2a5ca4
atmel-samd: Turn off normal errors but turn on source code line reporting.
2016-09-20 15:16:52 -07:00
Scott Shawcroft
005122e581
atmel-samd: Remove path specific to me.
2016-09-20 15:16:12 -07:00
Paul Sokolovsky
7ea3fa2641
py/builtinimport: Fix nanbox build after change to better handle -m modules.
2016-09-20 17:55:42 +03:00
Delio Brignoli
21c719bd0a
builtinimport: add the module specified by -m to sys.modules as '__main__'
2016-09-20 14:01:31 +03:00
Damien George
34e0198436
esp8266: Extend system microsecond counter to 64-bits; use in ticks_ms.
...
So now ticks_ms can count up to the full 30 bits. Fixes issue #2412 .
2016-09-20 14:28:17 +10:00
Damien George
cc7c311b5e
travis: Run feature and coverage test for precompiled mpy files.
2016-09-20 12:21:53 +10:00
Damien George
3f5fe6269e
tests/run-tests: Add --via-mpy option to run test from precompiled code.
...
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-20 12:19:35 +10:00
Damien George
bb954d80a4
tests: Get cmdline verbose tests running again.
...
The showbc function now no longer uses the system printf so works
correctly.
2016-09-20 11:33:19 +10:00
Damien George
fbddea929d
py/showbc: Make printf's go to the platform print stream.
...
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-20 11:30:54 +10:00
Scott Shawcroft
0cae6b8e68
atmel-samd: Support const().
2016-09-19 17:30:28 -07:00
Scott Shawcroft
0f4f4c7544
atmel-samd: Add sys, fix import and increase the size of the heap.
2016-09-19 16:56:42 -07:00
Scott Shawcroft
bb03afdb77
Merge remote-tracking branch 'micropython/master'
2016-09-19 13:32:29 -07:00