Commit Graph

12092 Commits

Author SHA1 Message Date
Scott Shawcroft
98c7d70fe4
Merge pull request #736 from jepler/testsuite-serial-travis
travis.yml: Running tests in parallel on travis is slower
2018-04-02 10:32:19 -07:00
Scott Shawcroft
b0184362a2
Merge pull request #730 from jepler/remove-appveyor-circuitpython
ports/windows: Remove appveyor.yml
2018-04-02 10:30:03 -07:00
Jeff Epler
c0ef427a98 travis.yml: Running tests in parallel on travis is slower
.. so explicitly set them to run serially with -j1.

(as discussed on #729)
2018-04-02 08:06:49 -05:00
Jeff Epler
c592b0e0f8 ports/windows: Remove appveyor.yml
.. this allows developers who want to work with both micropython and
circuitpython to enable appveyor on their fork, but not get errors
when pushing circuitpython changes.

In the appveyor configuration for your fork, simply enable the
checkbox "Skip branches without appveyor.yml".
2018-04-02 07:59:12 -05:00
Scott Shawcroft
fc9340ca17
Merge pull request #733 from pewpew-game/gamepad-pull
Respect pin's pull in gamepad
2018-04-01 22:58:25 -07:00
Scott Shawcroft
630352c25d
Merge pull request #732 from pewpew-game/gamepad-typecheck
Add a type check to the gamepad module
2018-04-01 22:53:54 -07:00
Scott Shawcroft
e4ae1e3d59
Merge pull request #734 from jepler/str-find-backwards-circuitpython
py/objstr: Don't crash when end < start
2018-04-01 22:41:59 -07:00
Scott Shawcroft
b62d8faaec
Merge pull request #735 from jepler/generator-stack-overflow-circuitpython
py/objgenerator: Check stack before resuming a generator
2018-04-01 22:38:19 -07:00
Jeff Epler
a909007fef py/objgenerator: Check stack before resuming a generator
This turns a hard crash in a recursive generator into
a 'maximum recursion depth exceeded' exception.
2018-04-01 16:40:15 -05:00
Jeff Epler
0041df0c6b py/objstr: Don't crash when end < start
.. and add testcases for the same.

(crash found by afl-fuzz)
2018-03-31 22:17:11 -05:00
Radomir Dopieralski
280374fa63 Respect pin's pull in gamepad
While it is traditional to have buttons on pins that are pulled up, and
have the button connect them to the ground, some CircuitPython boards
(notably the CPX) have the button pins pulled low and the button
connects them to VCC.

This patch makes the gamepad only change the pin's pull if it wasn't
already set when passed to the constructor, and also makes it consider
a button pressed when its value is the opposite of its pull.
2018-03-31 21:13:02 +02:00
Radomir Dopieralski
6ca4fd82ed Add a type check to the gamepad module
Make sure that all the arguments passed are indeed DigitalInOut.
This avoids crashes when the users pass something else.
2018-03-31 20:41:16 +02:00
Scott Shawcroft
3215b85568
Merge pull request #728 from jepler/double-splat-crash-circuitpython
py/bc: Turn assertion error into exception
2018-03-31 09:57:25 -07:00
Scott Shawcroft
d65ea992bf
Merge pull request #729 from jepler/tests-parallel-circuitpython
Optionally parallelize the testsuite
2018-03-31 09:55:21 -07:00
Jeff Epler
f8e0baa0b7 appveyor: parallelize tests 2018-03-31 10:43:57 -05:00
Jeff Epler
b59964f707 ports/unix/Makefile: parallelize tests 2018-03-31 10:42:33 -05:00
Jeff Epler
0dfc3be903 run_tests: EXTERNAL_TARGETS can't run in parallel 2018-03-31 10:40:37 -05:00
Jeff Epler
c1cd259529 travis.yml: best guesses about when to run tests in parallel
Notably, "--via-mpy" spews failures when threaded, possibly indicating
that micropython is not creating mpy files in threadsafe manner.
2018-03-31 10:39:55 -05:00
Jeff Epler
c2b8529698 run-tests: automatically parallelism based on CPU (thread) count 2018-03-31 10:38:54 -05:00
Jeff Epler
a3309ebb80 run-tests: optionally parallelize tests
When requested via 'run-tests -j', more than one test will be run
at a time.  On my system, (i5-3320m with 4 threads / 2 cores), this
reduces elapsed time by over 50% when testing pots/unix/micropython.

Elapsed time, seconds, best of 3 runs with each -j value:

before patchset: 18.1
            -j1: 18.1
            -j2: 11.3  (-37%)
            -j4:  8.7  (-52%)
            -j6:  8.4  (-54%)

In all cases the final output is identical:
    651 tests performed (18932 individual testcases)
    651 tests passed
    23 tests skipped: buffered_writer...
though the individual pass/fail messages can be different/interleaved.
2018-03-31 10:38:54 -05:00
Jeff Epler
b9dd6a5bb4 run-tests: sort skipped and failed tests
.. otherwise the line which reports tests skipped and failed can come in
different orders when -j values above 1 are used.
2018-03-31 10:38:54 -05:00
Jeff Epler
a73f005e00 run_tests: make access to shared variables thread safe 2018-03-31 10:38:52 -05:00
Jeff Epler
4767d23db3 run_tests: factor run_one_test to function 2018-03-31 10:38:04 -05:00
Jeff Epler
853f7ac4d0 py/bc: Turn assertion error into exception 2018-03-31 08:44:29 -05:00
Dan Halbert
c00b25ec45 WIP: HID works with MSC interfaces removed 2018-03-30 23:31:28 -04:00
Dan Halbert
df91878d2e WIP: works with just keyboard but not complex report descriptor 2018-03-30 23:24:00 -04:00
Scott Shawcroft
1489450693
Merge pull request #727 from sommersoft/build_doc
Added git submodule Step To SAMD README
2018-03-30 15:59:39 -07:00
sommersoft
8af98d0dc9 ambiguized directory paths 2018-03-30 22:44:16 +00:00
sommersoft
a5b60647be improved arrangement 2018-03-30 22:26:21 +00:00
sommersoft
7c0be04696 verbiage cleanup 2018-03-30 22:21:35 +00:00
sommersoft
c70acab8b3 updated README; added git submodule info 2018-03-30 22:16:36 +00:00
sommersoft
6ee573c7c9
Merge branch 'master' into super_status 2018-03-30 14:27:39 -05:00
Dan Halbert
bee0d2edb4
Merge pull request #710 from jepler/assertion-failures-to-exceptions
Assertion failures to exceptions
2018-03-30 13:47:55 -04:00
Damien George
bcfff4fc98 tests/basics/iter1.py: Add more tests for walking a user-defined iter.
Some code in mp_iternext() was only tested by the native emitter, so the
tests added here test this function using just the bytecode emitter.
2018-03-30 14:23:13 +11:00
Damien George
f50b64cab5 py/runtime: Be sure that non-intercepted thrown object is an exception.
The VM expects that, if mp_resume() returns MP_VM_RETURN_EXCEPTION, then
the returned value is an exception instance (eg to add a traceback to it).
It's possible that a value passed to a generator's throw() is not an
exception so must be explicitly checked for if the thrown value is not
intercepted by the generator.

Thanks to @jepler for finding the bug.
2018-03-30 12:43:38 +11:00
Damien George
3280788195 py/runtime: Check that keys in dicts passed as ** args are strings.
Prior to this patch the code would crash if a key in a ** dict was anything
other than a str or qstr.  This is because mp_setup_code_state() assumes
that keys in kwargs are qstrs (for efficiency).

Thanks to @jepler for finding the bug.
2018-03-30 11:13:32 +11:00
Jeff Epler
ff06a45599 Fix assertion failures in super_attr
micropython: ../../py/objtype.c:1100: super_attr: Assertion `MP_OBJ_IS_TYPE(self->type, &mp_type_type)' failed.

e.g., when making calls like
    super(1, 1).x
2018-03-29 06:42:10 -05:00
Jeff Epler
6da8d7c465 Fix assertion failures in mp_obj_new_type
Fixes the following assertion failures when the arguments to type()
were not of valid types:
micropython: ../../py/objtype.c:984: mp_obj_new_type: Assertion `MP_OBJ_IS_TYPE(bases_tuple, &mp_type_tuple)' failed.
micropython: ../../py/objtype.c:994: mp_obj_new_type: Assertion `MP_OBJ_IS_TYPE(items[i], &mp_type_type)' failed.

e.g., when making calls like
    type("", (), 3)
    type("", 3, {})
2018-03-29 06:42:10 -05:00
Jeff Epler
a55988a547 Fix assertion failure in mpz_divmod_inpl
.. turning this from an assertion failure into an exception:
    pow(1,1,0)
2018-03-29 06:42:10 -05:00
Damien George
bc3a5f1917 stm32/mphalport: Use MCU regs to detect if cycle counter is started.
Instead of using a dedicated variable in RAM it's simpler to use the
relevant bits in the DWT register.
2018-03-29 16:23:52 +11:00
Damien George
b833f170c3 stm32/main: Only update reset_mode if board doesn't use a bootloader.
If the board is configured to use a bootloader then that bootloader will
pass through the reset_mode.
2018-03-29 16:16:58 +11:00
Damien George
7856a416bd stm32/main: Rename main to stm32_main and pass through first argument.
The main() function has a predefined type in C which is not so useful for
embedded contexts.  This patch renames main() to stm32_main() so we can
define our own type signature for this function.  The type signature is
defined to have a single argument which is the "reset_mode" and is passed
through as r0 from Reset_Handler.  This allows, for example, a bootloader
to pass through information into the main application.
2018-03-29 16:15:57 +11:00
Damien George
d9e69681f5 stm32: Add custom, optimised Reset_Handler code.
The Reset_Handler needs to copy the data section and zero the BSS, and
these operations should be as optimised as possible to reduce start up
time.  The versions provided in this patch are about 2x faster (on a Cortex
M4) than the previous implementations.
2018-03-29 15:29:23 +11:00
Scott Shawcroft
676ed4e199
Merge pull request #724 from tannewt/fix_freetouch_submodule
Remove freetouch files that were accidentally checked in and
2018-03-28 14:24:32 -07:00
Scott Shawcroft
7b2215a27c
Merge pull request #723 from jepler/high-quality-float-hash
Enable high-quality float hash
2018-03-28 14:16:32 -07:00
Scott Shawcroft
19b0b414e6 Remove freetouch files that were accidentally checked in and
readd the submodule.
2018-03-28 14:04:53 -07:00
Damien George
7e28212352 stm32/boards/STM32L476DISC: Update to not take the address of pin objs. 2018-03-28 16:29:55 +11:00
Damien George
2dca693c24 stm32: Change pin_X and pyb_pin_X identifiers to be pointers to objects.
Rather than pin objects themselves.  The actual object is now pin_X_obj and
defines are provided so that pin_X is &pin_X_obj.  This makes it so that
code that uses pin objects doesn't need to know if they are literals or
objects (that need pointers taken) or something else.  They are just
entities that can be passed to the map_hal_pin_xxx functions.  This mirrors
how the core handles constant objects (eg mp_const_none which is
&mp_const_none_obj) and allows for the possibility of different
implementations of the pin layer.

For example, prior to this patch there was the following:

    extern const pin_obj_t pin_A0;
    #define pyb_pin_X1 pin_A0
    ...
    mp_hal_pin_high(&pin_A0);

and now there is:

    extern const pin_obj_t pin_A0_obj;
    #define pin_A0 (&pin_A0_obj)
    #define pyb_pin_X1 pin_A0
    ...
    mp_hal_pin_high(pin_A0);

This patch should have minimal effect on board configuration files.  The
only change that may be needed is if a board has .c files that configure
pins.
2018-03-28 16:29:50 +11:00
Jeff Epler
abec199c19 Enable high-quality float hash
This appears to have a relatively small impact on flash usage but
fixes some pathological slow behavior putting floats in dicts or sets.

Closes: #704
2018-03-27 21:56:30 -05:00
Scott Shawcroft
6711c5c90d
Merge pull request #712 from jepler/fslabel
Add ability to get, set filesystem label from CircuitPython
2018-03-27 19:51:48 -07:00