Commit Graph

4341 Commits

Author SHA1 Message Date
Daniel Campora f22b35e4e5 cc3200: Add socket.sendall() (aliases to send()).
Simplelink's socket send checks for the size of the packet and sends
it in chunks if the size is too large.
2015-07-17 11:38:01 +02:00
Daniel Campora a243d6b057 cc3200: Make socket stream methods return POSIX error codes. 2015-07-16 22:39:35 +02:00
Daniel Campora f738424403 cc3200: Remove superflous assignment since the result is not used. 2015-07-15 14:45:24 +02:00
Daniel Campora 753a8e8bc4 cc3200: Create /flash/cert folder if it doesn't exist. 2015-07-15 14:25:35 +02:00
Daniel Campora e955089da0 cc3200: Implement new OTA mechanism with 2 firmware update slots. 2015-07-15 14:25:28 +02:00
Dave Hylands 9309e609cd stmhal: Add qstr definition for ifconfig when building for WizNet 2015-07-14 23:00:29 +01:00
Damien George ade9a05236 py: Improve allocation policy of qstr data.
Previous to this patch all interned strings lived in their own malloc'd
chunk.  On average this wastes N/2 bytes per interned string, where N is
the number-of-bytes for a quanta of the memory allocator (16 bytes on 32
bit archs).

With this patch interned strings are concatenated into the same malloc'd
chunk when possible.  Such chunks are enlarged inplace when possible,
and shrunk to fit when a new chunk is needed.

RAM savings with this patch are highly varied, but should always show an
improvement (unless only 3 or 4 strings are interned).  New version
typically uses about 70% of previous memory for the qstr data, and can
lead to savings of around 10% of total memory footprint of a running
script.

Costs about 120 bytes code size on Thumb2 archs (depends on how many
calls to gc_realloc are made).
2015-07-14 22:56:32 +01:00
Paul Sokolovsky c48740e20b unix: modsocket: Implement inet_pton() in preference of inet_aton().
inet_pton supports both ipv4 and ipv6 addresses. Interface is also extensible
for other address families, but underlying libc inet_pton() function isn't
really extensible (e.g., it doesn't return length of binary address, i.e. it's
really hardcoded to AF_INET and AF_INET6). But anyway, on Python side, we could
extend it to support other addresses.
2015-07-15 00:06:03 +03:00
Paul Sokolovsky b178dccb9c unix: modsocket: Implement recvfrom().
Required to implement UDP servers.
2015-07-14 01:47:02 +03:00
Paul Sokolovsky 3b83aeb403 unix: modsocket: Implement sendto().
sendto() turns out to be mandatory function to work with UDP. It may seem
that connect(addr) + send() would achieve the same effect, but what connect()
appears to do is to set source address filter on a socket to its argument.
Then everything falls apart: socket sends to a broad-/multi-cast address,
but reply is sent from real peer address, which doesn't match filter set
by connect(), so local socket never sees a reply.
2015-07-12 13:53:35 +03:00
Paul Sokolovsky 115afdb07d unix: socket.getaddrinfo: Port is unsigned value.
Treating it as signed lead to buffer overflow for ports >= 32768.
2015-07-11 00:06:10 +03:00
Daniel Campora cf814b2d34 cc3200: Refactor and clean-up socket closing code. 2015-07-10 11:37:50 +02:00
Daniel Campora ecb7f9fe58 cc3200: Set simplelink time and date when enabling WLAN. 2015-07-10 11:37:48 +02:00
Daniel Campora fa47bebfbc cc3200: Add struct weak link for ustruct. 2015-07-10 11:37:46 +02:00
Paul Sokolovsky 8eb802a55b unix: socket.getaddrinfo: Accept family & socktype arguments.
This usually allows to get just a single address entry.
2015-07-10 01:50:23 +03:00
Daniel Campora af33ebb13b cc3200: Increment telnet Tx retry delay on every try. 2015-07-09 17:30:17 +02:00
Daniel Campora 9220dc466a cc3200: Correct udelay us to ticks calculation. 2015-07-08 13:13:37 +02:00
Daniel Campora d18ced9cdd cc3200: Use alternative HAL_Delay also when interrupts are disabled. 2015-07-08 12:48:35 +02:00
Damien George 7463442e58 docs: Update pyb.Accel doc to reflect changes and explain filtered_xyz. 2015-07-08 11:10:51 +01:00
Paul Sokolovsky 354d17523f modmachine: Implement physical memory access using /dev/mem (Linux, etc).
This requires root access. And on recent Linux kernels, with
CONFIG_STRICT_DEVMEM option enabled, only address ranges listed in
/proc/iomem can be accessed. The above compiled-time option can be
however overriden with boot-time option "iomem=relaxed".

This also removed separate read/write paths - there unlikely would
be a case when they're different.
2015-07-08 11:37:23 +03:00
Daniel Campora a0a3de60be cc3200: Translate simplelink's socket error numbers to POSIX values. 2015-07-07 16:13:54 +02:00
Daniel Campora 5685b565c3 cc3200: Create /flash/sys and /flash/lib directories while booting. 2015-07-07 16:13:40 +02:00
Daniel Campora 76e52b5daf cc3200: Make update-wipy.py more robust. 2015-07-07 16:11:48 +02:00
Daniel Campora fa655ce196 cc3200: Improve interrupt handling and fix bug in HAL_Delay(). 2015-07-07 16:11:05 +02:00
Daniel Campora 194c8c761e cc3200: Increment interrupt stack size from 2K to 3K. 2015-07-07 16:10:10 +02:00
Dave Hylands 11115e4d23 stmhal: Add I2S support to make-pins.py 2015-07-07 10:15:37 +01:00
Dave Hylands c91727b75a tools: Fix pydfu.py to work with old and new versions of PyUSB
Update pydfu.py to match with the version from openmv.

I just updated the openmv version to work with both of the
PyUSB 1.0.0.b1 and 1.0.0.b2

See: https://github.com/walac/pyusb/blob/master/ReleaseNotes.rst
2015-07-06 09:56:12 -07:00
Dave Hylands 9f76dcd682 py: Prevent many extra vstr allocations.
I checked the entire codebase, and every place that vstr_init_len
was called, there was a call to mp_obj_new_str_from_vstr after it.

mp_obj_new_str_from_vstr always tries to reallocate a new buffer
1 byte larger than the original to store the terminating null
character.

In many cases, if we allocated the initial buffer to be 1 byte
longer, we can prevent this extra allocation, and just reuse
the originally allocated buffer.

Asking to read 256 bytes and only getting 100 will still cause
the extra allocation, but if you ask to read 256 and get 256
then the extra allocation will be optimized away.

Yes - the reallocation is optimized in the heap to try and reuse
the buffer if it can, but it takes quite a few cycles to figure
this out.

Note by Damien: vstr_init_len should now be considered as a
string-init convenience function and used only when creating
null-terminated objects.
2015-07-06 17:29:27 +01:00
Damien George ef7dd8db2d py/repl: Fix case where shorter names are shadowed by longer names.
Previous to this patch, if "abcd" and "ab" were possible completions
to tab-completing "a", then tab would expand to "abcd" straight away
if this identifier appeared first in the dict.
2015-07-06 14:00:09 +01:00
Paul Sokolovsky 6ab8b63bdd tools/make-frozen.py: Use Python2-compatible shebang. 2015-07-06 14:48:29 +03:00
Damien George 68e8b595de tests: Catch ValueError instead of any exception to properly test error. 2015-07-06 11:35:08 +00:00
Damien George 722d4842df extmod/modubinascii: Re-use error string to reduce code size.
Drops Thumb2 arch size by 24 bytes.
2015-07-06 11:34:29 +00:00
Paul Sokolovsky de575c80b9 tools/make-frozen.py: Actually make Python2-compatible. 2015-07-06 14:27:57 +03:00
Paul Sokolovsky 3a2e9f20f6 tools/make-frozen.py: Add Python2 compatibility. 2015-07-06 14:09:16 +03:00
Paul Sokolovsky 7e66b859b2 modstruct: Raise NotImplementedError for unsupported repeat specification. 2015-07-05 22:44:14 +03:00
Daniel Campora aaf7c5b35e cc3200/README.md: Improve make deploy instructions. 2015-07-04 16:39:05 +02:00
Daniel Campora c030e77861 cc3200: Enable base64 methods from modubinascii. 2015-07-04 16:33:54 +02:00
Daniel Campora 219a74c014 cc3200/README.md: Add notes about deploying a new software version. 2015-07-04 16:32:49 +02:00
Paul Sokolovsky 7370fd5560 ubinascii: Fix a shadowed variable case. 2015-07-04 13:13:10 +03:00
Paul Sokolovsky e284a95cc3 ubinascii: b2a_base64: Optimize away a modulo operation. 2015-07-04 12:36:46 +03:00
Galen Hazelwood 616986a5f3 extmod: Add a2b_base64 and b2a_base64 functions to ubinascii. 2015-07-04 12:26:52 +03:00
Paul Sokolovsky b19d273beb esp8266: Allow to easily override programming baudrate. 2015-07-04 00:36:10 +03:00
Daniel Campora 31b40eebe8 cc3200: Fix socket recv and recvfrom return value type. 2015-07-02 23:17:22 +02:00
Damien George 035deae1c6 py/objarray.c: Allow to build with debugging and bytearray but no array. 2015-07-02 16:26:57 +01:00
Daniel Campora 5161239c9f cc3200: time.sleep() now receives seconds, like CPython. 2015-07-02 17:23:22 +02:00
Daniel Campora 9a65fa304c cc3200: Add modussl, ssl sockets subclassed from normal sockets.
Stream methods were added to normal sockets as in the unix port.
2015-07-02 16:30:00 +02:00
Daniel Campora 7c1c9af5d4 cc3200: Code clean-up on pybpin. 2015-07-02 16:29:51 +02:00
Daniel Campora 4f8eeaedef cc3200: Set WLAN date/time via the rtc.datetime method().
WLAN needs time info when validating certificates.
2015-07-02 16:29:43 +02:00
Daniel Campora d680e28a11 cc3200: Optimize check for WLAN AP mode. 2015-07-02 16:15:59 +02:00
Daniel Campora 7fd538c1b6 cc3200: Raise an exception if trying to scan for networks in AP mode. 2015-07-02 15:03:58 +02:00