Wykres commitów

5020 Commity (4bd95f8b4407ff85c68676285c02236ee72d72cb)

Autor SHA1 Wiadomość Data
Damien George 4bd95f8b44 tools: Add C middle-processor to make builtin tables proper hash tables. 2015-12-31 00:24:33 +00:00
Peter Hinch 521759ee18 docs: Add discussion on interrupt handlers incl uPy specific techniques. 2015-12-31 00:02:09 +00:00
Paul Sokolovsky fb7b715b7b extmod/modlwip: Use _ERR_BADF instead of magic number. 2015-12-30 16:43:35 +02:00
Paul Sokolovsky bc25545fbb extmod/modlwip: Avoid magic numeric values in memcpy(). 2015-12-30 16:40:23 +02:00
Paul Sokolovsky 722fb2d251 extmod/modlwip: User proper field name and value names for socket state. 2015-12-30 16:26:23 +02:00
Paul Sokolovsky 43fecb0acb esp8266/modesp: Allow to compile out proprietary espconn stuff. 2015-12-30 15:53:51 +02:00
Paul Sokolovsky fff2dd2627 extmod/modlwip: Mark some lwip_socket_obj_t's fields as volatile.
Any fields changed by asynchronous callbacks must be volatile.
2015-12-29 21:02:02 +02:00
Paul Sokolovsky a63d4a6cc2 extmod/modlwip: tcp_recv: Use more regular and responsive poll pattern.
Polling once in 100ms means dismal performance.

TODO: Propagate this pattern to other polling places.
2015-12-29 20:37:22 +02:00
Dave Hylands 0dce9a21ce stmhal: Add struct qstr to block of qstrs needed for MICROPY_PY_STRUCT.
Otherwise build fails if uctypes is disabled.
2015-12-28 00:28:56 +00:00
Paul Sokolovsky 1e06e81b3d windows: Propagate MICROPY_PY_OS_DUPTERM handling from unix port. 2015-12-28 01:30:58 +02:00
Paul Sokolovsky 2c1620ce1f unix: Implement uos.dupterm(). Conditional on MICROPY_PY_OS_DUPTERM. 2015-12-28 01:13:21 +02:00
Paul Sokolovsky 3ea03a1188 py/gc: Improve mark/sweep debug output.
Previously, mark operation weren't logged at all, while it's quite useful
to see cascade of marks in case of over-marking (and in other cases too).
Previously, sweep was logged for each block of object in memory, but that
doesn't make much sense and just lead to longer output, harder to parse
by a human. Instead, log sweep only once per object. This is similar to
other memory manager operations, e.g. an object is allocated, then freed.
Or object is allocated, then marked, otherwise swept (one log entry per
operation, with the same memory address in each case).
2015-12-27 20:40:36 +02:00
Paul Sokolovsky fce0036a67 esp8266: mac() function belongs to network module per the latest API. 2015-12-27 10:03:32 +02:00
stijn 1aa4599ddd windows/msvc: Nicer handling of asserts and 'invalid' parameters
The default bahaviour for debug builds is to show dialog boxes for asserts
and invalid parameter handling. This is not so nice in general and causes
the Appveyor debug builds to hang because the io\file_seek.py test passes
a closed file descriptor to lseek. Disable this behaviour by printing
assert messages to the output instead of showing the dialog, and by
disabling 'invalid' parameter handling which causes the affected functions
to just return an error and set errno appropriately.
2015-12-26 22:14:16 +00:00
Damien George bbe8d51bd9 py/map: Add fast-path for hashing of map index when it is a qstr.
Map indicies are most commonly a qstr, and adding a fast-path for hashing
of a qstr increases overall performance of the runtime.

On pyboard there is a 4% improvement in the pystone benchmark for a cost
of 20 bytes of code size.  It's about a 2% improvement on unix.
2015-12-26 21:15:47 +00:00
Damien George e5ce5e2a43 tests: Skip class_bind_self.py for native emitter. 2015-12-26 13:06:50 +00:00
Damien George 78913211a9 py: Be more restrictive binding self when looking up instance attrs.
When looking up and extracting an attribute of an instance, some
attributes must bind self as the first argument to make a working method
call.  Previously to this patch, any attribute that was callable had self
bound as the first argument.  But Python specs require the check to be
more restrictive, and only functions, closures and generators should have
self bound as the first argument

Addresses issue #1675.
2015-12-26 12:41:31 +00:00
Damien George 84b245f187 lib/utils: Add pyexec_frozen_module to load and execute frozen module.
This is a convenience function similar to pyexec_file.  It should be used
instead of raw mp_parse_compile_execute because the latter does not catch
and report exceptions.
2015-12-26 12:32:33 +00:00
Paul Sokolovsky 7203b58e87 extmod/modubinascii: Add "separator" argument to hexlify().
This is extension to CPython, it allows to easily produce human-readable
hex dump:

>>> ubinascii.hexlify(b"\xaa\x55\xaa\x55", b" ")
b'aa 55 aa 55'
2015-12-26 02:15:56 +02:00
Paul Sokolovsky b4c65c253f extmod/fsusermount: Move module qstrs to global pool from stmhal port. 2015-12-25 19:22:16 +02:00
Damien George 7ce8860b6b tests: Skip try-finally test for native emitter. 2015-12-24 12:49:31 +00:00
Damien George 8047340d75 py: Handle case of return within the finally block of try-finally.
Addresses issue #1636.
2015-12-24 12:47:39 +00:00
Damien George 117158fcd5 tests: Add tests for stream IO errors. 2015-12-23 22:37:02 +00:00
Paul Sokolovsky 1c9210bc2b unix/unix_mphal: Raise KeyboardInterrupt straight from signal handler.
POSIX doesn't guarantee something like that to work, but it works on any
system with careful signal implementation. Roughly, the requirement is
that signal handler is executed in the context of the process, its main
thread, etc. This is true for Linux. Also tested to work without issues
on MacOSX.
2015-12-23 00:07:00 +02:00
Damien George e9751d2ac0 unix: Properly cancel REPL input when Ctrl-C is pressed. 2015-12-22 22:06:09 +00:00
Damien George 401af50dc0 stmhal: Add pyb.irq_stats() to get statistics about IRQ calls.
Adds a lot of code, makes IRQs a bit less efficient, but is very useful
for debugging.  Usage: pyb.irq_stats() returns a memory view that can be
read and written, eg:

    list(pyb.irq_stats())
    pyb.irq_stats()[0]
    pyb.irq_stats()[0] = 0

The patch provides general IRQ_ENTER() and IRQ_EXIT() macros that can be
modified to provide further IRQ statistics if desired.
2015-12-22 21:00:20 +00:00
Paul Sokolovsky abd0fcfc86 esp8266: Remove superfluous includes. 2015-12-21 22:08:06 +02:00
Paul Sokolovsky e13d462f77 esp8266/modesp: flash_read() takes 2 args (fix typo). 2015-12-21 22:07:11 +02:00
stijn a5aa03acaf windows: Better handling of Ctrl-C
This builds upon the changes made in 2195046365. Using signal() does not
produce reliable results so SetConsoleCtrlHandler is used, and the handler
is installed only once during initialization instead of removing it in
mp_hal_set_interrupt_char when it is not strictly needed anymore, since
removing it might lead to Ctrl-C events being missed because they are
fired on a seperate thread which might only become alive after the handler
was removed.
2015-12-21 20:51:27 +02:00
Paul Sokolovsky 1b7f622410 extmod/moduhashlib: Add namespace prefix for crypto-algorithms/sha256.h.
Everyone loves to names similar things the same, then there're conflicts
between different libraries. The namespace prefix used is "CRYAL_", which
is weird, and that's good, as that minimizes chance of another conflict.
2015-12-20 23:14:47 +02:00
Paul Sokolovsky 664bc44f30 tests: Add tests for %-formatting of bytes.
This requires CPython3.5, to not require switching to it, just use .exp
file.
2015-12-20 16:54:34 +02:00
Paul Sokolovsky d50f649cf8 py/objstr: Applying % (format) operator to bytes should return bytes, not str. 2015-12-20 16:52:11 +02:00
Paul Sokolovsky ef63ab5724 py/objstr: Make sure that b"%s" % b"foo" uses undecorated bytes value.
I.e. the expected result for above is b"foo", whereas previously we got
b"b'foo'".
2015-12-20 16:51:59 +02:00
stijn 0a4eb4dbf2 py/mpprint: Fix printing of 64bit integers for 64bit windows builds
This makes all tests pass again for 64bit windows builds which would
previously fail for anything printing ranges (builtin_range/unpack1)
because they were printed as range( ld, ld ).

This is done by reusing the mp_vprintf implementation for MICROPY_OBJ_REPR_D
for 64bit windows builds (both msvc and mingw-w64) since the format specifier
used for 64bit integers is also %lld, or %llu for the unsigned version.

Note these specifiers used to be fetched from inttypes.h, which is the
C99 way of working with printf/scanf in a portable way, but mingw-w64
wants to be backwards compatible with older MS C runtimes and uses
the non-portable %I64i instead of %lld in inttypes.h, so remove the use
of said header again in mpconfig.h and define the specifiers manually.
2015-12-19 01:15:58 +00:00
Dave Hylands b61336483b stmhal: Add mem8/mem16/mem32 operations to machine module.
This uses the newly factored machine_mem functions.
2015-12-19 01:05:44 +00:00
Fabian d0f31ccf33 stmhal: Change PLL configuration for STM32F7DISC.
Changes USB clock from 50MHz to 48MHz which improves USB communication.
2015-12-18 22:16:49 +00:00
stijn da199e4407 windows: Add Appveyor CI builds for msvc port.
Appveyor is like Travis, but for Windows builds. The appveyor.yml configuration
will build the msvc port in all configuration/platform conbinations,
and run the tests for each of those.
2015-12-18 21:49:35 +00:00
Damien George fe03e7bcb7 py/obj: Fix float constants for MICROPY_OBJ_REPR_C. 2015-12-18 21:44:01 +00:00
Damien George a67651406d lib/libm: Allow math funcs to be used by non-Thumb archs.
Requires addition of software implementation of sqrtf function.
2015-12-18 21:05:44 +00:00
Paul Sokolovsky 0e1b5faad5 stmhal, cc3200: Actually implement machine -> umachine module weak link. 2015-12-18 22:22:43 +02:00
stijn c5f52b845b msvc: Add dirent.h/.c implementation
This fixes the build after adding directory iteration in d874702
2015-12-18 22:10:51 +02:00
Dave Hylands 755b01439b unix: machine_mem improvements
This basically introduces the MICROPY_MACHINE_MEM_GET_READ_ADDR
and MICROPY_MACHINE_MEM_GET_WRITE_ADDR macros. If one of them is
not defined, then a default identity function is provided.
2015-12-18 22:01:03 +02:00
Damien George acaccb37ec py/gc: When printing info, use %u instead of UINT_FMT for size_t args.
Ideally we'd use %zu for size_t args, but that's unlikely to be supported
by all runtimes, and we would then need to implement it in mp_printf.
So simplest and most portable option is to use %u and cast the argument
to uint(=unsigned int).

Note: reason for the change is that UINT_FMT can be %llu (size suitable
for mp_uint_t) which is wider than size_t and prints incorrect results.
2015-12-18 12:52:45 +00:00
Damien George dd5353a405 py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts.
MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler,
which is useful when only loading of pre-compiled bytecode is supported.
It is enabled by default.

MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin
functions.  By default they are only included if MICROPY_ENABLE_COMPILER
is enabled.

Disabling both options saves about 40k of code size on 32-bit x86.
2015-12-18 12:35:44 +00:00
Damien George ab8012bd80 py/emitglue: Add include of unistd.h for read function. 2015-12-18 12:33:08 +00:00
Damien George a83124361e py/compile: Simplify compilation of comprehension iterators.
Saves 88 bytes on Thumb2, and 200 bytes on x86-64 archs.
2015-12-18 01:37:55 +00:00
Paul Sokolovsky 2eb844e0b4 ports: Rename "machine" module to "umachine".
To let unix port implement "machine" functionality on Python level, and
keep consistent naming in other ports (baremetal ports will use magic
module "symlinking" to still load it on "import machine").

Fixes #1701.
2015-12-18 02:39:52 +02:00
Paul Sokolovsky 2195046365 windows/windows_mphal: Add basic support for raising KeyboardInterrupt.
Compiles with mingw32, tested to work erratically under Wine due to
not fully implemented emulation in it.
2015-12-18 01:12:59 +02:00
Paul Sokolovsky 5efd3f0dca windows: Make keyboard_interrupt_obj available, it's standard feature. 2015-12-18 01:07:27 +02:00
Paul Sokolovsky 3c2b377711 unix/unix_mphal: Just consistently set sigaction.sa_flags to 0. 2015-12-18 01:07:27 +02:00