Commit Graph

2095 Commits

Author SHA1 Message Date
Dave Hylands 117c46d9eb Add input command for unix 2014-05-07 07:19:51 -07:00
Damien George 1dd46fafbd Merge pull request #581 from stinos/windows-math
windows: Enable math module
2014-05-07 12:11:32 +01:00
stijn 3ce10935f0 windows: Enable math module 2014-05-07 12:39:02 +02:00
Paul Sokolovsky 0ef015b253 stream: Make non-blcoking stream support configurable.
Enable only on unix. To avoid unpleasant surprises with error codes.
2014-05-07 02:25:45 +03:00
Paul Sokolovsky 6c62e7257f unix modsocket: Add comments re: recv() vs read(), etc. semantics. 2014-05-07 02:17:14 +03:00
Paul Sokolovsky b9be45e421 stream: Use standard name of DEFAULT_BUFFER_SIZE. 2014-05-07 02:17:14 +03:00
Paul Sokolovsky 6e73143de8 stream: Add compliant handling of non-blocking readall(). 2014-05-07 02:17:14 +03:00
Paul Sokolovsky a592104acd stream: Add compliant handling of non-blocking read()/write().
In case of empty non-blocking read()/write(), both return None. read()
cannot return 0, as that means EOF, so returns another value, and then
write() just follows. This is still pretty unexpected, and typical
"if not len:" check would treat this as EOF. Well, non-blocking files
require special handling!

This also kind of makes it depending on POSIX, but well, anything else
should emulate POSIX anyway ;-).
2014-05-07 02:17:14 +03:00
Damien George 93afa230a4 py, parser: Add commented-out code to discard doc strings.
Doesn't help with RAM reduction because doc strings are interned as soon
as they are encountered, which is too soon to do any optimisations on
them.
2014-05-06 21:44:11 +01:00
Damien George c53b408f28 Merge branch 'master' of https://github.com/micropython/micropython
Conflicts:
	py/argcheck.c
	py/objenumerate.c
	py/runtime.h
2014-05-06 16:52:35 +00:00
Damien George 491cbd6a7c py: Add keyword arg support to enumerate constructor.
Need to have a policy as to how far we go adding keyword support to
built ins.  It's nice to have, and gets better CPython compatibility,
but hurts the micro nature of uPy.

Addresses issue #577.
2014-05-06 16:38:54 +00:00
Paul Sokolovsky b473d0ae86 py: bytes(), str(): Add NotImplementedError for kwargs.
Addresses #567.
2014-05-06 19:31:58 +03:00
Paul Sokolovsky 47d3bd3b31 py: enumerate(): Add NotImplementedError for kwargs.
Addresses #577.
2014-05-06 19:31:49 +03:00
Paul Sokolovsky 33b3a6905d stmhal: pyb: Use gc() function as defined by standard module "gc".
TODO: Get rid of this compatibility define and rely on standard module.
2014-05-06 02:28:49 +03:00
Paul Sokolovsky f9e54e0ea5 modgc: Add new module for GC-related functionality. 2014-05-06 02:28:49 +03:00
stijn 912ca7701d py: Comment exc_state member from mp_obj_gen_instance_t as it gives trouble
...to some compilers who can't process 2 zero-sized arrays in structs. It's
never referenced directly anyway.

See disussion on #568 as well.
2014-05-05 22:56:27 +03:00
Paul Sokolovsky 179977a0da py-version.sh: Use --always option of git describe. 2014-05-05 21:28:12 +03:00
Damien George fcb347b90a Merge pull request #571 from dhylands/fix-extint-doc
Change references (in comments) of pyb.GPIO to be pyb.Pin
2014-05-05 19:03:25 +01:00
Dave Hylands 1145a0706c Change references (in comments) of pyb.GPIO to be pyb.Pin
The documentation at http://micropython.org/doc/module/pyb/ExtInt should also be
updated.
2014-05-05 10:58:38 -07:00
Damien George fa2e701e23 examples, SDdatalogger: Add more comments; reduce power consumption. 2014-05-05 14:09:23 +01:00
Damien George 2a5b3cdf82 Merge pull request #566 from turbinenreiter/master
added SDdatalogger example
2014-05-05 14:02:38 +01:00
Damien George 66e18f04d8 py: Turn down amount of RAM parser and compiler use.
There are 2 locations in parser, and 1 in compiler, where memory
allocation is not precise.  In the parser it's the rule stack and result
stack, in the compiler it's the array for the identifiers in the current
scope.  All other mallocs are exact (ie they don't allocate more than is
needed).

This patch adds tuning options (MP_ALLOC_*) to mpconfig.h for these 3
inexact allocations.

The inexact allocations in the parser should actually be close to
logarithmic: you need an exponentially larger script (absent pathological
cases) to use up more room on the rule and result stacks.  As such, the
default allocation policy for these is now to start with a modest sized
stack, but grow only in small increments.

For the identifier arrays in the compiler, these now start out quite
small (4 entries, since most functions don't have that many ids), and
grow incrementally by 6 (since if you have more ids than 4, you probably
have quite a few more, but it wouldn't be exponentially more).

Partially addresses issue #560.
2014-05-05 13:19:03 +01:00
Paul Sokolovsky f01fa458d8 tests/bench/var: Add tests for class/instance var access.
Also compared with method abstraction for accessing instance vars -
it's more than 3 times slower than accessing var directly.
2014-05-05 02:17:13 +03:00
Paul Sokolovsky aaff82afe5 tests: Add framework for comparative benchmarking.
Motivation is optimizing handling of various constructs as well as
understanding which constructs are more efficient in MicroPython.
More info: http://forum.micropython.org/viewtopic.php?f=3&t=77

Results are wildly unexpected. For example, "optimization" of range
iteration into while loop makes it twice as slow. Generally, the more
bytecodes, the slower the code.
2014-05-05 01:24:16 +03:00
Paul Sokolovsky 22a0d67c0f py-version.sh: Make it work in case no git tag is present. 2014-05-05 01:01:01 +03:00
Paul Sokolovsky 6b344d7816 py, unix: Add -v option, print bytecode dump if used.
This will work if MICROPY_DEBUG_PRINTERS is defined, which is only for
unix/windows ports. This makes it convenient to user uPy normally, but
easily get bytecode dump on the spot if needed, without constant recompiles
back and forth.

TODO: Add more useful debug output, adjust verbosity level on which
specifically bytecode dump happens.
2014-05-05 00:57:00 +03:00
Paul Sokolovsky 4187068cad showbc: Quote block name, so it was easily visible. 2014-05-04 22:42:11 +03:00
Sebastian Plamauer 98243ccca4 deleted garbage 2014-05-04 19:08:14 +02:00
Sebastian Plamauer 96e97ed2ce created SDdatalogger example 2014-05-04 19:07:17 +02:00
Damien George 5fc400ccdb stmhal: Document physical pins for SPI, I2C, UART busses. 2014-05-04 14:28:11 +01:00
Damien George cda363a036 tests, pyb: Add 'import pyb' when needed. 2014-05-04 12:40:51 +01:00
Damien George c327c0de5d unix: Remove test class and code. 2014-05-04 12:24:26 +01:00
Damien George 2c9c200494 Merge pull request #563 from turbinenreiter/patch-2
updated to use new pyb.Accel() object
2014-05-04 12:17:18 +01:00
Sebastian Plamauer c114565bfa updated to use new pyb.Accel() object 2014-05-04 13:11:16 +02:00
Damien George 113872af6f Merge pull request #561 from turbinenreiter/patch-1
updated to fit new acceleration and time/millis
2014-05-04 12:00:19 +01:00
Sebastian Plamauer 3526716a5b updated to fit new acceleration and time/millis
Changed pyb.accel() and pyb.time() to the new pyb.Accel() object and pyb.millis() function.
Also shortened the loop so the writing is finished before the USB connection messes things up.
2014-05-04 12:53:01 +02:00
Damien George 37936bebbf tools: In build-stm-latest, replace git hash with git tag. 2014-05-04 00:11:09 +00:00
Damien George 04b9147e15 Add license header to (almost) all files.
Blanket wide to all .c and .h files.  Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.

Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-03 23:27:38 +01:00
Damien George ff380c2558 Merge pull request #535 from pfalcon/blurb
Proposed license/copyright file header.
2014-05-03 22:56:50 +01:00
Damien George 75aebda809 Merge branch 'stinos-mingw-float-printf' 2014-05-03 22:44:24 +01:00
Damien George 3a01840390 windows: Argument to () function should be (void). 2014-05-03 22:43:58 +01:00
Damien George cff638a43a Merge branch 'mingw-float-printf' of github.com:stinos/micropython into stinos-mingw-float-printf 2014-05-03 22:41:40 +01:00
Damien George d5f5b2f766 py, stream: Implement readlines for a stream. 2014-05-03 22:01:32 +01:00
Damien George 5320bff32c Merge pull request #557 from cjbarnes18/device_id_in_deploy
Add device ID to deploy make target for stmhal.
2014-05-03 21:21:20 +01:00
Damien George 349e4c4a2f py: Add --dirty flag to git describe. 2014-05-03 21:15:32 +01:00
Craig Barnes c9f9e547d6 Add device ID to deploy make target for stmhal. 2014-05-03 19:51:47 +01:00
stijn 72521a1c17 mingw: Fix number of exponent digits in floating point formatting
By default mingw outputs 3 digits instead of the standard 2 so all float
tests using printf fail. Using setenv at the start of the program fixes this.
To accomodate calling platform specific initialization a
MICROPY_MAIN_INIT_FUNC macro is used which is called in mp_init()
2014-05-03 20:15:15 +02:00
Damien George 6ec835dfef Don't print git hash as well as git tag in banner. 2014-05-03 19:08:02 +01:00
Damien George 1549f17038 Merge branch 'master' of github.com:micropython/micropython 2014-05-03 19:02:47 +01:00
Damien George 977a0ce287 py: Print tag/version/git describe in uPy banner. 2014-05-03 19:02:14 +01:00