Commit Graph

9993 Commits

Author SHA1 Message Date
Paul Sokolovsky 6fb093282b docs/ussl: Fix module name refs and use "MicroPython port" term. 2017-10-30 18:03:54 +02:00
Damien George 10b76a9620 extmod/modussl_mbedtls: Allow to compile with unix coverage build.
Fixes a few C warnings.  No functional changes.
2017-10-30 15:41:37 +11:00
Eric Poulsen 74ec52d857 extmod/modussl: Add finaliser support for ussl objects.
Per the comment found here
https://github.com/micropython/micropython-esp32/issues/209#issuecomment-339855157,
this patch adds finaliser code to prevent memory leaks from ussl objects,
which is especially useful when memory for a ussl context is allocated
outside the uPy heap.  This patch is in-line with the finaliser code found
in many modsocket implementations for various ports.

This feature is configured via MICROPY_PY_USSL_FINALISER and is disabled by
default because there may be issues using it when the ussl state *is*
allocated on the uPy heap, rather than externally.
2017-10-30 15:25:32 +11:00
Yuval Langer 05a2bb888f docs/reference/isr_rules: Minor typo correction. 2017-10-30 13:29:00 +11:00
Paul Sokolovsky 8f9af63c20 lib/axtls: Update, support for SSL_EAGAIN return code.
A step towards implementing non-blocking stream support for SSL.
2017-10-29 19:53:59 +02:00
Paul Sokolovsky 24c8eda744 unix: Enable MICROPY_PY_REVERSE_SPECIAL_METHODS.
With inplace methods now disabled by default, it makes sense to enable
reverse methods, as they allow for more useful features, e.g. allow
for datetime module to implement both 2 * HOUR and HOUR * 2 (where
HOUR is e.g. timedelta object).
2017-10-28 13:05:57 +03:00
mrmcwethy 1893669833 calcsize90 should be documented now 2017-10-27 23:25:00 -07:00
Dan Halbert 949a8f5043
Merge pull request #382 from dhalbert/master
Read serial input as a background task so we can check for the interrupt character.
2017-10-27 17:37:57 -04:00
Dan Halbert 8e45dc041f Read serial input as a background task so we can check for the interrupt character. 2017-10-27 17:32:13 -04:00
Dan Halbert 10b3a90189 Check INTERNAL_LIBM make flag in a safer way. 2017-10-27 17:32:13 -04:00
Dan Halbert 7f88ba3b26 Revert "Allow main.py to be interrupted by ctrl-C" (#381)
* Revert "Read serial input as a background task so we can check for the interrupt character."

This reverts commit 046092e8a2.

* Revert "Check INTERNAL_LIBM make flag in a safer way."

This reverts commit 2b80add22f.
2017-10-27 17:32:13 -04:00
Dan Halbert 2487226dff Read serial input as a background task so we can check for the interrupt character. 2017-10-27 17:32:13 -04:00
Dan Halbert f0a12d9620 Check INTERNAL_LIBM make flag in a safer way. 2017-10-27 17:32:13 -04:00
Dan Halbert 0e83f8c752
Revert "Allow main.py to be interrupted by ctrl-C" (#381)
* Revert "Read serial input as a background task so we can check for the interrupt character."

This reverts commit 046092e8a2.

* Revert "Check INTERNAL_LIBM make flag in a safer way."

This reverts commit 2b80add22f.
2017-10-27 17:14:57 -04:00
Dan Halbert 046092e8a2 Read serial input as a background task so we can check for the interrupt character. 2017-10-27 17:11:09 -04:00
Dan Halbert 2b80add22f Check INTERNAL_LIBM make flag in a safer way. 2017-10-27 17:11:09 -04:00
Paul Sokolovsky 0e80f345f8 py/objtype: Introduce MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS.
This allows to configure support for inplace special methods separately,
similar to "normal" and reverse special methods. This is useful, because
inplace methods are "the most optional" ones, for example, if inplace
methods aren't defined, the operation will be executed using normal
methods instead.

As a caveat, __iadd__ and __isub__ are implemented even if
MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS isn't defined. This is similar
to the state of affairs before binary operations refactor, and allows
to run existing tests even if MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS
isn't defined.
2017-10-27 22:29:15 +03:00
Paul Sokolovsky 9b9dbc5815 py/objtype: Define all special methods if requested.
If MICROPY_PY_ALL_SPECIAL_METHODS is defined, actually define all special
methods (still subject to gating by e.g. MICROPY_PY_REVERSE_SPECIAL_METHODS).

This adds quite a number of qstr's, so should be used sparingly.
2017-10-27 20:06:35 +03:00
Joar Wandborg b9923262db docs/library/network: Add dhcp_hostname parameter
I have not actually tested this, going by information available in https://forum.micropython.org/viewtopic.php?t=2584
2017-10-27 11:04:52 +03:00
Damien George c64eb4f8ce extmod/vfs: Replace VLA in proxy func with small, static sized array.
VLAs can be expensive on stack usage due to stack alignment requirements,
and also the fact that extra local variables are needed to track the
dynamic size of the stack.  So using fixed-size arrays when possible can
help to reduce code size and stack usage.

In this particular case, the maximum value of n_args in the VLA is 2 and so
it's more efficient to just allocate this array with a fixed size.  This
reduces code size by around 30 bytes on Thumb2 and Xtensa archs.  It also
reduces total stack usage of the function: on Thumb2 the usage with VLA is
between 40 and 48 bytes, which is reduced to 32; on Xtensa, VLA usage is
between 64 and 80 bytes, reduced to 32; on x86-64 it's at least 88 bytes
reduced to 80.
2017-10-27 18:01:25 +11:00
Paul Sokolovsky a33fca99a1 docs/usocket: Document inet_ntop(), inet_pton(). 2017-10-27 00:27:27 +03:00
Dan Halbert e7e8e0a95d Sync with https://github.com/adafruit/asf4/pull/3 2017-10-26 09:56:02 -07:00
Dan Halbert 4232a0a196 Sync with https://github.com/adafruit/asf4/pull/3 2017-10-26 09:30:59 -04:00
Scott Shawcroft ee18b5cbab Don't use ERR_ABORTED. (#375) 2017-10-26 09:08:29 -04:00
Paul Sokolovsky d1cd533134 docs/usocket: Elaborate descriptions.
Use the "usocket" module name everywhere. Use "MicroPython port"
terminology. Suggest to avoid using IPPROTO_* constants in socket()
call.
2017-10-26 14:20:37 +03:00
Damien George f36975b679 tests/net_inet: Update tls test to work with CPython and incl new site.
CPython only supports the server_hostname keyword arg via the SSLContext
object, so use that instead of the top-level ssl.wrap_socket.  This allows
the test to run on CPython the same as uPy.

Also add the "Host:" header to correctly make a GET request (for URLs that
are hosted on other servers).  This is not strictly needed to test the SSL
connection but helps to debug things when printing the response.
2017-10-26 12:29:24 +11:00
Scott Shawcroft d613776f0d atmel-samd: Add support for ERR_ABORTED to indicate medium not present. 2017-10-25 21:02:01 -04:00
Scott Shawcroft ab7da9353a atmel-samd: Stop hanging on usb write when a terminal isn't connected by checking DTR status. 2017-10-25 21:02:01 -04:00
Carter Nelson db918da5f0 updated I2C example (#371) 2017-10-25 17:32:00 -07:00
Dan Halbert ca1a9b9a10 Merge pull request #369 from tannewt/nrf2_merge
Nrf52 merge
2017-10-25 20:16:50 -04:00
Paul Sokolovsky 328c1e78be docs/uselect: Document one-shot polling mode. 2017-10-26 00:30:07 +03:00
Scott Shawcroft b31d673207 tests: Capture stderr output as well. 2017-10-25 11:43:02 -07:00
Scott Shawcroft 5a59a10bf2 Add log folding to Travis outout. 2017-10-25 11:01:43 -07:00
Scott Shawcroft d2ddf36c1d shared-bindings: Use unary_op type. 2017-10-25 10:52:03 -07:00
Limor "Ladyada" Fried c966976591 update light/lux and eCO2 + TVOC 2017-10-25 12:32:39 -04:00
Scott Shawcroft 00766e43a0 Merge commit 'f57be61' into nrf2_merge 2017-10-24 23:26:41 -07:00
Scott Shawcroft 60e9b8f70a tools: Correct ports directory name 2017-10-24 23:06:02 -07:00
Scott Shawcroft d665334e94 esp8266: Fix includes 2017-10-24 23:05:20 -07:00
Scott Shawcroft 2c26f35429 Re-add atmel submodules. 2017-10-24 22:39:08 -07:00
Scott Shawcroft 73c15dcf8b Merge commit 'f869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c' into nrf2_merge
This is prep for merging in the NRF5 pull request.
2017-10-24 22:31:16 -07:00
Paul Sokolovsky 9a7e3469b2 unix/modusocket: Remove #if MICROPY_SOCKET_EXTRA code blocks.
These defined couple of functions added during initial experimentation,
which aren't part of MicroPython API and no longer used or needed.
2017-10-24 23:13:19 +03:00
Scott Shawcroft d43564f854 atmel-samd: Use our own CDC output cache because the internal (#366)
atmel-samd: Use our own CDC output cache because the internal
cache is only used when the memory isn't aligned even if we're
going to change the memory immediately after.
2017-10-24 12:57:03 -07:00
Scott Shawcroft ee1092fcaf atmel-samd: Update metro m4 USB PID. (#365) 2017-10-24 14:47:43 -04:00
Damien George f4059dcc0c all: Use NULL instead of "" when calling mp_raise exception helpers.
This is the established way of doing it and reduces code size by a little
bit.
2017-10-24 22:39:36 +11:00
Dan Halbert 6df99b5d0e Merge 2.1.0 changes into master. 2017-10-23 15:26:36 -07:00
Paul Sokolovsky cfff12612f unix: Rename modsocket.c to modusocket.c.
Unix naming is historical, before current conventions were established.
All other ports however have it as "modusocket.c", so rename for
consistency and to avoid confusion.
2017-10-23 12:09:37 +03:00
Radomir Dopieralski 1c97b7f4df Gracefully reset the gamepad module
If a soft reset happens while the gamepad module is scanning for button
presses, there is a moment when the pins get de-initialized, but the
gamepad module is still trying to read them, which ends in a crash.
We can avoid it by disabling scanning on reset.

(cherry picked from commit 470a23d4c9)

Conflicts:
	atmel-samd/main.c
2017-10-22 20:54:10 -07:00
Scott Shawcroft a1be272b1e atmel-samd: Correct the UF2 bootloader offset when converting the bin to uf2. 2017-10-22 12:39:01 -07:00
mrmcwethy bb008cdbc9 First attempt to move py/modmath.c to shared-bindings/math 2017-10-21 10:34:25 -07:00
Paul Sokolovsky 9956fd0710 py/objtype: Fit qstrs for special methods in byte type.
Update makeqstrdata.py to sort strings starting with "__" to the beginning
of qstr list, so they get low qstr id's, guaranteedly fitting in 8 bits.
Then use this property to further compact op_id => qstr mapping arrays.
2017-10-21 11:06:32 +03:00