Commit Graph

7474 Commits

Author SHA1 Message Date
Damien George 68cd3a93f0 py/objset: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:16 +11:00
Damien George 1ea2f7a8ce py/objdict: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:16 +11:00
Damien George 58d9eeb8d9 py/objlist: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:16 +11:00
Damien George 229823942c py/objtuple: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:16 +11:00
Damien George 891dc5c62c py/persistentcode: Replace mp_uint_t with size_t where appropriate. 2017-02-16 16:51:16 +11:00
Damien George 6ed77bedbd py/mpz: Change type of "base" args from mp_uint_t to unsigned int. 2017-02-16 16:51:16 +11:00
Damien George eb90edb5c0 py/mpz: Remove obsolete declaration of mpz_as_str_size. 2017-02-16 16:51:16 +11:00
Damien George dcdcc43dad py/mpz: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:13 +11:00
Damien George 4e3bac2e42 py/runtime: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:13 +11:00
Paul Sokolovsky a937750ceb extmod/modlwip: Add my copyright.
Per:

$ git log modlwip.c |grep ^Auth | sort | uniq -c
      9 Author: Damien George
      2 Author: Galen Hazelwood
     43 Author: Paul Sokolovsky
2017-02-15 19:20:46 +03:00
Paul Sokolovsky f980c70997 tests/basic/: Make various tests skippable.
To run the testsuite on small ports.
2017-02-15 18:11:16 +03:00
Paul Sokolovsky b737c9cbc8 tests/gen_yield_from_close: Use range() instead of reversed().
As a "more basic" builtin iterator, present even in smaller ports.
2017-02-15 17:05:27 +03:00
Paul Sokolovsky eb101a2701 examples/embedding/README: Convert to markdown, grammar and clarity fixes. 2017-02-15 13:27:24 +03:00
Damien George e5cc681cb1 stmhal: Use generic interrupt char code. 2017-02-15 16:39:30 +11:00
Damien George 05a4859585 stmhal: Implement a proper thread scheduler.
This patch changes the threading implementation from simple round-robin
with busy waits on mutexs, to proper scheduling whereby threads that are
waiting on a mutex are only scheduled when the mutex becomes available.
2017-02-15 13:28:48 +11:00
Damien George f6c22a0679 py/vm: Add MICROPY_PY_THREAD_GIL_VM_DIVISOR option.
This improves efficiency of GIL release within the VM, by only doing the
release after a fixed number of jump-opcodes have executed in the current
thread.
2017-02-15 11:28:15 +11:00
Damien George 234f07f16c py/modthread: Use system-provided mutexs for _thread locks.
It's more efficient using the system mutexs instead of synthetic ones with
a busy-wait loop.  The system can do proper scheduling and blocking of the
threads waiting on the mutex.
2017-02-15 11:28:02 +11:00
Damien George 06a12ada48 tests/thread: Add stress-test for creating many threads. 2017-02-15 11:12:37 +11:00
Damien George 2847d7431d tests/thread: Replace busy waiting loops with a loop that sleeps.
Depending on the thread scheduler, a busy-wait loop can hog the CPU and
make the tests very slow.  So convert such loops to loops that have an
explicit sleep, allowing the worker threads to do their job.
2017-02-15 11:12:37 +11:00
Paul Sokolovsky f2d732f459 tests/extmod: Make tests skippable. 2017-02-15 01:56:22 +03:00
Paul Sokolovsky 7bb146350e tests/dict_fromkeys: Revert to use reversed() to run in native codegen mode. 2017-02-15 01:30:16 +03:00
Paul Sokolovsky 83623b2fde tests/basic/[a-f]*: Make skippable.
For small ports which don't have all features enabled.
2017-02-15 00:57:56 +03:00
Paul Sokolovsky 453f98914e zephyr/main: Don't unconditionally dump stats on each GC.
This was a debug output for initial porting, breaks tests.
2017-02-14 23:31:47 +03:00
Paul Sokolovsky d61ce32022 tests/builtin_dir: The most expected thing in sys is exit, test for it. 2017-02-14 23:30:06 +03:00
Paul Sokolovsky 800b163cd8 tests/comprehension1, containment: Split set tests to separate files.
To make skippable.
2017-02-14 22:31:08 +03:00
Paul Sokolovsky ce2e0eeb7b tests/run-tests: Allow to skip tests using async/await keywords. 2017-02-14 22:03:25 +03:00
stijn c6fd9ba4f3 tests: Add option to not clear MICROPYPATH when running tests
This allows using the test runner for other scenarios than just
testing uPy itself.
The principle of comparing either to CPython or else to a .exp
file is really handy but to be able to test custom modules not
built into micropython.exe one needs to be able to specify the
module search path a.k.a MICROPYPATH.
2017-02-14 20:19:00 +03:00
Paul Sokolovsky ce2703599f zephyr: Add qemu_cortex_m3 config fragment.
Should work for QEMU networking with soon-to-merged upstream patch.
2017-02-14 17:01:26 +03:00
Paul Sokolovsky 64916436b2 zephyr: Enable IPv6 networking in addition to IPv4. 2017-02-14 16:23:54 +03:00
Paul Sokolovsky ee3615d800 docs/uos: Remove mention of uos.sep.
MicroPython guarantees '/' to be a path separator, so extra constant taking
precious ROM space are not needed. MicroPython never had such constant, only
one vendor port had it (now unmaintained).
2017-02-14 13:14:46 +03:00
Paul Sokolovsky dd00d0134b examples/hwapi/soft_pwm: Use Signal on()/off() methods.
Just one sample is updated with  on()/off() for now, there should be
remaining sample(s) showing .value() use (but more can be converted later,
as long as 1 or so good samples of .value() remains).
2017-02-14 13:13:41 +03:00
Damien George adc80b8f84 py/objtype: Replace non-ASCII single-quote char with ASCII version. 2017-02-14 20:55:31 +11:00
Damien George 0c821f7def docs/library/machine: Make separate TOC for WiPy vs non-WiPy.
WiPy is the only port with ADC and SD, so they shouldn't be included in
other ports' documentation.
2017-02-13 13:06:51 +11:00
Damien George 3625afa173 extmod/vfs: Allow to stat the root directory.
os.stat('/') now works and returns a mostly-empty tuple.  Really all that
is useful is the mode which tells that it's a directory.
2017-02-13 12:25:43 +11:00
Dave Hylands 2f76c3ca0a docs/library/pyb.Pin: Minor typo fix, B6 should be A0.
On the PYBv1.0, X1 maps to A0, not B6.
2017-02-13 11:52:44 +11:00
Damien George 39100dc377 esp8266/moduos: Populate release field of uname in case it was GC'd. 2017-02-13 11:47:17 +11:00
Johannes Wågen f92f7dd2bc stmhal/boards: For STM32F411DISC, change I2C pin according to datasheet.
The pin had to be changed to get the I2C sensors on board to work.
2017-02-13 11:32:27 +11:00
Paul Sokolovsky 16a3534ad4 unix/moduselect: Implement ipoll() method with no-allocation policy.
ipoll() allows to poll streams without allocating any memory: this method
returns an iterator (a poll object itself), and the iterator yields
preallocated "callee-owned tuple" with polling results for each active
stream. The only operation a caller is allowed to do with this tuple is
extracting values from it (storing the tuple as a whole somewhere is
not allowed).
2017-02-13 00:23:23 +03:00
Paul Sokolovsky aac2db9aaf tools/upip: Update to 1.1.5. Better and more user-friendly error handling. 2017-02-10 20:18:05 +03:00
Damien George e08395a35c tests/misc: Add test for line number printing with large bytecode chunk. 2017-02-10 12:02:02 +11:00
Damien George cc2dbdd1fe py/emitbc: Produce correct line number info for large bytecode chunks.
Previous to this patch, for large chunks of bytecode that originated from
a single source-code line, the bytecode-line mapping would generate
something like (for 42 bytecode bytes and 1 line):

  BC_SKIP=31  LINE_SKIP=1
  BC_SKIP=11  LINE_SKIP=0

This would mean that any errors in the last 11 bytecode bytes would be
reported on the following line.  This patch fixes it to generate instead:

  BC_SKIP=31  LINE_SKIP=0
  BC_SKIP=11  LINE_SKIP=1
2017-02-10 11:58:10 +11:00
Damien George 8f1c6d952a extmod/vfs: Raise OSError(EEXIST) on attempt to mkdir a mount point. 2017-02-09 15:51:34 +11:00
Damien George c66c393130 examples/hwapi: Be sure to import Signal when it's used. 2017-02-09 15:21:57 +11:00
Kai Fricke c8febe631a examples/hwapi: Add hwconfig_pyboard.py for pyboard. 2017-02-09 15:19:28 +11:00
dmazzella 18e6569166 py/objtype: Implement __delattr__ and __setattr__.
This patch implements support for class methods __delattr__ and __setattr__
for customising attribute access.  It is controlled by the config option
MICROPY_PY_DELATTR_SETATTR and is disabled by default.
2017-02-09 12:40:15 +11:00
Damien George ec7dc7f8d7 extmod/vfs: Allow to mount a block device, not just a VFS object.
If the mounted object doesn't have a "mount" method then assume it's a
block device and try to detect the filesystem.  Since we currently only
support FAT filesystems, the behaviour is to just try and create a VfsFat
object automatically, using the given block device.
2017-02-09 12:03:12 +11:00
Paul Sokolovsky 181f7d1450 extmod/machine_signal: Implement Signal .on() and .off() methods.
Each method asserts and deasserts signal respectively. They are equivalent
to .value(1) and .value(0) but conceptually simpler (and may help to avoid
confusion with inverted signals, where "asserted" state means logical 0
output).
2017-02-08 11:14:23 +03:00
Damien George 7ae9bee790 stmhal/Makefile: Drop use of -mabi=aapcs-linux; link libgcc by default.
The aapcs-linux ABI is not required, instead the default aapcs ABI is
enough.  And using the default ABI means that the provided libgcc will now
link with the firmware without warnings about variable vs fixed enums.

Although the binary size increases by about 1k, RAM usage is slightly
decreased.  And libgcc may prove useful in the future for things like
long-long division.
2017-02-08 11:50:22 +11:00
Dave Hylands aa34c553ec py/nlr: Fix execstack builds for ARM.
It seems that the gcc toolchain on the RaspberryPi
likes %progbits instead of @progbits. I verified that
%progbits also works under x86, so this should
fix #2848 and fix #2842

I verified that unix and mpy-cross both compile
on my RaspberryPi and on my x64 machine.
2017-02-08 11:12:26 +11:00
Damien George af622eb2a6 py/map: Change mp_uint_t to size_t where appropriate.
The internal map/set functions now use size_t exclusively for computing
addresses.  size_t is enough to reach all of available memory when
computing addresses so is the right type to use.  In particular, for
nanbox builds it saves quite a bit of code size and RAM compared to the
original use of mp_uint_t (which is 64-bits on nanbox builds).
2017-02-08 11:00:15 +11:00