Wykres commitów

7462 Commity (ecc635d551aa8fa5e02d2cb810b929ec92c54c3f)

Autor SHA1 Wiadomość Data
Damien George ecc635d551 tests/extmod: Add test for machine.Signal class. 2017-03-02 16:09:16 +11:00
Damien George f1ea3bc72b unix/modmachine: Add Signal class to machine module. 2017-03-02 16:08:20 +11:00
Damien George 78185e6a6c stmhal/modpyb: Use utime ticks ms/us functions instead of custom ones. 2017-03-02 15:43:14 +11:00
Damien George 89738e8240 stmhal: Rename sys_tick ticks/delay functions to corresp. mp_hal ones.
The renames are:
HAL_Delay -> mp_hal_delay_ms
sys_tick_udelay -> mp_hal_delay_us
sys_tick_get_microseconds -> mp_hal_ticks_us

And mp_hal_ticks_ms is added to provide the full set of timing functions.

Also, a separate HAL_Delay function is added which differs slightly from
mp_hal_delay_ms and is intended for use only by the ST HAL functions.
2017-03-02 15:32:32 +11:00
Damien George 6ab5512132 stmhal: Use mp_hal_delay_ms instead of HAL_Delay. 2017-03-02 15:02:57 +11:00
Peter Hinch 1f549a3496 docs/library/lcd160cr: Add note about supported JPEG format/encodings. 2017-02-28 17:45:24 +11:00
Paul Sokolovsky ed81574fe9 docs/machine: Fix formatting of Constants section.
Render related constants grouped together, with common description.
2017-02-28 00:38:15 +03:00
Damien George 528aeb3bf3 drivers/display/lcd160cr: Add check that JPEG size is less than 65536. 2017-02-27 18:39:35 +11:00
Damien George f4a12dca58 py/objarray: Disallow slice-assignment to read-only memoryview.
Also comes with a test for this.  Fixes issue #2904.
2017-02-27 16:09:57 +11:00
Krzysztof Blazewicz 23ccb3e12e tools/gen-cpydiff.py: configurable CPython and micropython executables 2017-02-27 15:39:55 +11:00
Krzysztof Blazewicz ae116c2430 docs/Makefile: define and use PYTHON as the interpreter for CPYDIFF
User can override PYTHON executable before running script,
gen-cpydiff.py works only with Python3 and most systems register
its executable as 'python3'.
2017-02-27 15:39:55 +11:00
Damien George ad81a2e6cf minimal: Add ability and description to build without the compiler. 2017-02-27 15:09:15 +11:00
Damien George 3b2fd4df31 lib/utils/pyexec: Allow to compile when the uPy compiler is disabled. 2017-02-27 15:02:32 +11:00
Paul Sokolovsky e2f1a8a7ee docs/uhashlib: Provide port-neutral description.
TODO: Remove WiPy-specific chunks.
2017-02-26 00:55:33 +03:00
Paul Sokolovsky 0982884655 extmod/modurandom: Use mp_raise_ValueError().
For the standard unix x86_64 build, this saves 11 bytes on object file
level, but no difference in executable size due to (bloaty) code alignment.
2017-02-24 10:04:23 -05:00
Paul Sokolovsky 4b3da60324 py/runtime: mp_raise_msg(): Accept NULL argument for message.
In this case, raise an exception without a message.

This would allow to shove few code bytes comparing to currently used
mp_raise_msg(..., "") pattern. (Actual savings depend on function code
alignment used by a particular platform.)
2017-02-24 09:57:25 -05:00
Damien George 6771adc75f esp8266/mpconfigport.h: Enable help('modules') feature. 2017-02-24 18:26:51 +11:00
Damien George 8400d0461d drivers/display/lcd160cr: Fix bug with save_to_flash method. 2017-02-24 17:22:57 +11:00
Paul Sokolovsky f5ee4d95a9 cc3200/moduos: Remove uos.sep, as it's strictly optional.
In MicroPython, the path separator is guaranteed to be "/", extra unneeded
things take precious code space (in the port which doesn't have basic things
like floating-port support).
2017-02-23 22:10:58 -08:00
Damien George f615d82d5b py/parse: Simplify handling of errors by raising them directly.
The parser was originally written to work without raising any exceptions
and instead return an error value to the caller.  But it's now required
that a call to the parser be wrapped in an nlr handler, so we may as well
make use of that fact and simplify the parser so that it doesn't need to
keep track of any memory errors that it had.  The parser anyway explicitly
raises an exception at the end if there was an error.

This patch simplifies the parser by letting the underlying memory
allocation functions raise an exception if they fail to allocate any
memory.  And if there is an error parsing the "<id> = const(<val>)" pattern
then that also raises an exception right away instead of trying to recover
gracefully and then raise.
2017-02-24 14:56:37 +11:00
Damien George 5255255fb9 py: Create str/bytes objects in the parser, not the compiler.
Previous to this patch any non-interned str/bytes objects would create a
special parse node that held a copy of the str/bytes data.  Then in the
compiler this data would be turned into a str/bytes object.  This actually
lead to 2 copies of the data, one in the parse node and one in the object.
The parse node's copy of the data would be freed at the end of the compile
stage but nevertheless it meant that the peak memory usage of the
parse/compile stage was higher than it needed to be (by an amount equal to
the number of bytes in all the non-interned str/bytes objects).

This patch changes the behaviour so that str/bytes objects are created
directly in the parser and the object stored in a const-object parse node
(which already exists for bignum, float and complex const objects).  This
reduces peak RAM usage of the parse/compile stage, simplifies the parser
and compiler, and reduces code size by about 170 bytes on Thumb2 archs,
and by about 300 bytes on Xtensa archs.
2017-02-24 13:43:43 +11:00
Damien George f62503dc47 tests/micropython: Add test for consts that are bignums. 2017-02-24 13:08:18 +11:00
Damien George 74f4d2c659 py/parse: Allow parser/compiler consts to be bignums.
This patch allows uPy consts to be bignums, eg:

    X = const(1 << 100)

The infrastructure for consts to be a bignum (rather than restricted to
small integers) has been in place for a while, ever since constant folding
was upgraded to allow bignums.  It just required a small change (in this
patch) to enable it.
2017-02-24 13:03:44 +11:00
Damien George 1034d9acc8 tools/gen-cpydiff.py: Set the Python import path to find test modules. 2017-02-22 15:50:58 +11:00
Damien George 047af9b10b cc3200: Remove socket.timeout class, use OSError(ETIMEDOUT) instead.
socket.timeout is a subclass of OSError, and using the latter is more
efficient than having a dedicated class.  The argument of OSError is
ETIMEDOUT so the error can be distinguished from other kinds of
OSErrors.  This follows how the esp8266 port does it.
2017-02-22 15:08:32 +11:00
Damien George d03f089baa cc3200/mods/modusocket: Init vars to 0 to silence compiler warnings.
Some compilers can't analyse the code to determine that these variables
are always set before being used.
2017-02-22 14:58:37 +11:00
Damien George e859ddf3e1 cc3200: Enable uerrno module with short, custom list of error codes.
Since we recently replaced the OSError string messages with simple error
codes, having the uerrno module gets back some user friendly error
messages.  The total code size (after removing strings, replacing with
uerrno module) is decreased.
2017-02-22 12:58:11 +11:00
Damien George b1b090255c py/moduerrno: Make list of errno codes configurable.
It's configurable by defining MICROPY_PY_UERRNO_LIST.  If this is not
defined then a default is provided.
2017-02-22 12:58:11 +11:00
Damien George f563406d2e py/moduerrno: Make uerrno.errorcode dict configurable.
It's configured by MICROPY_PY_UERRNO_ERRORCODE and enabled by default
(since that's the behaviour before this patch).

Without this dict the lookup of errno codes to strings must use the
uerrno module itself.
2017-02-22 12:58:11 +11:00
Damien George 22a6344ebe cc3200: When raising OSError's use MP_Exxx as arg instead of a string. 2017-02-22 12:58:11 +11:00
Damien George 8bb8e97dfe cc3200: Convert to using uPy internal errno numbers. 2017-02-22 12:58:11 +11:00
Damien George 85ab469c64 cc3200: Move wlan socket glue functions from modwlan to modusocket.
It saves about 400 bytes of code space because the functions can now be
inlined.
2017-02-22 11:29:19 +11:00
Damien George 71ae3f389d cc3200: Remove remaining references to std.h. 2017-02-21 18:01:43 +11:00
Damien George b0a6dda115 drivers/display/lcd160cr: Fix bugs with lcd.get_pixel().
Fixes issues #2880 and #2881.
2017-02-21 17:40:34 +11:00
Damien George 8c5988bf61 cc3200/mods/modwlan: Add int casts to silence compiler warnings. 2017-02-21 17:29:40 +11:00
Damien George 0258f819bd cc3200/mods/modwlan: Allow antenna diversity to be fully compiled out. 2017-02-21 17:29:02 +11:00
Damien George a162832b1a cc3200/mods/modwlan: Make multi-threaded a proper compile-time option. 2017-02-21 17:28:14 +11:00
Damien George 26ddd4b621 cc3200/mods/modwlan: Remove unused header includes; simplify others. 2017-02-21 17:27:17 +11:00
Damien George 1c35270667 cc3200: Remove util/std.h, can just use stdio.h instead. 2017-02-21 17:26:21 +11:00
Damien George d9f7120af1 cc3200: Use simplelink API instead of emulated BSD API.
Most of cc3200 uses explicit simplelink calls anyway, and this means there
are no longer any clashes with macros from the C stdlib.
2017-02-21 17:24:12 +11:00
Damien George 29551ba566 cc3200: Move stoupper to ftp.c and define in terms of unichar_toupper.
ftp.c is the only user of this function so making it static in that file
allows it to be inlined.  Also, reusing unichar_toupper means we no longer
depend on the C stdlib for toupper, saving about 300 bytes of code space.
2017-02-21 17:20:58 +11:00
Damien George 465a604547 tests/cpydiff: Add a test for storing iterable to a list slice. 2017-02-20 17:22:12 +11:00
Rami Ali 3218ccd70d docs: Modify Makefile and indexes to generate cPy-differences pages. 2017-02-20 17:14:35 +11:00
Rami Ali b7fa63c7ce tools: Add gen-cpydiff.py to generate docs differences.
This patch introduces the a small framework to track differences between
uPy and CPython.  The framework consists of:

- A set of "tests" which test for an individual feature that differs between
  uPy and CPy.  Each test is like a normal uPy test in the test suite, but
  has a special comment at the start with some meta-data: a category (eg
  syntax, core language), a human-readable description of the difference, a
  cause, and a workaround.  Following the meta-data there is a short code
  snippet which demonstrates the difference.  See tests/cpydiff directory
  for the initial set of tests.

- A program (this patch) which runs all the tests (on uPy and CPy) and
  generates nicely-formated .rst documenting the differences.

- Integration into the docs build so that everything is automatic, and the
  differences appear in a way that is easy for users to read/reference (see
  latter commits).

The idea with using this new framework is:

- When a new difference is found it's easy to write a short test for it,
  along with a description, and add it to the existing ones.  It's also easy
  for contributors to submit tests for differences they find.

- When something is no longer different the tool will give an error and
  difference can be removed (or promoted to a proper feature test).
2017-02-20 17:14:34 +11:00
Rami Ali 86c7507233 tests/cpydiff: Add initial set of tests for uPy-CPython differences.
These tests are intended to fail, as they provide a programatic record of
differences between uPy and CPython.  They also contain a special comment
at the start of the file which has meta-data describing the difference,
including known causes and known workarounds.
2017-02-20 16:50:34 +11:00
Damien George 89267886cc py/objlist: For list slice assignment, allow RHS to be a tuple or list.
Before this patch, assigning anything other than a list would lead to a
crash.  Fixes issue #2886.
2017-02-20 15:09:59 +11:00
Paul Sokolovsky 6fc6f10b1e tests/heapalloc_exc_raise.py: Heap alloc test for raising/catching exc. 2017-02-20 04:22:32 +03:00
Paul Sokolovsky 3d739eb398 zephyr/README: Network startup issues with frdm_k64f resolved.
But leave a generic warning that users should be aware of Zephyr's
limitations/issues for a board they use.
2017-02-17 22:08:42 +03:00
Damien George d80df91ef2 docs/library/lcd160cr: Mention the valid values for set_power() method. 2017-02-17 16:57:22 +11:00
Stephan Brauer 8f3e07f17d drivers/display/lcd160cr: Use correct variable in set_power(). 2017-02-17 16:54:05 +11:00