aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-05-03mpy-cross: Fix compiler detection for including windows/fmode.cstijn
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-03tests/io/resource_stream: Add test for uio.resource_stream().Paul Sokolovsky
2017-05-03py/modio: Implement uio.resource_stream(package, resource_path).Paul Sokolovsky
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-02zephyr/main: Remove superfluous include.Paul Sokolovsky
2017-05-02zephyr/mpconfigport.h: Enable line number information for scripts.Paul Sokolovsky
2017-05-02tests/cpydiff/core_import_prereg: Fill in cause and workaround.Paul Sokolovsky
2017-05-02tests/cpydiff/core_function_userattr: Clarify, fill in cause and workaround.Paul Sokolovsky
2017-05-02tests/cpydiff/core_arguments: Fill in cause/workaround.Paul Sokolovsky
2017-05-02zephyr/Makefile: Add debugserver Zephyr target.Paul Sokolovsky
2017-05-01unix/main: Ignore SIGPIPE signal, instead make EPIPE arrive.Paul Sokolovsky
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-01extmod/modlwip: ioctl POLL: Fix handling of peer closed socket.Paul Sokolovsky
Peer-closed socket is both readable and writable: read will return EOF, write - error. Without this poll will hang on such socket. Note that we don't return POLLHUP, based on argumentation in http://www.greenend.org.uk/rjk/tech/poll.html that it should apply to deeper disconnects, for example for networking, that would be link layer disconnect (e.g. WiFi went down).
2017-05-01windows/README: Add a note about stack usage for msvcstijn
Add information as discussed in #2927 to the readme to make the easier to discover.
2017-05-01windows/README: Fix some typos and grammarstijn
2017-05-01tools/upip: Upgrade to 1.1.6, supports commented lines in requirements.txt.Paul Sokolovsky
2017-05-01tools/mpy-tool: Make work if run from another directory.Paul Sokolovsky
By making sure we don't add relative paths to sys.path.
2017-04-30msvc: Rebuild all qstrs when mpconfig headers are modifiedstijn
Make qstr generation depend on modifications in mpconfigport.h, mpconfig.h and makeqstrdata.py and if any of those change scan all source files for qstrs again since they might have changed (for example typcially when enabling new features in mpconfig.h). This fixes #2982 for msvc builds.
2017-04-30msvc: Do not define DEBUG for debug buildsstijn
It is not used anywhere and causes a warning about redefinition because it is used in modutimeq.c
2017-04-30py: Cleanup use of global DEBUG preprocessor definitionstijn
The standard preprocessor definition to differentiate debug and non-debug builds is NDEBUG, not DEBUG, so don't rely on the latter: - just delete the use of it in objint_longlong.c as it has been stale code for years anyway (since commit [c4029e5]): SUFFIX isn't used anywhere. - replace DEBUG with MICROPY_DEBUG_NLR in nlr.h: it is rarely used anymore so can be off by default
2017-04-30windows/README: Convert to Markdown.Paul Sokolovsky
2017-04-29extmod/modlwip: getaddrinfo: Allow to accept all 6 standard params.Paul Sokolovsky
But warn if anything else but host/port is passed.
2017-04-29extmod/moduselect: Implement ipoll() method for alloc-free polling.Paul Sokolovsky
Similar to the implementation added to unix port module previously.
2017-04-29extmod/moduselect: Refactor towards introduction of poll.ipoll().Paul Sokolovsky
This follows previous refactor made to unix/moduselect.
2017-04-29extmod/moduselect: Convert to MP_ROM_QSTR and friends.Paul Sokolovsky
2017-04-28qemu-arm, stmhal: Remove dummy memory.h since it's no longer needed.Damien George
extmod/crypto-algorithms/sha256.c was recently fixed so that it didn't include this header.
2017-04-27examples/hwapi: Add config for Zephyr port of 96Boards Carbon.Paul Sokolovsky
2017-04-27extmod/crypto-algorithms/sha256: Remove non-standard memory.h header.Paul Sokolovsky
2017-04-27zephyr/modusocket: Add dummy makefile() implementation.Paul Sokolovsky
2017-04-26zephyr/modusocket: sock_read: Check socket status only at the start of packet.Paul Sokolovsky
Otherwise, if we already have a packet in progress, finish it first, before check "peer closed" status.
2017-04-26zephyr/modusocket: Add read/readline/readinto stream methods.Paul Sokolovsky
2017-04-26zephyr/modusocket: Refactor recv() into stream read() method.Paul Sokolovsky
2017-04-26unix: Remove obsolete MICROPY_FATFS macro.Damien George
It doesn't do anything. The VFS feature is controlled by MICROPY_VFS and the FatFS driver, by MICROPY_VFS_FAT (which are set in mpconfigport.h).
2017-04-26zephyr/modusocket: Enable stream write() method.Paul Sokolovsky
2017-04-26zephyr/modusocket: Refactor send() into stream write() method.Paul Sokolovsky
2017-04-26zephyr: Add 96b_carbon configuration.Kushal Das
As there's no networking support in mainline yet, networking is disabled, because otherwise the board hangs on startup.
2017-04-25py/mpz: In mpn_sub, use existing function to remove trailing zeros.Damien George
2017-04-25tests/basics: Add tests for int.from_bytes when src has trailing zeros.Damien George
The trailing zeros should be truncated from the converted value.
2017-04-25py/mpz: Strip trailing zeros from mpz value when set from bytes.Damien George
2017-04-22zephyr/main: Configure IPv4 netmask and gateway to allow Internet access.Paul Sokolovsky
2017-04-22tests: Add tests for calling super and loading a method directly.Damien George
2017-04-22py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls.Damien George
This patch allows the following code to run without allocating on the heap: super().foo(...) Before this patch such a call would allocate a super object on the heap and then load the foo method and call it right away. The super object is only needed to perform the lookup of the method and not needed after that. This patch makes an optimisation to allocate the super object on the C stack and discard it right after use. Changes in code size due to this patch are: bare-arm: +128 minimal: +232 unix x64: +416 unix nanbox: +364 stmhal: +184 esp8266: +340 cc3200: +128
2017-04-22py/compile: Refactor handling of special super() call.Damien George
This patch refactors the handling of the special super() call within the compiler. It removes the need for a global (to the compiler) state variable which keeps track of whether the subject of an expression is super. The handling of super() is now done entirely within one function, which makes the compiler a bit cleaner and allows to easily add more optimisations to super calls. Changes to the code size are: bare-arm: +12 minimal: +0 unix x64: +48 unix nanbox: -16 stmhal: +4 cc3200: +0 esp8266: -56
2017-04-22py/compile: Don't do unnecessary check if iter parse node is a struct.Damien George
If we get to this point in the code then pn_iter is guaranteed to be a struct.
2017-04-22mpy-cross, unix, windows, stmhal: Enable return-if-else optimisation.Damien George
Prior to making this a config option it was previously available on these (and all other) ports, and it makes sense to keep it enabled for mpy-cross as well as ports that have a decent amount of space for the code.
2017-04-22py/compile: Add COMP_RETURN_IF_EXPR option to enable return-if-else opt.Damien George
With this optimisation enabled the compiler optimises the if-else expression within a return statement. The optimisation reduces bytecode size by 2 bytes for each use of such a return-if-else statement. Since such a statement is not often used, and costs bytes for the code, the feature is disabled by default. For example the following code: def f(x): return 1 if x else 2 compiles to this bytecode with the optimisation disabled (left column is bytecode offset in bytes): 00 LOAD_FAST 0 01 POP_JUMP_IF_FALSE 8 04 LOAD_CONST_SMALL_INT 1 05 JUMP 9 08 LOAD_CONST_SMALL_INT 2 09 RETURN_VALUE and to this bytecode with the optimisation enabled: 00 LOAD_FAST 0 01 POP_JUMP_IF_FALSE 6 04 LOAD_CONST_SMALL_INT 1 05 RETURN_VALUE 06 LOAD_CONST_SMALL_INT 2 07 RETURN_VALUE So the JUMP to RETURN_VALUE is optimised and replaced by RETURN_VALUE, saving 2 bytes and making the code a bit faster.
2017-04-22py/compile: Extract parse-node kind at start of func for efficiency.Damien George
Otherwise the type of parse-node and its kind has to be re-extracted multiple times. This optimisation reduces code size by a bit (16 bytes on bare-arm).
2017-04-22py/compile: Don't do unnecessary check if parse node is a struct.Damien George
PN_atom_expr_normal parse nodes always have structs for their second sub-node, so simplify the check for the sub-node kind to save code size.
2017-04-22py/objtype: mp_obj_new_super doesn't need to be public, so inline it.Damien George
Saves code size (20 bytes on bare-arm) and makes it a tiny bit more efficient.
2017-04-21extmod/moductypes: Fix bigint handling for 32-bit ports.Paul Sokolovsky
2017-04-21windows: Bring mpconfigport.h up-to-date with unix portstijn
Add definitions/source files for features which work on the windows ports but weren't yet enabled. UTIME related lines are moved a couple of lines up to make comparision with unix/mpconfigport.h easier in the future.
2017-04-21py: Reduce str/repr precision of float numbers when floats are 30-bit.Damien George
With 30-bit floats there aren't enough bits to faithfully print 7 decimal digits, so reduce the precision to 6 digits.