Damien George
57226a2b7f
stmhal: Implement machine.soft_reset().
8 years ago
Damien George
ad3724e0bc
lib/utils/pyexec: Allow behaviour of SystemExit to be configurable.
Setting the pyexec_system_exit variable to PYEXEC_FORCED_EXT allows
SystemExit exceptions to terminate the pyexec functions.
8 years ago
Damien George
7d0d7215d2
py: Use mp_raise_msg helper function where appropriate.
Saves the following number of bytes of code space: 176 for bare-arm, 352
for minimal, 272 for unix x86-64, 140 for stmhal, 120 for esp8266.
8 years ago
Damien George
6caca3259f
tests: Add test to print full KeyError exc from failed dict lookup.
8 years ago
Damien George
2750a7b38e
py/objdict: Actually provide the key that failed in KeyError exception.
The failed key is available as exc.args[0], as per CPython.
8 years ago
Damien George
a3edeb9ea5
py/objdict: Fix optimisation for allocating result in fromkeys.
Iterables don't respond to __len__, so call __len__ on the original
argument.
8 years ago
Damien George
e9404e5f5f
tests: Improve coverage of array, range, dict, slice, exc, unicode.
8 years ago
Damien George
453c2e8f55
tests/cmdline: Improve coverage test for printing bytecode.
8 years ago
Paul Sokolovsky
799ccdc789
esp8266, stmhal, unix: MAKE_FROZEN is consistently defined in mkenv.mk.
8 years ago
Paul Sokolovsky
06234a6115
extmod/modussl_mbedtls: Add dummy setblocking() method.
Accepts only value of True.
8 years ago
Paul Sokolovsky
36f97f19b4
extmod/utime_mphal: sleep_us/ms(): Don't wait on negative argument.
8 years ago
Paul Sokolovsky
f059563507
stmhal/modutime: Refactor to use extmod/utime_mphal.c.
This includes making sure that utime_mphal's sleep_ms() and sleep_us()
don't sleep on negative arguments.
8 years ago
Paul Sokolovsky
a97284423e
extmod/utime_mphal: Factor out implementations in terms of mp_hal_* for reuse.
As long as a port implement mp_hal_sleep_ms(), mp_hal_ticks_ms(), etc.
functions, it can just use standard implementations of utime.sleel_ms(),
utime.ticks_ms(), etc. Python-level functions.
8 years ago
Damien George
824f5c5a32
py/vstr: Combine vstr_new_size with vstr_new since they are rarely used.
Now there is just one function to allocate a new vstr, namely vstr_new
(in addition to vstr_init etc). The caller of this function should know
what initial size to allocate for the buffer, or at least have some policy
or config option, instead of leaving it to a default (as it was before).
8 years ago
Damien George
ed878275b0
esp8266: Enable micropython.alloc_emergency_exception_buf().
8 years ago
Damien George
34d0b3f85c
tests/micropython: Add tests for heap_lock, and emergency exceptions.
8 years ago
Damien George
6a4c6fc023
qemu-arm: Remove SRC_TEST_C from SRC_QSTR list, it's not needed.
And it gives problems with header dependencies for auto-qstr generation.
8 years ago
Damien George
b0a15aa735
qemu-arm: Enable lots of extmods and enable tests for them.
The qemu-arm port is used for testing of ARM Thumb architecture on a
desktop so should have many features enabled.
8 years ago
Damien George
8298251215
stmhal/pybstdio: Use size_t instead of mp_uint_t.
8 years ago
Alex March
e42186d356
tests/extmod/vfs_fat: Replace asserts with prints and expected outputs.
8 years ago
Damien George
f2f8ae110b
extmod/modujson: Fix nanbox build.
8 years ago
Damien George
11ab807d76
tests/extmod: Add test for ujson.load().
8 years ago
Damien George
e93c1ca5da
extmod/modujson: Implement ujson.load() to load JSON from a stream.
This refactors ujson.loads(s) to behave as ujson.load(StringIO(s)).
Increase in code size is: 366 bytes for unix x86-64, 180 bytes for
stmhal, 84 bytes for esp8266.
8 years ago
Paul Sokolovsky
f17f3314d0
zephyr: Add copyright blurbs.
8 years ago
Paul Sokolovsky
1a01ed0d2a
zephyr/mpconfigport.h: Fix rebasing artifacts.
8 years ago
Daniel Thompson
b6a544b917
zephyr: Implement the help() function.
The boot issue text mentions a help() function and encourages
the user to run it. It is very disconcerting to find that the
function does not exist...
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
8 years ago
Paul Sokolovsky
06ee5e947f
zephyr/Makefile: Be sure to extra qstr's from port sources.
8 years ago
Paul Sokolovsky
998578a2b8
README: Mention _thread module availability in select ports.
8 years ago
Paul Sokolovsky
cdbeee0c50
tools: Upgrade upip to 1.1.3.
Initial support for running on a baremetal, low-heap systems (like esp8266),
using Python module interface.
8 years ago
Paul Sokolovsky
4021b1e1b8
lib/utils/pyexec: Don't treat SystemExit as "forced exit".
"Forced exit" is treated as soft-reboot (Ctrl+D). But expected effect of
calling sys.exit() is termination of the current script, not any further
and more serious actions like mentioned soft reboot.
8 years ago
Damien George
af8d791bd0
esp8266: Enable importing of precompiled .mpy files.
8 years ago
Damien George
11fc6553e8
esp8266: Enable sys.{stdin,stdout,stderr}.buffer for raw serial access.
8 years ago
Damien George
31101d91ce
py/lexer: Remove unnecessary code, and unreachable code.
Setting emit_dent=0 is unnecessary because arriving in that part of the
if-logic will guarantee that emit_dent is already zero.
The block to check indent_top(lex)>0 is unreachable because a newline is
always inserted an the end of the input stream, and hence dedents are
always processed before EOF.
8 years ago
Damien George
deaa57acf3
py/compile: Remove debugging code for compiler dispatch.
It was a relic from the days of developing the compiler and is no longer
needed, and it's impossible to trigger via a test.
8 years ago
Radomir Dopieralski
db4e009217
esp8266/mpconfigport: Enable MICROPY_PY_BUILTINS_SLICE_ATTRS
8 years ago
Alex March
f274561e16
tests/extmod/vfs_fat: Test coverage for remove() and rmdir().
8 years ago
Alex March
d02f3a57f4
extmod/vfs_fat: Add file and directory checks for remove and rmdir.
8 years ago
Radomir Dopieralski
eaef6b5324
extmod/machine_i2c: Use writes not reads in i2c.scan().
As per discussion in #2449 , using write requests instead of read requests
for I2C.scan() seems to support a larger number of devices, especially
ones that are write-only. Even a read-only I2C device has to implement
writes in order to be able to receive the address of the register to read.
8 years ago
Peter Hinch
9e1dec1818
docs/reference: Add constrained.rst doc.
It contains detailed information about writing scripts to run efficiently
on microcontrollers (and other constrained systems).
8 years ago
Paul Sokolovsky
39968aaaff
extmod/uzlib: Update to upstream v2.1.
Adds check that LZ offsets fall into the sliding dictionary used. This
catches a case when uzlib.DecompIO with a smaller dictionary is used
to decompress data which was compressed with a larger dictionary.
Previously, this would lead to producing invalid data or crash, now
an exception will be thrown.
8 years ago
Damien George
6dff3df501
py/objint: Use size_t for arguments that measure bytes/sizes.
8 years ago
Damien George
8bb7d958f1
py: Factor duplicated function to calculate size of formatted int.
8 years ago
Damien George
df3e5d2b2f
py/mpz: Use assert to verify mpz does not have a fixed digit buffer.
8 years ago
Damien George
48874942f0
py/mpz: In divmod, replace check for rhs!=0 with assert.
The check for division by zero is made by the caller of this function.
8 years ago
Damien George
5e22afce41
tests: Improve test coverage of py/compile.c.
8 years ago
Damien George
e49153fb98
py/compile: Remove unreachable code.
8 years ago
Damien George
7f0e563de3
tests/micropython: Add test for micropython.opt_level() function.
8 years ago
Damien George
7dc2345715
py/modmicropython: Add micropython.opt_level([value]) function.
This allows to get/set at runtime the optimisation level of the compiler.
8 years ago
Paul Sokolovsky
93c76d2b06
zephyr: Add Ctrl+C handling.
8 years ago
Paul Sokolovsky
1b76f88e7a
zephyr/zephyr_getchar: Add support for Ctrl+C handling.
Patch on top of upstream Zephyr console helpers.
8 years ago