Commit Graph

8094 Commits

Author SHA1 Message Date
Paul Sokolovsky
9db1c50f18 qemu-arm: Enable micropython.mem_*() functions to allow more tests. 2017-06-06 00:23:48 +03:00
Paul Sokolovsky
cd64b3082e docs/network: First step to describe standard network class interface.
This adds description of implied AbstractNIC base class, which should be
"subclasses" and implemented by a particular network device class.

This is just an initial step in that direction, the API and description
will be elabotated further.
2017-06-04 21:25:23 +03:00
Paul Sokolovsky
50de6d2fab extmod/modlwip: accept: Fix error code for non-blocking mode.
In non-blocking mode, if no pending connection available, should return
EAGAIN, not ETIMEDOUT.
2017-06-04 13:45:37 +03:00
Paul Sokolovsky
5da8de2b66 extmod/modlwip: Fix error codes for duplicate calls to connect().
If socket is already connected, POSIX requires returning EISCONN. If
connection was requested, but not yet complete (for non-blocking
socket), error code is EALREADY.

http://pubs.opengroup.org/onlinepubs/7908799/xns/connect.html
2017-06-04 12:30:41 +03:00
Paul Sokolovsky
a0dbbbebb8 extmod/modlwip: connect: For non-blocking mode, return EINPROGRESS.
Instead of ETIMEDOUT. This is consistent with POSIX:
http://pubs.opengroup.org/onlinepubs/7908799/xns/connect.html
2017-06-03 22:48:31 +03:00
Paul Sokolovsky
43f58386e0 zephyr/modusocket: getaddrinfo: Fix mp_obj_len() usage.
Return value is mp_obj_t, so needs to be accessed using
MP_OBJ_SMALL_INT_VALUE().
2017-06-03 16:11:53 +03:00
Paul Sokolovsky
f245f5d7cc docs/machine: Sort machine classes in logical order, not alphabetically.
The list starts with the simplest functionality - GPIO, proceeds to
communication interfaces (UART, SPI, I2C), the to time(r) related
things, then everything else.
2017-06-03 14:50:54 +03:00
Paul Sokolovsky
e91b1cdae3 docs/uos: Move cc3200 port legacy VFS mounting functions to its ref doc.
This patch also unconditionalizes uos.dupterm(), though exact interface
and semantics is yet to be defined.
2017-06-03 14:19:53 +03:00
Paul Sokolovsky
1ce44f3046 docs/uos: Deconditionalize, remove minor port-specific details.
For a couple of ports, there was information which directory is set
as current after boot. This information doesn't belong to "uos" module,
and is moved to boards' references (which actually already contained
information on which directory is chosen for boot, even if without
explicit mentioning that it becomes current directory, which is now
done).
2017-06-03 13:51:13 +03:00
Paul Sokolovsky
92206a78ae docs/network: Move confusingly-named cc3200 Server class to its reference.
cc3200 port has network.Server class to control behavior of builtin
Telnet/FTP server of that port.
2017-06-03 13:34:28 +03:00
Paul Sokolovsky
22ca5390f7 docs/esp8266/quickref: Polish Pin.on()/off() examples. 2017-06-02 21:08:23 +03:00
Damien George
7400d88762 tests/basics/string_rsplit: Add tests for negative "maxsplit" argument. 2017-06-02 13:08:18 +10:00
Damien George
9f85c4fe48 py/objstr: Catch case of negative "maxsplit" arg to str.rsplit().
Negative values mean no limit on the number of splits so should delegate to
the .split() method.
2017-06-02 13:07:22 +10:00
Damien George
ab954ed513 lib/utils/interrupt_char: Remove support for KBD_EXCEPTION disabled.
If a port is using interrupt_char.c then it must enable
MICROPY_KBD_EXCEPTION.  This is the case for all official ports.
2017-06-02 12:03:57 +10:00
Damien George
00e4f05907 windows: Convert to use core-provided version of built-in import(). 2017-06-01 16:29:02 +10:00
Damien George
d92898a35a unix: Convert to use core-provided version of built-in import(). 2017-06-01 16:02:49 +10:00
Damien George
6ff0ecfffc ports: Convert from using stmhal's input() to core provided version. 2017-06-01 16:02:49 +10:00
Damien George
bc76302eab py/modbuiltins: Add core-provided version of input() function.
The implementation is taken from stmhal/input.c, with code added to handle
ctrl-C.  This built-in is controlled by MICROPY_PY_BUILTINS_INPUT and is
disabled by default.  It uses readline() to capture input but this can be
overridden by defining the mp_hal_readline macro.
2017-06-01 16:02:49 +10:00
Damien George
b53a63517a lib/libm: Use isfinite instead of finitef, for C99 compatibility. 2017-05-31 11:34:29 +10:00
Damien George
821dc27eec stmhal/boards: Enable DAC for NUCLEO_F767ZI board. 2017-05-30 18:31:55 +10:00
Paul Sokolovsky
272a5d95e0 docs/esp8266: Consistently replace Pin.high/low methods with .on/off. 2017-05-30 07:36:25 +03:00
Paul Sokolovsky
d5b8825d5f docs/machine.Pin: Add on() and off() methods. 2017-05-29 20:56:13 +03:00
Paul Sokolovsky
3496d9e4bd docs/machine.Pin: Remove out_value() method.
This method isn't implemented in any port. It seemed to have originated
in cc3200 port, but actually never was implemented there either. In
general case, it's impossible to implement this method (for example, for
a perfect GPO, which has only output latch without any feedback look
into a CPU).
2017-05-29 20:51:30 +03:00
Ville Skyttä
ca16c38210 various: Spelling fixes 2017-05-29 11:36:05 +03:00
Damien George
e5e49bedcb qemu-arm/Makefile: Adjust object-file lists to get correct dependencies.
With this change both the "run" and "test" targets can be built with -j
passed to make.
2017-05-26 22:51:14 +10:00
Damien George
825460a093 docs: Bump version to 1.9. 2017-05-26 19:07:37 +10:00
Damien George
d77862279e unix/Makefile: Don't add frozen bytecode to minimal build. 2017-05-26 18:12:30 +10:00
Paul Sokolovsky
011684bd4f zephyr/modusocket: Use DEBUG_PRINT macro name as other modules do.
Indeed, just "DEBUG" is too generic.
2017-05-26 10:20:25 +03:00
Damien George
22fdb91571 esp8266/mpconfigport.h: Remove duplicate link to lwip module.
It's already included in the core when MICROPY_PY_LWIP is defined.
2017-05-26 17:06:31 +10:00
Damien George
eea584860d esp8266/modules: Mount filesystem at root when creating for first time. 2017-05-26 17:05:58 +10:00
Tom Collins
e26fb3ad73 py/objstringio: Catch mp_uint_t overflow of stream position in write(). 2017-05-26 13:40:08 +10:00
Damien George
ed6d2547df mpy-cross/Makefile: Guard "override undefine" by test for make feature.
make v3.81 doesn't have "undefine" so we can't use it with that version.
2017-05-26 13:16:55 +10:00
Damien George
85f7b0b468 py/mkrules.mk: Fix auto-qstr generation when "make -B" is used.
For make v3.81, using "make -B" can set $? to empty and in this case the
auto-qstr generation needs to pass all args (ie $^) to cpp.  The previous
fix for this (which was removed in 23a693ec2d)
used if statements in the shell command, which gave very long lines that
didn't work on certain systems (eg cygwin).

The fix in this patch is to use an $if(...) expression, which will evaluate
to $? (only newer prerequisites) if it's non empty, otherwise it will use
$^ (all prerequisites).
2017-05-26 13:12:42 +10:00
Damien George
8b13cd7e19 tests/basics: Add more tests for unwind jumps from within a try-finally.
These tests excercise cases that are fixed by the previous two commits.
2017-05-25 20:48:16 +10:00
Damien George
8f064e469d py/emitbc: Fix bug with BC emitter computing Python stack size.
Previous to this patch the mp_emit_bc_adjust_stack_size function would
adjust the current stack size but would not increase the maximum stack size
if the current size went above it.  This meant that certain Python code
(eg a try-finally block with no statements inside it) would not have enough
Python stack allocated to it.

This patch fixes the problem by always checking if the current stack size
goes above the maximum, and adjusting the latter if it does.
2017-05-25 20:42:30 +10:00
Damien George
04d05db27e py/vm: Fix bug with unwind jump popping the iterator from a for loop.
This patch fixes a regression introduced by
088740ecc4
2017-05-25 20:39:08 +10:00
Damien George
68e71eacb8 py/vm: Fix bug with stackless mode and unwinding of exceptions.
This patch fixes a regression introduced by
71a3d6ec3b

Previous to this patch the n_state variable was referring to that computed
at the very start of the mp_execute_bytecode function.  This patch fixes it
so that n_state is recomputed when the code_state changes.
2017-05-25 20:35:57 +10:00
Paul Sokolovsky
982e676902 zephyr/modusocket: getaddrinfo: Raise OSError on resolution timeout, etc. 2017-05-24 19:55:14 +03:00
Paul Sokolovsky
1c9ee49756 drivers: Replace deprecated Pin.high()/low() methods with .__call__(1/0). 2017-05-21 17:44:58 +03:00
Paul Sokolovsky
bcf31a3908 esp8266, stmhal, zephyr: Rename machine.Pin high/low methods to on/off.
For consistent Pin/Signal class hierarchy. With it, Signal is a proper
(while still ducktyped) subclass of a Pin, and any (direct) usage of Pin
can be replace with Signal.

As stmhal's class is reused both as machine.Pin and legacy pyb.Pin,
high/low methods actually retained there.
2017-05-21 17:44:58 +03:00
Paul Sokolovsky
299c0a3925 CODECONVENTIONS: Typo fix. 2017-05-21 15:58:03 +03:00
Paul Sokolovsky
3ebd67fc09 library/machine.Pin: Remove .id() method and .board class attr.
Both aren't part of generic Hardware API: It's impossible to implement
.id() method in a generic case (e.g., when Pin is instantiated by the
underlying OS/RTOS). .board attribute is an obvious space hog which
instead can be implemented on Python level if needed.
2017-05-21 15:50:16 +03:00
Paul Sokolovsky
19e065294d cc3200/mods/pybpin: Remove toggle() method.
It's not part of MicroPython HW API and can be easily implemented on Python
level in case of need.

Saved 56 bytes of binary.
2017-05-21 15:39:27 +03:00
Damien George
338f0849d9 py/mkenv.mk: Use $(TOP) instead of ".." to reference tools, mpy-cross. 2017-05-19 15:53:55 +10:00
Damien George
436d97b3f9 docs/library/machine.UART: Update and improve uart.any() docs. 2017-05-19 15:48:22 +10:00
Damien George
aca898eeb0 esp8266/machine_uart: Add uart.any() method.
Returns 0 or 1, corresponding to no or at least 1 char waiting.
2017-05-19 15:48:22 +10:00
Damien George
218a876f97 tests/basics/builtin_range: Add tests for negative slicing of range. 2017-05-18 17:32:42 +10:00
Damien George
03659c51ca py/objrange: Fix slicing of range when step of slice is negative. 2017-05-18 17:32:42 +10:00
Damien George
e1b0f2a16f tests/basics/list_slice_3arg: Add more tests for negative slicing. 2017-05-18 17:32:42 +10:00
Damien George
eb4c37f7a4 py/sequence: Fix boundary errors when slicing with a negative step. 2017-05-18 17:32:42 +10:00