Commit Graph

4561 Commits

Author SHA1 Message Date
Paul Sokolovsky
21f43ba9b0 unix/modtermios: tcsetattr: If 0 passed for "when" param, treat as TCSANOW.
As we dn't export constants for TCSANOW, etc., zero makes a good "don't
care" param, and now it will work also under Android Bionic and any other
libc.
2015-10-13 00:37:55 +03:00
Damien George
3c9c3687d6 py: Add support to call __init__ from a builtin module on first import. 2015-10-12 13:46:01 +01:00
Paul Sokolovsky
408b74d74c py: Allow to to build MicroPython as a static library.
The whole current port gets slurped into a static lib named
"libmicropython.a". Maybe that's not ideal, but at least something
to start with.
2015-10-12 15:32:06 +03:00
Damien George
fdfcee7b1e py/parse: Make parser error handling cleaner, less spaghetti-like. 2015-10-12 12:59:18 +01:00
Damien George
64f2b213bb py: Move constant folding from compiler to parser.
It makes much more sense to do constant folding in the parser while the
parse tree is being built.  This eliminates the need to create parse
nodes that will just be folded away.  The code is slightly simpler and a
bit smaller as well.

Constant folding now has a configuration option,
MICROPY_COMP_CONST_FOLDING, which is enabled by default.
2015-10-12 12:58:45 +01:00
Paul Sokolovsky
91fc075a33 py/objarray: Allow to create array of void pointers, as extension to CPython.
Using 'P' format specifier (matches struct module). This is another shortcut
for FFI, just as previously introduced "array of objects" ('O').
2015-10-12 10:13:51 +03:00
Damien George
3aa7dd23c9 unix: Add exit and paste-mode hints to shell startup banner.
Thanks to @nyov for the initial patch.
2015-10-12 00:19:00 +01:00
nyov
fccbe9aa4d README.md: Document "Ctrl+D" shell exit. 2015-10-12 00:15:41 +01:00
Damien George
0334058fa4 Rename "Micro Python" to "MicroPython" in REPL, help, readme's and misc. 2015-10-12 00:06:25 +01:00
Damien George
6206f431cf stmhal: Enable REPL auto indent; document paste mode in help(). 2015-10-11 23:33:46 +01:00
Damien George
46a1102852 repl: Add paste mode to friendly REPL, entered via CTRL-E.
Use CTRL-E to enter paste mode.  Prompt starts with "===" and accepts
all characters verbatim, echoing them back.  Only control characters are
CTRL-C which cancels the input and returns to normal REPL, and CTRL-D
which ends the input and executes it.  The input is executed as though
it were a file.  The input is not added to the prompt history.
2015-10-11 23:30:22 +01:00
Paul Sokolovsky
1b586f3a73 py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming. 2015-10-11 15:18:15 +03:00
Paul Sokolovsky
53ca6ae1f3 py/makeqstrdata.py: Catch and report case of empty input file.
The usual cause would be that a cross-compiler for a port is not in PATH.
2015-10-11 11:09:57 +03:00
Anmol Sarma
95b352064e unix/modsocket: Fix usage of pointers to locals outside scope 2015-10-10 17:29:26 +05:30
Damien George
24652228af drivers/sdcard: Allow up to 5 retries to initialise SD card.
Apparently some cards need more than 2 retries.  See issue #1482.
2015-10-10 00:07:40 +01:00
Damien George
845b5a2a58 docs: Describe properly how MCU can be woken from pyb.standby() state. 2015-10-10 00:03:14 +01:00
Paul Sokolovsky
7381b7ac71 unix/modjni: py2jvalue: Support bool and None values. 2015-10-10 01:20:48 +03:00
Peter Hinch
0e87bc7be6 tests: In pyb RTC tests, check wakeup register values. 2015-10-09 23:06:05 +01:00
Dave Hylands
01d64914c5 stmhal: Fix USB CDC-only mode under Windows.
This fix adds PIDs 9801 and 9802 to the pybcdc.inf file.

When in CDC only mode, it presents itself as a Communcations
device rather than as a composite device. Presenting as a
composite device with only the CDC interface seems to confuse
windows.

To test and make sure that the correct pybcdc.inf was being used,
I used USBDeview from http://www.nirsoft.net/utils/usb_devices_view.html
to uninstall any old pyboard drivers (Use Control-F and search
for pyboard). I found running USBDeview as administrator worked best.

Installing the driver in CDC+MSC mode first is recommended (since the
pybcdc.inf file in on the internal flash drive). Then when you switch
modes everything seems to work properly.

I used https://github.com/dhylands/upy-examples/blob/master/boot_switch.py
to easily switch the pyboard between the various USB modes for testing.
2015-10-09 00:18:01 +01:00
Damien George
366239b8b9 py/parse: Factor logic when creating parse node from and-rule. 2015-10-08 23:13:18 +01:00
Paul Sokolovsky
02041bf2e0 unix/modjni: jvalue2py() is currently not used.
Not remove so far, may be needed later.
2015-10-09 00:27:27 +03:00
Paul Sokolovsky
216b6a494e unix/modjni: Allow to access fields of objects. 2015-10-08 16:57:02 +03:00
Damien George
b948de36fb py: Don't generate unnecessary parse nodes for assignment or kwargs.
This patch eliminates the need for a nested parse node for assignments
and keyword arguments.  It saves a little bit of RAM when parsing.
2015-10-08 14:26:01 +01:00
Damien George
4fb5ff86ee tests: Add test for evaluation order of dictionary key/value pairs.
In Python 3.4 the value is evaluated before the key.  In Python 3.5 it's
key then value.
2015-10-08 13:15:07 +01:00
Damien George
9f5f156b9d py/emitnative: Raise ViperTypeError for unsupported unary ops. 2015-10-08 13:08:59 +01:00
Damien George
7e12a601b8 py/compile: Fix edge case when constant-folding negation of integer.
Also adds tests specifically for testing constant folding.
2015-10-08 13:02:00 +01:00
Damien George
2a8d7ee0f8 stmhal: Fix RTC.wakeup so it correctly calculates WUT for large periods.
Thanks to Peter Hinch.  Addresses issue #1488.
2015-10-08 12:41:12 +01:00
Paul Sokolovsky
fd38799049 unix/modjni: After Call*Method(), Java exception should always be checked.
OpenJDK seemed to return NULL in case of exception, but Dalvik returns
arbitrary value, so skip such "optimizations".
2015-10-07 07:40:29 +03:00
Damien George
fa391eed9d stmhal: In RTC.wakeup, fix setting of wucksel to get correct period.
Thanks to Peter Hinch.  See issue #1490.
2015-10-06 23:39:57 +01:00
Radomir Dopieralski
37ab061f4d docs: Update esp8266 documentation to match the code.
* Move the esp.status() to network module.
* Describe the wifi.isconnected() method.
* Describe esp.mac(), esp.wifi_mode(), esp.phy_mode(), esp.sleep_type(),
  esp.deepsleep(), and esp.flash_id() functions.
2015-10-06 23:25:35 +01:00
Paul Sokolovsky
aaa8867d4a modussl: SSL socket wrapper module based on axTLS. 2015-10-06 18:10:39 +03:00
Paul Sokolovsky
062bd81814 tests/basics/builtin_range: PEP8 fixes. 2015-10-05 20:02:52 +03:00
Paul Sokolovsky
f4d55c91fe lib/axtls: Update submodule, adds .gitignore . 2015-10-04 15:55:37 +03:00
Paul Sokolovsky
326ff54649 unix: Add support for building axtls dependency lib. 2015-10-04 02:39:01 +03:00
Paul Sokolovsky
90a36942b4 lib/axtls: Add axtls git submodule, dependency of modussl.
From https://github.com/pfalcon/axtls , branch micropython.
2015-10-04 02:39:00 +03:00
Paul Sokolovsky
1ea4b77a9a unix/modjni: jclass.__str__/__repr__: Return Java .toString() value. 2015-10-04 01:57:07 +03:00
Damien George
0496de26d3 py: Allow to enable inline assembler without native emitter. 2015-10-03 17:07:54 +01:00
Paul Sokolovsky
f22be4ebd9 unix/modjni: jobject.__str__/__repr__: Return Java .toString() value. 2015-10-03 08:58:46 -07:00
Damien George
34f26ea862 tests: Allow tests to pass against CPython 3.5.
All breaking changes going from 3.4 to 3.5 are contained in
basics/python34.py.
2015-10-02 13:01:47 +01:00
Paul Sokolovsky
9e0a3d46b6 unix/modjni: Convert Java's IndexOutOfBoundsException to Python's IndexError. 2015-10-02 00:22:09 -07:00
Damien George
90b1cc5103 minimal: Tune parser chunk allocation policy for very small heap. 2015-10-02 00:33:26 +01:00
Damien George
58e0f4ac50 py: Allocate parse nodes in chunks to reduce fragmentation and RAM use.
With this patch parse nodes are allocated sequentially in chunks.  This
reduces fragmentation of the heap and prevents waste at the end of
individually allocated parse nodes.

Saves roughly 20% of RAM during parse stage.
2015-10-02 00:11:11 +01:00
Damien George
e5635f4ab3 py: Catch all cases of integer (big and small) division by zero. 2015-10-01 22:48:48 +01:00
Damien George
2065373f67 py/mpz: Fix bignum anding of large negative with smaller positive int. 2015-10-01 22:35:06 +01:00
Damien George
a81539db25 tests: Add further tests for mpz code. 2015-10-01 18:49:37 +01:00
Damien George
2f4e8511cd py/mpz: Force rhs of mpz_shl_inpl/mpz_shr_inpl to be unsigned.
Python semantics are that rhs of shift must be non-negative, so there's
no need to handle negative values in the underlying mpz implementation.
2015-10-01 18:01:37 +01:00
Damien George
4c02e54298 py/mpz: Raise NotImplError instead of failing assertion. 2015-10-01 17:57:36 +01:00
Damien George
5f3c3ec5e6 py/parsenum: Provide detailed error for int parsing with escaped bytes.
This patch adds more fine grained error message control for errors when
parsing integers (now has terse, normal and detailed).  When detailed is
enabled, the error now escapes bytes when printing them so they can be
more easily seen.
2015-10-01 17:18:12 +01:00
Paul Sokolovsky
c4489a0543 unix/modjni: Propagate Java exceptions on list access. 2015-10-01 01:20:56 -07:00
Paul Sokolovsky
0eba162ab5 unix/modjni: Fix method argument matching. 2015-09-30 00:55:09 -07:00