Commit Graph

4894 Commits

Author SHA1 Message Date
Paul Sokolovsky
e0f5df579b all: Make netutils.h available to all ports by default.
Generally, ports should inherit INC from py.mk, append to it, not
overwrite it. TODO: Likely should do the same for other vars too.
2015-10-19 18:32:42 +03:00
Paul Sokolovsky
8ee153f234 unix/modtime: Implement ticks_ms(), ticks_us() and ticks_diff().
All of these functions return positive small int, thus range is 2 bits less
than word size (30 bit on 32-bit systems, 62 bit on 64-bit systems).
2015-10-19 17:48:27 +03:00
Paul Sokolovsky
fd379db286 unix/modtime: Implement sleep_ms(), sleep_us(). 2015-10-19 17:48:27 +03:00
Damien George
096d1e4512 py: Add lsl/lsr/asr opcode support to inline Thumb2 assembler. 2015-10-19 14:26:19 +01:00
Paul Sokolovsky
949c5c9180 unix/unix_mphal: Implement HAL_Delay() and HAL_GetTick(). 2015-10-19 00:31:37 +03:00
Paul Sokolovsky
7799410950 py/stream: Allow to reuse is_nonblocking_error(). 2015-10-18 15:39:33 +03:00
Paul Sokolovsky
2ca7b05552 unix/modos: Checking config macros requires mpconfig.h. 2015-10-18 03:05:47 +03:00
Paul Sokolovsky
f8e9ef5cd0 unix/modos: Guard sys/statvfs.h include with MICROPY_PY_OS_STATVFS check.
E.g. Windows lacks this header.
2015-10-18 02:54:20 +03:00
danicampora
020386b61c docs: In top index fix machine module link for the WiPy. 2015-10-18 00:31:12 +02:00
Paul Sokolovsky
c3000b6f69 unix/modos: Add statvfs() function.
Another function (like stat) which is problematic to deal with on ABI level
(FFI), as struct statvfs layout may differ unpredictably between OSes and
even different versions of a same OS. So, implement it in C, returning a
10-element tuple of f_bsize, f_frsize, f_blocks, f_bfree, f_bavail, f_files,
f_ffree, f_favail, f_flag, f_namemax. This is exactly the order described
in Python3 docs, https://docs.python.org/3/library/os.html#os.statvfs
(but note that os.statvfs() should make these values available as
attributes).
2015-10-18 01:21:23 +03:00
Paul Sokolovsky
6ec6f51326 unix: Build libffi in a directory which is gitgnored.
To avoid "-dirty" version previous and spurious "modified" output from
git status, etc.
2015-10-18 00:44:45 +03:00
danicampora
4542643025 docs: Update all WiPy docs to reflect the new API. 2015-10-17 23:29:04 +02:00
danicampora
fca3308cc3 cc3200: Improvements to terminal duplication. 2015-10-17 23:21:44 +02:00
danicampora
e19dfe1c32 cc3200: In scan results rename 'auth' field to 'sec'.
As defined by the new API, since 'auth' is actually a  tuple
composed by the security type and the key.
2015-10-17 23:21:44 +02:00
Dave Hylands
affcbe4139 stmhal: Make USB serial number actually be unique. 2015-10-17 22:02:57 +01:00
Paul Sokolovsky
6a515b95a8 tools/upip: Update to 0.5.9.
MICROPYPATH environment variable is now honored, package are installed to
first path specified in it.
2015-10-17 20:16:41 +03:00
Paul Sokolovsky
c13be69a8e lib/libffi: Add libffi as a submodule.
This allows to build libffi from source together with micropython, and is
useful for cross-compilation. Support for this was already merged
previously, to use:

make libffi
make MICROPY_STANDALONE=1

(To both commands appropriate cross-compilition flags can be added).
2015-10-17 15:52:35 +03:00
Damien George
035a0a2b6e py: Add support for _ in REPL to hold last computed value.
Only available when MICROPY_CAN_OVERRIDE_BUILTINS is enabled.
2015-10-17 12:55:25 +01:00
Damien George
e813541e3f py: Add option for inline assembler to support ARMv7-M instructions.
Cortex-M0, M0+ and M1 only have ARMv6-M Thumb/Thumb2 instructions.  M3,
M4 and M7 have a superset of these, named ARMv7-M.  This patch adds a
config option to enable support of the superset of instructions.
2015-10-16 22:08:57 +01:00
Damien George
4bf3f2d3c0 py: Fix with+for+return bug by popping for-iter when unwinding exc stack.
Addresses issue #1182.
2015-10-15 17:48:28 +01:00
Damien George
556c8a9a4f unix: Fix coverage build now that mp_plat_print uses write. 2015-10-15 00:23:03 +01:00
Damien George
4300c7dba2 py: Remove dependency on printf/fwrite in mp_plat_print.
See issue #1500.
2015-10-15 00:05:55 +01:00
Paul Sokolovsky
74d0df7324 unix: Allow to build against Android down to 1.5.
Bionic libc in Android 1.5 missed log2() and nan() functions.
2015-10-15 00:11:09 +03:00
Damien George
d7e3b36a09 py/compile: Remove unnecessary label in compilation of for statement. 2015-10-14 15:51:12 +01:00
Damien George
fcce1483fa py: Fix build of ARM native emitter due to recent viper changes.
Addresses #1510.
2015-10-14 12:40:54 +01:00
Paul Sokolovsky
2430dfac31 tests/jni: Start adding modjni tests.
These are currently not intended to run with the rest of testsuite, as
they require dependencies and special environment setup anyway (drafted
in tests/jni/README).
2015-10-14 00:56:01 +03:00
Paul Sokolovsky
fe29cc192d unix/modjni: Add iteration support for Java List objects.
Using generic iteration-via-subscription support (TODO: factor it out for
reuse).
2015-10-14 00:36:03 +03:00
Paul Sokolovsky
41eb705477 unix/modjni: call_method: Check for Java exception after method return. 2015-10-14 00:25:10 +03:00
Damien George
2ec835f572 tests: Add more tests for viper 16/32-bit load/store, and ellipsis. 2015-10-13 18:24:36 +01:00
Damien George
59a41e8fcd py/qstr: Fix calc of qstr memory usage, due to new qstr chunk allocation. 2015-10-13 15:52:06 +01:00
Damien George
d6442407f5 docs: Fix formatting of DAC code examples. 2015-10-13 14:44:00 +01:00
Damien George
b5c43be135 stmhal: Allow to set bits resolution for DAC; 8 is default, can have 12.
This patch allows to configure the DAC resolution in the constructor and
in the init function, eg:

dac = DAC(1, bits=12).

The default resolution is 8 bits for backwards compatibility.  The bits
sets the maximum value accepted by write and write_timed methods, being
2**bits - 1.

When using write_timed with 12-bit resolution, the input buffer is
treated as an unsigned half-word array, typecode 'H'.

See PR #1130 for discussion.
2015-10-13 14:33:04 +01:00
Damien George
b8f9ac5411 py: Implement ptr32 load and store in viper emitter. 2015-10-13 00:50:17 +01:00
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