Wykres commitów

7671 Commity (bf51e2ff980584603853cc1e7d47b8012316618f)

Autor SHA1 Wiadomość Data
Damien George bf51e2ff98 tests/basics: Add tests for list and bytearray growing using themselves. 2017-04-02 17:31:32 +10:00
Damien George a5500a8aad py/obj.h: Make sequence grow more efficient and support overlapping.
The first memmove now copies less bytes in some cases (because len_adj <=
slice_len), and the memcpy is replaced with memmove to support the
possibility that dest and slice regions are overlapping.
2017-04-02 17:28:24 +10:00
Paul Sokolovsky 3df65e9bae zephyr/modusocket: Implement recv() for UDP sockets.
The foundation of recv() support is per-socket queue of incoming packets,
implemented using Zephyr FIFO object. This patch implements just recv()
for UDP, because TCP recv() requires much more fine-grained control of
network fragments and handling other issues, like EOF condition, etc.
2017-04-01 09:20:17 +03:00
Damien George 4c307bfba1 all: Move BYTES_PER_WORD definition from ports to py/mpconfig.h
It can still be overwritten by a port in mpconfigport.h but for almost
all cases one can use the provided default.
2017-04-01 11:39:38 +11:00
Paul Sokolovsky 64d00511e1 zephyr/modusocket: Implement send(). 2017-03-31 23:14:39 +03:00
Paul Sokolovsky 88582e33cc zephyr/modusocket: Implement bind() and connect(). 2017-03-31 23:02:41 +03:00
Damien George b6c7e4b143 all: Use full path name when including mp-readline/timeutils/netutils.
This follows the pattern of how all other headers are now included, and
makes it explicit where the header file comes from.  This patch also
removes -I options from Makefile's that specify the mp-readline/timeutils/
netutils directories, which are no longer needed.
2017-03-31 22:29:39 +11:00
Pavol Rusnak 6e6c01b971 unix: Convert mp_uint_t to size_t in alloc.c. 2017-03-31 13:18:47 +11:00
Damien George 2460888c74 stmhal/i2c: Clean the cache so that I2C DMA works on F7 MCUs. 2017-03-31 12:56:18 +11:00
Damien George aa7de3ff67 stmhal: Move L4/F7 I2C timing constants from mpconfigboard.h to i2c.c.
Such constants are MCU specific so shouldn't be specified in the board
config file (else it leads to too much duplication of code).

This patch also adds I2C timing values for the F767/F769 for 100k, 400k
and 1MHz I2C bus frequencies.
2017-03-31 12:53:56 +11:00
Paul Sokolovsky 6cc1a7a214 zephyr: Integrate modusocket into build. 2017-03-31 00:06:31 +03:00
Paul Sokolovsky d1015f0e0d zephyr/modusocket: Initial version of usocket module for Zephyr.
So far, socket creation and closure is implemented.
2017-03-31 00:04:31 +03:00
Paul Sokolovsky 344bfbb71c zephyr: Fix NLR segfault in minimal build.
Requires inclusion of zephyr.h to properly detect that we're building for
Zephyr.
2017-03-30 22:17:18 +03:00
Paul Sokolovsky df48f4645d zephyr/Makefile: Add workaround (fix?) for broken builds for DTS targets. 2017-03-30 15:16:55 +03:00
Damien George 4b753515c7 py/objzip: Convert mp_uint_t to size_t. 2017-03-30 22:58:08 +11:00
Damien George 00b1a3e4d2 stmhal/dma: Don't include SDMMC2 struct if SDMMC2 is not available.
Not all F7 MCUs have SDMMC2.
2017-03-30 18:24:31 +11:00
Damien George 81e19eaf05 stmhal/boards: Remove F769 alt function table, it's same as for F767. 2017-03-30 18:00:31 +11:00
Damien George 41cbe8045e stmhal/boards/STM32F769DISC: Fix user switch pin, and document stlink. 2017-03-30 17:59:36 +11:00
Damien George c74fa7f58e stmhal/boards/STM32F769DISC: Get SD card working by using SDMMC2. 2017-03-30 17:58:45 +11:00
Damien George 9818c0db43 stmhal/boards: Update F76x alternate function table to add SDMMC2. 2017-03-30 17:57:18 +11:00
Damien George 7876e54aa5 stmhal/sdcard: Add support for SDMMC2 on F7 MCUs.
By default the SDIO (F4) or SDMMC1 (L4, F7) is used as the SD card
peripheral, but if a board config defines MICROPY_HW_SDMMC2_CK and other
pins then the SD card driver will use SDMMC2.
2017-03-30 17:55:21 +11:00
Damien George 43defc9e98 stmhal: Support SDMMC alternate functions in pin generation. 2017-03-30 17:52:20 +11:00
Paul Sokolovsky 29dd92c82a zephyr/Makefile: Rework to use modern, official build integration.
Build happens in 3 stages:

1. Zephyr config header and make vars are generated from prj.conf.
2. libmicropython is built using them.
3. Zephyr is built and final link happens.
2017-03-30 00:08:27 +03:00
Jan Pochyla e9d7c3ea0e modutimeq: Add peektime() function (provisional).
Allows to get event time for a head item in the queue. The usecase
if waiting for the next event *OR* I/O completion. I/O completion may
happen before event triggers, and then wait should continue for the
remaining event time (or I/O completion may schedule another earlier
event altogether).

The new function has a strongly provisional status - it may be converted
to e.g. peek() function returning all of the event fields, not just time.
2017-03-29 18:18:35 +03:00
Damien George 6bfb344a80 cc3200/mods/pybi2c: Raise OSError if readfrom_mem fails to write addr. 2017-03-29 16:09:46 +11:00
Damien George 22e2f4a0e8 stmhal/spi: Increase SPI transfer timeout, proportional to num bytes.
With the existing timeout of 100ms the transfer would end prematurely if
the baudrate was low and the number of bytes to send was high.  This patch
fixes the problem by making the timeout proportional to the number of bytes
that are being transferred.
2017-03-29 16:02:43 +11:00
Damien George 3a77342719 cc3200: Update for changes to mp_obj_str_get_data. 2017-03-29 12:56:45 +11:00
Damien George 1145dd35f2 esp8266: Update for changes to mp_obj_str_get_data. 2017-03-29 12:56:45 +11:00
Damien George a9c8db07bd stmhal: Update for changes to mp_obj_str_get_data. 2017-03-29 12:56:45 +11:00
Damien George 3022e00bbf lib/netutils: Update for changes to mp_obj_str_get_data. 2017-03-29 12:56:45 +11:00
Damien George 204ded848e extmod: Update for changes to mp_obj_str_get_data. 2017-03-29 12:56:45 +11:00
Damien George 6b34107537 py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
Damien George ca06fac4a1 stmhal: Update to use size_t for tuple/list accessors. 2017-03-29 12:56:45 +11:00
Damien George 1d7e3113db esp8266: Update to use size_t for tuple/list accessors. 2017-03-29 12:56:45 +11:00
Damien George 87f068d7d9 cc3200: Update to use size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
Damien George 46e98d9ea7 unix: Convert mp_uint_t to size_t for use of mp_obj_list_get. 2017-03-29 12:56:17 +11:00
Damien George a8a3ab48da extmod/moduselect: Update to use size_t for array accessor. 2017-03-29 12:56:17 +11:00
Damien George 6213ad7f46 py: Convert mp_uint_t to size_t for tuple/list accessors.
This patch changes mp_uint_t to size_t for the len argument of the
following public facing C functions:

mp_obj_tuple_get
mp_obj_list_get
mp_obj_get_array

These functions take a pointer to the len argument (to be filled in by the
function) and callers of these functions should update their code so the
type of len is changed to size_t.  For ports that don't use nan-boxing
there should be no change in generate code because the size of the type
remains the same (word sized), and in a lot of cases there won't even be a
compiler warning if the type remains as mp_uint_t.

The reason for this change is to standardise on the use of size_t for
variables that count memory (or memory related) sizes/lengths.  It helps
builds that use nan-boxing.
2017-03-29 12:56:17 +11:00
Damien George f7816188b7 extmod/vfs_fat: Fix calculation of total blocks in statvfs. 2017-03-29 12:53:35 +11:00
Damien George f9b0e644e5 py/compile: Provide terse error message for invalid dict/set literals. 2017-03-29 12:44:27 +11:00
Damien George 18c059febf py: Shorten a couple of error messages. 2017-03-29 12:36:46 +11:00
Damien George f55a059e7a py/compile: Simplify syntax-error messages for illegal assignments.
With this patch all illegal assignments are reported as "can't assign to
expression".  Before the patch there were special cases for a literal on
the LHS, and for augmented assignments (eg +=), but it seems a waste of
bytes (and there are lots of bytes used in error messages) to spend on
distinguishing such errors which a user will rarely encounter.
2017-03-29 12:28:33 +11:00
Damien George 5010d1958f py/lexer: Simplify and reduce code size for operator tokenising.
By removing the 'E' code from the operator token encoding mini-language the
tokenising can be simplified.  The 'E' code was only used for the !=
operator which is now handled as a special case; the optimisations for the
general case more than make up for the addition of this single, special
case.  Furthermore, the . and ... operators can be handled in the same way
as != which reduces the code size a little further.

This simplification also removes a "goto".

Changes in code size for this patch are (measured in bytes):

bare-arm:       -48
minimal x86:    -64
unix x86-64:   -112
unix nanbox:    -64
stmhal:         -48
cc3200:         -48
esp8266:        -76
2017-03-29 10:56:52 +11:00
Paul Sokolovsky e93c4ca181 zephyr/prj_base.conf: Enable TCP (and UDP explicitly). 2017-03-29 00:46:06 +03:00
Damien George 94c41bb06f py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible.
Saves 168 bytes on bare-arm.
2017-03-28 22:37:26 +11:00
Damien George 7b1804c582 stmhal/dma: Fix reinitialisation of DMA on F7 MCUs, following F4. 2017-03-28 12:59:02 +11:00
Damien George e997bb6328 stmhal/hal: For F7 MCUs, expose DMA_CalcBaseAndBitshift function.
It's needed by the DMA driver to do an efficient reinitialisation.  This
patch follows what is done in the F4 HAL.
2017-03-28 12:56:18 +11:00
Damien George ff927cb106 stmhal/spi: Clean and/or invalidate D-cache before SPI DMA transfers.
On MCUs with a cache (eg F7) this must be done or else the SPI data that is
transferred is incorrect.
2017-03-28 12:54:01 +11:00
Damien George 9a1b3da158 stmhal/board: Fix existing and add more pin defs for NUCLEO_F767ZI. 2017-03-28 12:42:23 +11:00
Damien George 8b36664e17 stmhal/boards: Fix alt-func config for PA5 of STM32F767. 2017-03-28 12:41:55 +11:00