Commit Graph

8059 Commits

Author SHA1 Message Date
Paul Sokolovsky
5c312861a6 unix/Makefile: Enable frozen bytecode modules dir. 2017-05-12 18:31:22 +03:00
Paul Sokolovsky
ddf0b7dbc3 esp8266/scripts: Move initsetup & port_diag tools to modules/. 2017-05-12 17:58:50 +03:00
Paul Sokolovsky
e9308c189a esp8266/scripts: Move drivers/modules to modules/ (frozen bytecode). 2017-05-12 17:57:23 +03:00
Paul Sokolovsky
5f7ce2a1ca esp8266/modules/flashbdev: Reserve one sector for native code storage. 2017-05-12 16:08:54 +03:00
Paul Sokolovsky
3e05df7fd1 esp8266/modesp: flash_user_start: Use value from linker script.
Make esp8266_common.ld export size reserved to all code segments, and use
that in esp.flash_user_start() implementation.
2017-05-12 16:00:05 +03:00
Paul Sokolovsky
0987ad5e30 esp8266/esp8266.ld, esp8266_ota.ld: Grow main firmware size by 32KB.
To accommodate both system and user frozen modules.
2017-05-12 16:00:05 +03:00
Tom Collins
760aa0996f tests/basics/lexer: Add line continuation tests for lexer.
Tests for an issue with line continuation failing in paste mode due to the
lexer only checking for \n in the "following" character position, before
next_char() has had a chance to convert \r and \r\n to \n.
2017-05-12 15:14:25 +10:00
Tom Collins
6f56412ec3 py/lexer: Process CR earlier to allow newlines checks on chr1.
Resolves an issue where lexer failed to accept CR after line continuation
character.  It also simplifies the code.
2017-05-12 15:14:24 +10:00
Paul Sokolovsky
5feeba8897 examples/hwapi/hwconfig*: Use inline Signal() args where possible. 2017-05-12 01:19:13 +03:00
Damien George
1d8c3f4cff mpy-cross/Makefile: Override undefine any inherited variables.
This is a temporary hack to allow othe Makefiles to build mpy-cross
recursively.
2017-05-11 23:40:16 +10:00
Damien George
a1f254028d py/mkrules.mk: Add dependency of .mpy files upon mpy-cross.
This ensures that mpy-cross is automatically built (and is up-to-date) for
ports that use frozen bytecode.  It also makes sure that .mpy files are
re-built if mpy-cross is changed.
2017-05-11 23:40:16 +10:00
Damien George
6d221fe284 docs/library/uos: Add description of uos.ilistdir() function. 2017-05-10 12:44:21 +10:00
Damien George
d70f688f25 extmod/vfs: Use MP_S_IFDIR, MP_S_IFREG consts instead of magic numbers. 2017-05-10 12:30:34 +10:00
Damien George
f1609bc843 ports: Add ilistdir in uos module. 2017-05-10 12:13:53 +10:00
Damien George
852c215d76 tests/extmod/vfs: Update tests to reflect new ilistdir() method. 2017-05-10 11:39:29 +10:00
Damien George
d4cd4831b0 extmod/vfs_fat: Replace listdir() with implementation of ilistdir().
VfsFat no longer has the listdir() method.  Rather, if listdir()
functionality is needed then one should use uos.listdir() which will call
VfsFat.ilistdir().
2017-05-10 11:39:28 +10:00
Damien George
87283c1974 extmod/vfs: Implement mp_vfs_ilistdir().
uos.ilistdir() is the core function, returning an iterator that yields
3-tuples.  uos.listdir() is implemented in terms of ilistdir().
2017-05-10 11:39:28 +10:00
Paul Sokolovsky
edc02bd952 unix/main: Implement -m option for packages. 2017-05-09 14:22:21 +03:00
Damien George
9bd67d9fbc tests/extmod: Make some vfs tests fully unmount FSs before running.
Otherwise the existing FSs can interfere with the tests, and in some
cases the tests can write to the real FS on the device.
2017-05-09 15:50:40 +10:00
Tom Collins
d00d062af2 tests/basics/lexer: Add lexer tests for input starting with newlines. 2017-05-09 14:48:00 +10:00
Tom Collins
2998647c4e py/lexer: Simplify lexer startup by using dummy bytes and next_char().
Now consistently uses the EOL processing ("\r" and "\r\n" convert to "\n")
and EOF processing (ensure "\n" before EOF) provided by next_char().

In particular the lexer can now correctly handle input that starts with CR.
2017-05-09 14:43:23 +10:00
Damien George
e711e2d44a tests/basics: Add memoryview test for big ints. 2017-05-09 10:49:19 +10:00
Damien George
2e9e14980d tests/basics: Update array test for big-int with lL typecodes. 2017-05-09 10:46:43 +10:00
Damien George
6cfa61a4cc py/binary: Handle storing big-ints to all arrays types.
Prior to this patch only 'q' and 'Q' type arrays could store big-int
values.  With this patch any big int that is stored to an array is handled
by the big-int implementation, regardless of the typecode of the array.
This allows arrays to work with all type sizes on all architectures.
2017-05-09 10:41:00 +10:00
Paul Sokolovsky
4a4490ffcc py/modio: resource_stream: Implement "package" param handling. 2017-05-06 18:42:35 +03:00
Paul Sokolovsky
c1e0eb7afe unix/main: Don't allow to specify too small heap size.
This will lead to crash like:

FATAL: uncaught NLR 80a5420

On x86_32, the minimum heap size is smaller, but not 2 times, so just
use value which works for x86_64.
2017-05-06 11:43:37 +03:00
Damien George
0986675451 stmhal: Convert all module and method tables to use MP_ROM macros. 2017-05-06 17:03:40 +10:00
Damien George
084824f866 tests: Move super-as-local test from cpydiff to basic tests.
It's now possible to use the name "super" as a local variable.
2017-05-06 11:01:57 +10:00
Damien George
dce7dd4259 tests/micropython: Add test for int.from_bytes with many zero bytes. 2017-05-06 10:29:09 +10:00
Damien George
58bb73e010 py/objint: In int.from_bytes, only create big-int if really needed.
This patch ensures that int.from_bytes only creates a big-int if necessary,
by checking the value for a small-int overflow as it's being parsed.
2017-05-06 10:29:09 +10:00
Tom Collins
288ea06e7c lib/utils/pyexec: Update event-driven REPL to match non-event REPL.
Don't print dupe ">>> " prompt when starting event-driven REPL.  Clear
incomplete line in transition from raw to friendly REPL.
2017-05-05 22:15:47 +10:00
Damien George
e62235f8c7 esp8266: Change default settings to mount flash at root dir. 2017-05-05 20:15:10 +10:00
Damien George
1b3e372418 tests/extmod: Add some more VFS tests. 2017-05-05 20:15:10 +10:00
Damien George
6c8b57a902 tests/extmod: Add more tests for VFS FAT. 2017-05-05 20:15:10 +10:00
Damien George
c9a3a68a49 extmod/vfs: Allow a VFS to be mounted at the root dir.
This patch allows mounting of VFS objects right at the root directory, eg
os.mount(vfs, '/').  It still allows VFS's to be mounted at a path within
the root, eg os.mount(vfs, '/flash'), and such mount points will override
any paths within a VFS that is mounted at the root.
2017-05-05 20:15:10 +10:00
Paul Sokolovsky
d4c070415a tools/upip: Upgrade to 1.2.
Memory optimizations and error handling improvements.
2017-05-05 13:12:19 +03:00
Paul Sokolovsky
12ea06567c tests/cpydiff/core_function_unpacking: Fill in workaround. 2017-05-04 00:48:48 +03:00
Paul Sokolovsky
92657c671f tests/cpydiff/core_import_split_ns_pkgs: Test for split namespace packages. 2017-05-03 17:16:19 +03:00
Paul Sokolovsky
3923f96dc6 tests/cpydiff/core_import_path: Test showing difference in package.__path__. 2017-05-03 12:22:53 +03:00
stijn
ab4a8618cf msvc: Workaround parser bug in older MSBuild versions
Versions prior to v14.0 have a bug in parsing item functions when used
within a condition: https://github.com/Microsoft/msbuild/issues/368.
Since commit [db9c2e3] this results in an error when building MicroPython
with for example VS2013.
Fix this by creating an intermediate property.
2017-05-03 10:41:53 +10:00
stijn
5b57ae985f mpy-cross: Fix compiler detection for including windows/fmode.c
fmode.c should only be included for builds targetting 'pure' windows, i.e.
msvc or mingw builds but not when using msys or cygwin's gcc (see #2298).
Just checking if the OS is windows and UNAME doesn't have msys stil leaves
the gate open for builds with cygwin's gcc since UNAME there is e.g.
CYGWIN_NT-6.1-WOW.
Fix this by checking for 'mingw' explicitly in the compiler version; both
gcc and clang have the -dumpmachine flag so the check should be ok for
all platforms.
2017-05-03 10:37:51 +10:00
Paul Sokolovsky
7d4ba9d257 tests/io/resource_stream: Add test for uio.resource_stream(). 2017-05-03 01:47:14 +03:00
Paul Sokolovsky
d7da2dba07 py/modio: Implement uio.resource_stream(package, resource_path).
The with semantics of this function is close to
pkg_resources.resource_stream() function from setuptools, which
is the canonical way to access non-source files belonging to a package
(resources), regardless of what medium the package uses (e.g. individual
source files vs zip archive). In the case of MicroPython, this function
allows to access resources which are frozen into the executable, besides
accessing resources in the file system.

This is initial stage of the implementation, which actually doesn't
implement "package" part of the semantics, just accesses frozen resources
from "root", or filesystem resource - from current dir.
2017-05-03 01:47:08 +03:00
Paul Sokolovsky
4c2fa83f2a zephyr/main: Remove superfluous include. 2017-05-02 23:35:13 +03:00
Paul Sokolovsky
b5159a9149 zephyr/mpconfigport.h: Enable line number information for scripts. 2017-05-02 23:33:16 +03:00
Paul Sokolovsky
c1b19115e5 tests/cpydiff/core_import_prereg: Fill in cause and workaround. 2017-05-02 14:12:52 +03:00
Paul Sokolovsky
8bb84cc627 tests/cpydiff/core_function_userattr: Clarify, fill in cause and workaround. 2017-05-02 03:43:21 +03:00
Paul Sokolovsky
58ecbc7752 tests/cpydiff/core_arguments: Fill in cause/workaround. 2017-05-02 03:36:47 +03:00
Paul Sokolovsky
674da04e2e zephyr/Makefile: Add debugserver Zephyr target. 2017-05-02 01:12:02 +03:00
Paul Sokolovsky
11bc21dfa8 unix/main: Ignore SIGPIPE signal, instead make EPIPE arrive.
Do not raise SIGPIPE, instead return EPIPE. Otherwise, e.g. writing
to peer-closed socket will lead to sudden termination of MicroPython
process. SIGPIPE is particularly nasty, because unix shell doesn't
print anything for it, so the above looks like completely sudden and
silent termination for unknown reason. Ignoring SIGPIPE is also what
CPython does. Note that this may lead to problems using MicroPython
scripts as pipe filters, but again, that's what CPython does. So,
scripts which want to follow unix shell pipe semantics (where SIGPIPE
means "pipe was requested to terminate, it's not an error"), should
catch EPIPE themselves.
2017-05-01 18:47:26 +03:00