Wykres commitów

6064 Commity (0f5bf1aafe0ca073d958f271bd96addc6da8fe10)

Autor SHA1 Wiadomość Data
Paul Sokolovsky 418faae8f7 esp8266/scripts/webrepl_setup: Add max password length check.
modwebrepl truncates password to 9 chars, and that led people to confusion.
2016-05-17 02:21:45 +03:00
Damien George 1e024de7be unix: Add ability to include frozen bytecode in the build.
To use frozen bytecode make a subdirectory under the unix/ directory
(eg frozen/), put .py files there, then run:

    make FROZEN_MPY_DIR=frozen

Be sure to build from scratch.  The .py files will then be available for
importing.
2016-05-16 23:17:11 +01:00
Damien George 99b4719357 tools/mpy-tool.py: Add checks for critical configuration vars.
When an mpy file is frozen it must know the values of certain
configuration variables.  This patch provides an explicit check in the
generated C file that the configuration variables are what they are
supposed to be.
2016-05-16 23:13:30 +01:00
Paul Sokolovsky 21ec1fd850 esp8266/scripts/webrepl_setup: Show password placeholder char.
That was the intent for the initial user setup, but didn't work before
due to lwIP issues. Enable now that they're fixed.
2016-05-17 00:01:41 +03:00
Paul Sokolovsky 7327d5f6f7 esp8266/scripts/port_diag: Add network diagnostic output. 2016-05-16 23:52:58 +03:00
Robert HH a676a41cb7 esp8266/moduos.c: Addition of the rename method to module uos.
That one was missing in the module, even if it was available in the
vfs object. The change consist of adding the name and preparing the
call to the underlying vfs module, similar to what was already
implemented e.g. for remove.

Rename is useful by itself, or for instance for a safe file replace,
consisting of the sequence:

    write to a temp file
    delete the original file
    rename the temp file to the original file's name
2016-05-16 13:19:13 +02:00
Paul Sokolovsky afce978aca extmod/modlwip: Rework how Python accept callback is called.
Calling it from lwIP accept callback will lead incorrect functioning
and/or packet leaks if Python callback has any networking calls, due
to lwIP non-reentrancy. So, instead schedule "poll" callback to do
that, which will be called by lwIP when it does not perform networking
activities. "Poll" callback is called infrequently though (docs say
every 0.5s by default), so for better performance, lwIP needs to be
patched to call poll callback soon after accept callback, but when
current packet is already processed.
2016-05-15 22:42:12 +03:00
Paul Sokolovsky ca63c77073 docs/ustruct: Describe supported type codes. 2016-05-14 20:48:43 +03:00
Paul Sokolovsky 7b1bf0c308 tools/make-frozen.py: Quick fix to support package-modules.
It allows to "import foo.bar", but not "from foo import bar".
2016-05-14 16:30:02 +03:00
Paul Sokolovsky 719f8c044a tests/struct1: Add testcase for an unknown type char. 2016-05-14 15:54:09 +03:00
Paul Sokolovsky e53fb1bf03 py/modstruct: Raise ValueError on unsupported format char. 2016-05-14 15:47:08 +03:00
Paul Sokolovsky 2ae6697300 py/objstringio: Add TODO comment about avoiding copying on .getvalue(). 2016-05-14 14:46:13 +03:00
Paul Sokolovsky 772c73fa16 README: Add explicit note that subdirs contain more READMEs. 2016-05-14 06:33:47 +03:00
Radomir Dopieralski ccb00b7724 docs/esp8266/quickstart: remove i2c examples with stop=False
Since the ``stop`` parameter has been dropped.
2016-05-14 00:02:02 +02:00
Damien George 87981fc517 stmhal/sdcard: Allow to do unaligned read-from/write-to SD card.
For example, the following code now works with a file on the SD card:

    f = open('test', 'rb') # test must be 1024 bytes or more in size
    f.seek(511)
    f.read(513)

Also works for writing.

Fixes issue #1863.
2016-05-13 14:45:40 +01:00
Damien George 5985e41afc tools/make-frozen.py: Properly escape hex chars when making C strings. 2016-05-13 13:12:01 +01:00
Damien George 1e2f829293 tests/basics/string_splitlines: Reinstate feature test for splitlines. 2016-05-13 13:11:22 +01:00
Damien George cc80c4dd59 py/objstr: Make dedicated splitlines function, supporting diff newlines.
It now supports \n, \r and \r\n as newline separators.

Adds 56 bytes to stmhal and 80 bytes to unix x86-64.

Fixes issue #1689.
2016-05-13 12:21:32 +01:00
Damien George 1e388079f9 stmhal/i2c: Expose I2CHandle3 for use by custom C code.
If custom C code uses the I2C busses then it needs access to these
structures for i2c_init().
2016-05-13 11:23:32 +01:00
Damien George 1dc2862a83 stmhal/led: Allow LEDs to be in PWM mode with TIM1 and channels 1-4.
This allows PYBv3 to use PWM for LED(1) and LED(2).
2016-05-13 11:01:21 +01:00
Paul Sokolovsky 68a7a92cec py/gc: gc_dump_alloc_table(): Dump heap offset instead of actual address.
Address printed was truncated anyway and in general confusing to outsider.
A line which dumps it is still left in the source, commented, for peculiar
cases when it may be needed (e.g. when running under debugger).
2016-05-13 00:16:38 +03:00
Paul Sokolovsky 9a8751b006 gc: gc_dump_alloc_table(): Use '=' char for tail blocks.
'=' is pretty natural character for tail, and gives less dense picture
where it's easier to see what object types are actually there.
2016-05-13 00:16:38 +03:00
Paul Sokolovsky 10503f3534 py/moduerrno: Add EACCES, pretty common error on Unix. 2016-05-13 00:15:38 +03:00
Damien George 9a92499641 py/objexcept: Don't convert errno to str in constructor, do it in print.
OSError's are now printed like:

    OSError: [Errno 1] EPERM

but only if the string corresponding to the errno is found.
2016-05-12 14:27:52 +01:00
Paul Sokolovsky a314b842bb py/emitglue: Fix build on AArch64 (ARMv8, etc.) related to loading .mpy files.
Actual loading of .mpy files isn't tested.
2016-05-12 16:00:57 +03:00
Colin Hogben a896951a9a py/objfloat, py/modmath: Ensure M_PI and M_E defined.
In some compliation enviroments (e.g. mbed online compiler) with
strict standards compliance, <math.h> does not define constants such
as M_PI.  Provide fallback definitions of M_E and M_PI where needed.
2016-05-12 13:28:45 +01:00
Damien George d45e5f8c35 py: Add mp_errno_to_str() and use it to provide nicer OSError msgs.
If an OSError is raised with an integer argument, and that integer
corresponds to an errno, then the string for the errno is used as the
argument to the exception, instead of the integer.  Only works if
the uerrno module is enabled.
2016-05-12 13:20:40 +01:00
Damien George 47bf6ba61a py/moduerrno: Add more constants to the errno module. 2016-05-12 13:18:48 +01:00
Damien George 0d6d315ba6 esp8266: Change to use internal errno's. 2016-05-12 12:49:36 +01:00
Damien George 0055457b5f extmod/modlwip: Convert errno's to use MP_Exxx symbols. 2016-05-12 12:49:14 +01:00
Damien George c9a7430dbe py/mperrno: Add some more MP_Exxx constants, related to networking. 2016-05-12 12:48:47 +01:00
Paul Sokolovsky bc04dc277e py/gc: Make (byte)array type dumping conditional on these types being enabled. 2016-05-11 19:21:53 +03:00
Paul Sokolovsky 3d7f3f00e0 py/gc: gc_dump_alloc_table(): Show byte/str and (byte)array objects.
These are typical consumers of large chunks of memory, so it's useful to
see at least their number (how much memory isn't clearly shown, as the data
for these objects is allocated elsewhere).
2016-05-11 19:00:15 +03:00
Damien George 80a8d473f6 py/repl: Fix handling of backslash in quotes when checking continuation. 2016-05-11 16:05:22 +01:00
Damien George 9b4502b7e8 docs/esp8266/tutorial: Fix typo in do_connect() network example.
Fixes issue #2065.
2016-05-11 13:40:28 +01:00
Damien George ce2d34d74f drivers/cc3000: Rename timeval to cc3000_timeval, to avoid clash.
The timeval struct can be defined by system C headers.
2016-05-10 23:46:00 +01:00
Damien George 79a38a7a43 stmhal: For network drivers, convert to use MP_Exxx errno symbols. 2016-05-10 23:45:33 +01:00
Damien George 83a9a723b9 py/mperrno: Add EAFNOSUPPORT definition. 2016-05-10 23:44:59 +01:00
Damien George 7e1f580910 esp8266: Enable uerrno module, weak linked also as errno. 2016-05-10 23:30:39 +01:00
Damien George 4f2ba9fbdc esp8266: Convert to use new MP_Exxx errno symbols.
These symbols are still defined in terms of the system Exxx symbols, and
can be switched to internal numeric definitions at a later stage.

Note that extmod/modlwip still uses many system Exxx symbols.
2016-05-10 23:30:39 +01:00
Damien George 5ab98d5c41 stmhal: Convert to use internal errno symbols; enable uerrno module. 2016-05-10 23:30:39 +01:00
Damien George 088127d91c unix: Enable uerrno module. 2016-05-10 23:30:39 +01:00
Damien George e36ff98c80 py/parse: Add uerrno to list of modules to look for constants in. 2016-05-10 23:30:39 +01:00
Damien George 596a3feb8f py: Add uerrno module, with errno constants and dict. 2016-05-10 23:30:39 +01:00
Damien George 3f56fd64b8 py: Add mperrno.h file with uPy defined errno constants. 2016-05-10 23:30:39 +01:00
Paul Sokolovsky d60cb8e180 esp8266/help: Add "sta_if.active(True)" command.
As reported on the forum by Roberthh.
2016-05-10 23:21:32 +03:00
Paul Sokolovsky f16bec6bc9 esp8266/mpconfigport: Reduce various parser-related allocation params.
This gives noticeable result for parsing simple input (modelled on 32-bit
unix port):

Before:
>>> micropython.mem_total()
3360
>>> micropython.mem_total()
4472

After:
>>> micropython.mem_total()
3072
>>> micropython.mem_total()
4052

However, effect on parsing large input is much less conclusive, e.g.:

Before:
>>> micropython.mem_total()
3376
>>> import pystone_lowmem
>>> micropython.mem_total()
33006

delta=29630

After:
>>> micropython.mem_total()
3091
>>> import pystone_lowmem
>>> micropython.mem_total()
32509

delta=29418
2016-05-10 15:38:31 +03:00
Tobias Badertscher b924f649cd stmhal: Fix clock configuration for STM32L476-discovery; also add I2C2. 2016-05-10 09:20:30 +01:00
Radomir Dopieralski e89413e9b0 docs/esp8266/quickref: New way to get MAC address 2016-05-10 00:31:57 +02:00
Paul Sokolovsky 6f34e138f1 py/vstr: Change allocation policy, +16 to requested size, instead of *2.
Effect measured on esp8266 port:

Before:
>>> pystone_lowmem.main(10000)
Pystone(1.2) time for 10000 passes = 44214 ms
This machine benchmarks at 226 pystones/second
>>> pystone_lowmem.main(10000)
Pystone(1.2) time for 10000 passes = 44246 ms
This machine benchmarks at 226 pystones/second

After:
>>> pystone_lowmem.main(10000)
Pystone(1.2) time for 10000 passes = 44343ms
This machine benchmarks at 225 pystones/second
>>> pystone_lowmem.main(10000)
Pystone(1.2) time for 10000 passes = 44376ms
This machine benchmarks at 225 pystones/second
2016-05-10 00:56:51 +03:00