Wykres commitów

8020 Commity (6201e848126eb2fcc9468a48065f01ca9f885177)

Autor SHA1 Wiadomość Data
Paul Sokolovsky 6201e84812 docs/license: Update copyright year. 2017-06-23 21:48:27 +03:00
Paul Sokolovsky bc7659eb59 tests/connect_nonblock: Refactor towards real net_hosted test.
In the future, a special runner for such tests will import each test and
call test() function with an address of test server to use.
2017-06-23 21:27:05 +03:00
Paul Sokolovsky 3f9d59c87a tests/net_inet: Move tests which don't require full Internet to net_hosted.
The idea is that these tests can be run with just a test server running
on a test host, with device under test connecting to it, instead of
requiring Internet connection for testing.

Such setup is however WIP, and some tests in net_hosted/ are so far
written to connect to Internet, as there're not test server written
yet. This is expected to evolve over time.
2017-06-23 21:12:32 +03:00
Paul Sokolovsky 0fe825b89e esp8266: Enable MICROPY_ENABLE_FINALISER.
GC finalization should be enabled for modlwip, or it may lead to GC
problems with socket objects. This decreases usable heap size from
36288 to 35968 (-320) bytes.
2017-06-23 20:12:33 +03:00
Damien George 46b849ab49 esp8266: Move mp_hal_pin_open_drain from esp_mphal.c to machine_pin.c.
It belongs with the other pin config functions in machine_pin.c.  Also,
esp_mphal.c is put in iRAM so this change saves about 300 bytes of iRAM
(and mp_hal_pin_open_drain is not a time critical function so doesn't
need to be in iRAM).
2017-06-22 16:39:09 +10:00
Damien George 6e80f0ee90 stmhal/modules: Provide sym-link to onewire.py driver. 2017-06-22 16:36:04 +10:00
Damien George 85acf7645f esp8266: Reinstate 1-wire scripts by sym-linking to drivers/onewire/.
No changes have been made to the code, the files just moved.
2017-06-22 16:33:20 +10:00
Damien George a065d78675 drivers/onewire: Move onewire.py, ds18x20.py from esp8266 to drivers.
These drivers can now be used by any port (so long as that port has the
_onewire driver from extmod/modonewire.c).

These drivers replace the existing 1-wire and DS18X20 drivers in the
drivers/onewire directory.  The existing ones were pyboard-specific and
not very efficient nor minimal (although the 1-wire driver was written in
pure Python it only worked at large enough CPU frequency).

This commit brings backwards incompatible API changes to the existing
1-wire drivers.  User code should be converted to use the new drivers, or
check out the old version of the code and keep a local copy (it should
continue to work unchanged).
2017-06-22 16:28:07 +10:00
Damien George b19138e82e stmhal: Make available the _onewire module, for low-level bus control. 2017-06-22 16:20:22 +10:00
Damien George 8ed7155828 stmhal: Add "quiet timing" enter/exit functions.
They disable all interrupts except for SysTick and are useful for doing
certain low-level timing operations.
2017-06-22 16:18:42 +10:00
Damien George eeaab1897b extmmod/modonewire: Rename public module to mp_module_onewire.
This follows naming scheme of other modules in extmod.
2017-06-22 16:17:46 +10:00
Damien George 6cc4da4cb8 extmod: Move modonewire.c from esp8266 to extmod directory.
It's now generic enough to be used by any port.
2017-06-22 16:06:00 +10:00
Damien George 0c13b95cdc esp8266/modonewire: Make timings static and remove onewire.timings func.
The 1-wire bus is defined with fixed timings so there should be no need to
change them dynamically at runtime.  Making the timings fixed saves about
270 bytes of code and 20 bytes of RAM.
2017-06-22 15:53:13 +10:00
Damien George 68c640d7cb esp8266/modonewire: Move low-level 1-wire bus code to modonewire.c.
The reason it was separated is so that the low-level code could be put in
iRAM, for timing reasons.  But:

1. Tests show that it's not necessary to have this code in iRAM for it to
function correctly, and taking it out of iRAM reclaims some of that precious
resource.  Furthermore, even though these functions were in iRAM there were
some functions that it called (eg pin get/set functions) which were not in
iRAM, so partially defeated the purpose of putting the 1-wire code in iRAM.

2. It's easier to reuse this 1-wire code in other ports if it's in a single
file.

3. If it turns out that certain code does need to be in iRAM then one can
use the MP_FASTCODE macro to do that.
2017-06-22 15:47:56 +10:00
Damien George d94bc675e8 py/compile: Optimise emitter label indices to save a word of heap.
Previous to this patch, a label with value "0" was used to indicate an
invalid label, but that meant a wasted word (at slot 0) in the array of
label offsets.  This patch adjusts the label indices so the first one
starts at 0, and the maximum value indicates an invalid label.
2017-06-22 15:05:58 +10:00
Damien George 44922934f5 tests/basics: Add tests for for-else statement. 2017-06-22 14:02:14 +10:00
Damien George 4c5f108321 py/compile: Fix bug with break/continue in else of optimised for-range.
This patch fixes a bug whereby the Python stack was not correctly reset if
there was a break/continue statement in the else black of an optimised
for-range loop.

For example, in the following code the "j" variable from the inner for loop
was not being popped off the Python stack:

    for i in range(4):
        for j in range(4):
            pass
        else:
            continue

This is now fixed with this patch.
2017-06-22 13:50:33 +10:00
Damien George 458cbacb8f tests/net_inet: Add tests for accept and connect in nonblocking mode.
Some of these tests don't require an Internet connection, but here is a
good place to put them for now.
2017-06-21 12:25:10 +10:00
Paul Sokolovsky 4caa27ae0e tests/net_inet/test_tls_sites.py: Integration test for SSL connections.
This attempts to bootstrap network tests for MicroPython. This commits
sets test/net_inet/ as place for tests which require access to wide
Internet. They aren't intended to be run as part of the main testsuite,
instead to be run manually on demand.

test_tls_sites.py in particular check that it's possible to establish
SSL/TLS connection to select sites on the Internet: few references ones,
plus those for which problems were reported, and resolved.
2017-06-21 01:58:36 +03:00
Damien George c06aa5be00 esp8266: Make onewire module and support code usable by other ports. 2017-06-20 19:11:46 +10:00
Damien George e6782428be cc3200: Initialise variable to zero to prevent compiler warnings. 2017-06-20 17:14:48 +10:00
Damien George 1686346d53 cc3200: Make non-zero socket timeout work with connect/accept/send.
The CC3100 only allows to set a timeout for receiving data, not for accept,
connect or send.  But it can set non-blocking for all these operations and
this patch uses that feature to implement socket timeout in terms of non-
blocking behaviour combined with a loop.
2017-06-20 16:52:39 +10:00
Damien George 101fc187f0 esp8266/Makefile: Add LIB_SRC_C variable to qstr auto-extraction list. 2017-06-20 15:20:09 +10:00
Paul Sokolovsky 9ae0713cef unix/mpconfigport.mk: Update descriptions of readline and TLS options. 2017-06-17 15:44:28 +03:00
Paul Sokolovsky b8fef67c69 CODECONVENTIONS: Clarify MicroPython changes sign-off process.
In particular, require the real name and email address.
2017-06-16 11:32:51 +03:00
Paul Sokolovsky 94696973a0 docs/select: Rename to uselect, to match the actual module name.
Also, add ipoll() documentation and markup changes to comply with CPython
usage.
2017-06-16 11:28:06 +03:00
Damien George 396d6f6d4e teensy/Makefile: Include relevant sources in list for qstr extraction. 2017-06-15 20:03:17 +10:00
Damien George a960d50579 qemu-arm/Makefile: Include relevant sources in list for qstr extraction. 2017-06-15 20:02:43 +10:00
Damien George 4f9858e86d stmhal: Move pybstdio.c to lib/utils/sys_stdio_mphal.c for common use.
It provides sys.stdin, sys.stdout, sys.stderr for bare-metal targets based
on mp_hal functions.
2017-06-15 18:55:34 +10:00
Damien George 76ec04a6d9 esp8266/Makefile: Allow FROZEN_DIR,FROZEN_MPY_DIR to be overridden. 2017-06-15 18:45:18 +10:00
Damien George a5609e1cf1 teensy: Provide dummy implementation of extint_register_pin. 2017-06-15 17:42:18 +10:00
Damien George fd860dc552 stmhal: Add .value() method to Switch object, to mirror Pin and Signal. 2017-06-15 17:34:51 +10:00
Damien George 4abe3731e3 stmhal: Add initial implementation of Pin.irq() method.
This method follows the new HW API and allows to set a hard or soft IRQ
callback when a Pin has a level change.  It still remains to make this
method return a IRQ object.
2017-06-15 17:17:36 +10:00
Damien George e269cabe3e py/objint: In to_bytes(), allow length arg to be any int and check sign. 2017-06-15 14:21:02 +10:00
Damien George 8c5632a869 py/objint: Support "big" byte-order in int.to_bytes(). 2017-06-15 13:56:21 +10:00
Damien George 2bf5a947b2 stmhal: Make error messages more consistent across peripherals. 2017-06-15 12:02:14 +10:00
Damien George 48d867b4a6 all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers. 2017-06-15 11:54:41 +10:00
Damien George 1e70fda69f py/compile: Raise SyntaxError if positional args are given after */**.
In CPython 3.4 this raises a SyntaxError.  In CPython 3.5+ having a
positional after * is allowed but uPy has the wrong semantics and passes
the arguments in the incorrect order.  To prevent incorrect use of a
function going unnoticed it is important to raise the SyntaxError in uPy,
until the behaviour is fixed to follow CPython 3.5+.
2017-06-14 18:18:01 +10:00
Damien George 696fcde800 cc3200/modusocket: Simplify socket.makefile() function.
Following how extmod/modlwip.c does it.
2017-06-14 17:40:02 +10:00
Damien George 3bedff0b3c lib/libm/math: Remove implementations of float conversion functions.
These implementations are incorrect (eg f2d and d2f don't handle special
values like 0.0) and proper versions can be provided by libgcc (or
equivalent depending on the toolchain).

libgcc is now linked with the stmhal port so that library will provide
these functions from now on.
2017-06-14 17:18:23 +10:00
Damien George c064f0a36a stmhal/mpconfigport.h: Remove config of PY_THREAD_GIL to use default.
The default for the GIL is to enable it if threading is enabled, and this
is the recommended way to use threading with the stmhal port.
2017-06-14 14:47:53 +10:00
Damien George e374cfff80 py/modthread: Raise RuntimeError in release() if lock is not acquired. 2017-06-14 14:43:50 +10:00
Paul Sokolovsky a47b871131 esp8266/Makefile: Bump axTLS TLS record buffer size to 5K.
The latest fashion is pushing certificate sub-chains, instead of a single
certificate, during TLS handshake. These are pushed via single TLS record
and effectively put minimum size limit on TLS record buffer. Recently,
these commonly grew over 4K, so we have little choice but to adjust.
2017-06-14 01:28:22 +03:00
Paul Sokolovsky 82b9915b34 extmod/modussl_axtls: Implement server_hostname arg to wrap_socket().
As enabled by SNI support in axTLS v2+.
2017-06-14 01:01:12 +03:00
Paul Sokolovsky 75c3f2a7ab extmod/modussl_axtls: Update for axTLS 2.1.3.
ssl_client_new() accepts new SSL_EXTENSIONS* argument.
2017-06-13 17:41:46 +03:00
Paul Sokolovsky f01c1c6b35 lib/axtls: Upgrade to axTLS 2.1.3 + MicroPython patchset.
axTLS 2.1.3 brings support for TLS 1.2 and SNI. With MicroPython patchset
on top of it, the code size growth (x86) is ~2K.
2017-06-13 17:39:20 +03:00
Damien George 6ed4581f54 py/formatfloat: Fix number of digits and exponent sign when rounding.
This patch fixes 2 things when printing a floating-point number that
requires rounding up of the mantissa:
- retain the correct precision; eg 0.99 becomes 1.0, not 1.00
- if the exponent goes from -1 to 0 then render it as +0, not -0
2017-06-13 13:36:56 +10:00
Paul Sokolovsky d42b80fd64 unix/modtime: Replace strftime() with localtime().
Baremetal ports standardized on providing localtime(). localtime() offers
more functionality, in particular, strftime() can be completely implemented
in Python with localtime().
2017-06-11 21:16:35 +03:00
Paul Sokolovsky 08c73d9734 docs/btree: Typo/wording fixes. 2017-06-11 18:23:13 +03:00
Paul Sokolovsky 6ca086a89a docs/btree: Add hints about opening db file and need to flush db. 2017-06-11 17:44:11 +03:00