Commit Graph

2028 Commits

Author SHA1 Message Date
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
Paul Sokolovsky
fb9ca7c3aa Merge pull request #554 from stinos/mingw-realpath
mingw: Add implementation of realpath()
2014-05-03 21:01:34 +03:00
Damien George
b4bb3fdb9c Merge pull request #555 from lurch/patch-1
RTC doc fix
2014-05-03 18:44:02 +01:00
Damien George
93e51b594a stmhal: Enable cmath module. 2014-05-03 18:40:50 +01:00
Andrew Scheller
86a9a88632 Fix incorrect fix ;) 2014-05-03 18:28:11 +01:00
Damien George
bb8ba7fc90 stmhal: Add .gitignore to ignore the new build dir names. 2014-05-03 18:26:03 +01:00
Damien George
3244123031 tools: pyboard.py now acts as a command-line program to run scripts.
You can run a local script on the pyboard using:

    python pyboard.py test.py

where test.py is the local script you want to run.
2014-05-03 18:14:34 +01:00
Andrew Scheller
e9ff5570c3 Updated doc fix 2014-05-03 17:50:46 +01:00
Damien George
aad1204b8e stmhal: Change names: flash to firmware, flashboard to deploy.
Since firmware lives in a build directory which already specifies the
board name, no real reason to also have the firmware have the board
name.
2014-05-03 17:46:45 +01:00
Damien George
51315614e1 stmhal: Default build directory now includes board name.
BUILD is build-$(BOARD) by default.
2014-05-03 17:39:07 +01:00
Andrew Scheller
b569d690f5 RTC doc fix 2014-05-03 17:34:19 +01:00
Damien George
ae8feac598 stmhal: Wrap CC3000 driver in MICROPY_HW_ENABLE_CC3K.
This renames MICROPY_HW_HAS_WLAN to MICROPY_HW_ENABLE_CC3K (since it's a
driver, not a board feature) and wraps all CC3000 code in this #if.
It's disabled for all boards.
2014-05-03 17:32:55 +01:00
Damien George
9c5fc83e6a py, objtype.c: Rename class_ to instance_ following change of typedef.
This follows up 0a7e01ae3c.
2014-05-03 17:19:35 +01:00
Damien George
e69b7e8288 unix, file.c: adhere to coding conventions. 2014-05-03 17:04:31 +01:00
Damien George
41f768f3f3 tests: Add a suite of tests specifically for the pyboard.
In tests/pyb is now a suite of tests that tests the pyb module on the
pyboard.  They include expected output files because we can't run
CPython on the pyboard to compare against.

run-tests script has now been updated to allow pyboard tests to be run.
Just pass the option --pyboard.  This runs all basic, float and pyb
tests.  Note that float/math-fun.py currently fails because not all math
functions are implemented in stmhal/.
2014-05-03 16:43:27 +01:00
Damien George
baa2afbb58 stmhal: Fix typos in class documentation. 2014-05-03 16:42:27 +01:00
stijn
4cd21deebc mingw: Add implementation of realpath()
The mingw port used _fullpath() until now, but the behaviour is not exactly
the same as realpath()'s on unix; major difference being that it doesn't
return an error for non-existing files, which would bypass main's error
checking and bail out without any error message.

Also realpath() will return forward slashes only since main() relies on that.
2014-05-03 17:38:08 +02:00
Paul Sokolovsky
16d58fc787 Merge pull request #551 from stinos/closed-fd-err
CPython compatibility: raise an error for operations on a closed file de...
2014-05-03 18:02:47 +03:00