Commit Graph

8040 Commits

Author SHA1 Message Date
Damien George c408ed9fb1 py/mpconfig.h: Remove spaces in "Micro Python" and remove blank line. 2017-06-26 12:29:20 +10:00
Paul Sokolovsky a926119099 docs/ref/speed_python: Update and make more hardware-neutral.
Move hardware-specific optimizations to the very end of document, and
add visible note that it gives an example for Pyboard. Remove references
to specific hardware technologies, so the doc can be more naturally
used across ports. Various markup updates to adhere to the latest
docs conventions.
2017-06-26 01:11:17 +03:00
Paul Sokolovsky dd16e21562 docs/network: Use markup adhering to the latest docs conventions. 2017-06-26 00:37:30 +03:00
Paul Sokolovsky 7c0e1f1a08 docs/machine*: Use markup adhering to the latest docs conventions. 2017-06-25 13:30:29 +03:00
Paul Sokolovsky cfce7d784e docs/lcd160cr: Group related constants together. Use full sentences.
Per the latest docs conventions.
2017-06-25 13:28:23 +03:00
Paul Sokolovsky ba33c544bb docs/conf.py: Set default_role = 'any'.
This causes `symbol` syntax to be equivalent to :any:`symbol`, which is
in turn the easiest way to cross-reference an arbitrary symbol in the
docs:

http://www.sphinx-doc.org/en/stable/markup/inline.html#role-any

:any: requires at least Sphinx 1.3 (for reference, Ubuntu 16.03 ships
with 1.3.6, the latest 1.6.3).

Any many of our docs, `symbol` is misused to specify arguments to
functions, etc. Refactoring that is in progress. (CODECONVENTIONS
already specify proper syntax for both arguments and xrefs, based
on CPython conventions).
2017-06-25 00:57:44 +03:00
Paul Sokolovsky 6f87b03e3c docs/utime: Use markup adhering to the latest conventions. 2017-06-25 00:54:38 +03:00
Paul Sokolovsky 1e31d4bdf6 docs/lcd160cr: Use markup adhering to the latest conventions. 2017-06-25 00:46:07 +03:00
Paul Sokolovsky 176aa681f0 CODECONVENTIONS: docs: Markup for None/True/False.
Based on what CPython uses. However, Read The Docs theme styles this
markup in very stand-out way, so we may think what to do about it.
2017-06-25 00:26:44 +03:00
Paul Sokolovsky 7f2bc83dbc docs/btree: Use markup adhering to the latest conventions. 2017-06-25 00:17:18 +03:00
Paul Sokolovsky e92602ba27 CODECONVENTIONS: Start to describe docs conventions. 2017-06-25 00:13:13 +03:00
Paul Sokolovsky bc790b5145 docs/builtins: List builtin exceptions.
If for nothing else, then at least to cross-reference them.
2017-06-24 23:45:38 +03:00
Paul Sokolovsky 602f7e2189 esp8266/README: Make "Documentation" a top-level section. 2017-06-24 17:38:53 +03:00
Paul Sokolovsky 7455e40186 README: Mention support for bytecode and frozen bytecode. 2017-06-24 17:33:47 +03:00
Paul Sokolovsky 91e93a9684 extmod/moduzlib: decompress: Remove stale "(void)n_args".
n_args is now actually used in this function.
2017-06-24 16:36:05 +03:00
Paul Sokolovsky c4e3a03fa5 docs/gc: Document gc.threshold() function. 2017-06-24 13:35:41 +03:00
Paul Sokolovsky 4cdddfed8e docs/gc: Mark mem_alloc()/mem_free() as uPy-specific. 2017-06-24 13:12:09 +03:00
Paul Sokolovsky b50659e137 docs/conf.py: Include 3 levels of ToC in latexpdf output.
Instead of default 2. 3 are required to access description of individual
library modules.
2017-06-24 00:25:29 +03:00
Paul Sokolovsky beb94b6efc docs/esp8266/tutorial/intro: Sphinx requires blank lines around literal blocks.
At least, Sphinx 1.3.6.
2017-06-23 22:04:33 +03:00
Paul Sokolovsky 51668dffaa docs/esp8266/tutorial/intro: Discourage use of 512kb firmwares.
This follows similar warnings in other parts of docs.
2017-06-23 22:00:40 +03:00
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