Commit Graph

12081 Commits

Author SHA1 Message Date
Bas Wijnen
67e1a4f8be esp32: Update to latest ESP IDF version.
- Updated supported git hash to current IDF version.
- Added missing targets and includes to Makefile.
- Updated error codes for networking module.
- Added required constant to sdkconfig configuration.
2018-05-14 11:42:46 +10:00
Damien George
749b16174b py/mpstate.h: Adjust start of root pointer section to exclude non-ptrs.
This patch moves the start of the root pointer section in mp_state_ctx_t
so that it skips entries that are not pointers and don't need scanning.

Previously, the start of the root pointer section was at the very beginning
of the mp_state_ctx_t struct (which is the beginning of mp_state_thread_t).
This was the original assembler version of the NLR code was hard-coded to
have the nlr_top pointer at the start of this state structure.  But now
that the NLR code is partially written in C there is no longer this
restriction on the location of nlr_top (and a comment to this effect has
been removed in this patch).

So now the root pointer section starts part way through the
mp_state_thread_t structure, after the entries which are not root pointers.

This patch also moves the non-pointer entries for MICROPY_ENABLE_SCHEDULER
outside the root pointer section.

Moving non-pointer entries out of the root pointer section helps to make
the GC more precise and should help to prevent some cases of collectable
garbage being kept.

This patch also has a measurable improvement in performance of the
pystone.py benchmark: on unix x86-64 and stm32 there was an improvement of
roughly 0.6% (tested with both gcc 7.3 and gcc 8.1).
2018-05-13 22:53:28 +10:00
Scott Shawcroft
ce5eae1c76
Merge pull request #761 from jepler/nrf-modules
nrf: Enable binascii, hashlib modules
2018-05-11 19:40:45 -07:00
Damien George
aeaace0737 stm32/usbdev: Remove unused RxState variable, and unused struct. 2018-05-11 23:20:59 +10:00
Damien George
4b3c629067 .gitattributes: Remove special text handling of stm32 usbdev files. 2018-05-11 23:07:57 +10:00
Damien George
abde0fa226 stm32/usbdev: Convert files to unix line endings.
Also remove trailing whitespace and convert tabs to spaces.
2018-05-11 23:03:52 +10:00
Jeff Epler
471fdae993 nrf: Enable binascii, hashlib modules
These modules would be very handy to have in order to implement a
more robust replacement for ampy.  It costs around 2KiB of text and
no data or bss.

'binascii' has base64 encoding, which can be used to create a fully
8-bit-clean transport above the slightly cooked serial connection of
these boards.

'hashlib' is a bit less critical, but I have found it handy to
be able to robustly checksum remote files.

I see this as only being useful on ports which don't have USB block
device support, so atmel-samd doesn't need it.  These modules are
already on esp8266 so I think nrf52 seems like the only one that
needs it.
2018-05-11 07:41:09 -05:00
Damien George
56a273ebff stm32/usbd_conf: Changes files to unix line endings and apply styling.
This patch is only cosmetic and has no functional change.
2018-05-11 22:17:58 +10:00
Damien George
9f4eda542a stm32/usbd_conf.h: Remove unused macros and clean up header file. 2018-05-11 22:04:56 +10:00
Damien George
9630376dbc py/mpconfig.h: Be stricter when autodetecting machine endianness.
This patch changes 2 things in the endianness detection:

1. Don't assume that __BYTE_ORDER__ not being __ORDER_LITTLE_ENDIAN__ means
   that the machine is big endian, so add an explicit check that this macro
   is indeed __ORDER_BIG_ENDIAN__ (same with __BYTE_ORDER, __LITTLE_ENDIAN
   and __BIG_ENDIAN).  A machine could have PDP endianness.

2. Remove the checks which base their autodetection decision on whether any
   little or big endian macros are defined (eg __LITTLE_ENDIAN__ or
   __BIG_ENDIAN__).  Just because a system defines these does not mean it
   has that endianness.

See issue #3760.
2018-05-11 21:51:34 +10:00
Damien George
7541be5637 tests/basics/special_methods2: Enable some additional tests that work.
These special methods are all available if MICROPY_PY_ALL_SPECIAL_METHODS
is enabled.
2018-05-11 17:37:16 +10:00
Damien George
421b84af99 docs: Bump version to 1.9.4. 2018-05-11 16:39:59 +10:00
Damien George
d2c1db1e5c tests/float/float_parse: Allow test to run on 32-bit archs.
Printing of uPy floats can differ by the floating-point precision on
different architectures (eg 64-bit vs 32-bit x86), so it's not possible to
using printing of floats in some parts of this test.  Instead we can just
check for equivalence with what is known to be the correct answer.
2018-05-11 13:51:18 +10:00
Damien George
6046e68fe1 py/repl: Initialise q_last variable to prevent compiler warnings.
Some older compilers cannot deduce that q_last is always written to before
being read.
2018-05-11 13:48:47 +10:00
Damien George
095d397017 py/objdeque: Fix sign extension bug when computing len of deque object.
For cases where size_t is smaller than mp_int_t (eg nan-boxing builds) the
difference between two size_t's is not sign extended into mp_int_t and so
the result is never negative.  This patch fixes this bug by using ssize_t
for the type of the result.
2018-05-11 13:44:50 +10:00
Scott Shawcroft
51106db93d
Merge pull request #827 from dhalbert/3.0_pb_pins_digitalinout
PBxx pins were not setting DRVSTR or reporting PULL properly
2018-05-10 20:42:26 -07:00
Dan Halbert
240659da0e PBxx pins were not setting DRVSTR or reporting PULL properly 2018-05-10 23:09:51 -04:00
Scott Shawcroft
80acef52a6
Merge pull request #826 from jepler/nrf-framebuf
nrf52: enable framebuf module
2018-05-10 20:06:07 -07:00
Damien George
b208aa189e stm32/README: Update to reflect current MCU support. 2018-05-11 10:36:46 +10:00
Jeff Epler
2acd5d88b6 nrf52: enable framebuf module
Closes: #656
2018-05-10 18:37:08 -05:00
Damien George
3678a6bdc6 py/modbuiltins: Make built-in dir support the __dir__ special method.
If MICROPY_PY_ALL_SPECIAL_METHODS is enabled then dir() will now delegate
to the special method __dir__ if the object it is listing has this method.
2018-05-10 23:14:23 +10:00
Damien George
29d28c2574 py/modbuiltins: In built-in dir make use of mp_load_method_protected.
This gives dir() better behaviour when listing the attributes of a user
type that defines __getattr__: it will now not list those attributes for
which __getattr__ raises AttributeError (meaning the attribute is not
supported by the object).
2018-05-10 23:07:19 +10:00
Damien George
7241d90272 py/repl: Use mp_load_method_protected to prevent leaking of exceptions.
This patch fixes the possibility of a crash of the REPL when tab-completing
an object which raises an exception when its attributes are accessed.

See issue #3729.
2018-05-10 23:05:43 +10:00
Damien George
529860643b py/modbuiltins: Make built-in hasattr work properly for user types.
It now allows __getattr__ in a user type to raise AttributeError when the
attribute does not exist.
2018-05-10 23:03:30 +10:00
Damien George
bc87b862fd py/runtime: Add mp_load_method_protected helper which catches exceptions
This new helper function acts like mp_load_method_maybe but is wrapped in
an NLR handler so it can catch exceptions.  It prevents AttributeError from
propagating out, and optionally all other exceptions.  This helper can be
used to fully implement hasattr (see follow-up commit), and also for cases
where mp_load_method_maybe is used but it must now raise an exception.
2018-05-10 23:00:04 +10:00
Scott Shawcroft
e4ec672464
Merge pull request #821 from deanm1278/master
add kwargs to bitbangio spi
2018-05-09 13:17:07 -07:00
dean
82b5efa7bc remove unnecessary comment 2018-05-09 15:14:26 -04:00
dean
fba1e221c6 DM: add kwargs to bitbangio spi 2018-05-09 15:12:42 -04:00
Damien George
eb88803ac8 py/{modbuiltins,repl}: Start qstr probing from after empty qstr.
The list of qstrs starts with MP_QSTR_NULL followed by MP_QSTR_, and these
should never appear in dir() or REPL tab completion, so skip them.
2018-05-09 16:15:02 +10:00
Damien George
c1115d931f stm32/usb: Use correct type for USB HID object. 2018-05-09 16:00:19 +10:00
Damien George
e1bc85416a stm32/usb: Fix broken pyb.have_cdc() so it works again. 2018-05-09 15:59:48 +10:00
Damien George
e638defff4 stm32/i2c: Make sure stop condition is sent after receiving addr nack. 2018-05-09 15:53:09 +10:00
Dan Halbert
734596c90a
Merge pull request #820 from tannewt/pause_audio
Add pause/resume control to AudioOut and I2SOut
2018-05-08 16:16:20 -04:00
Scott Shawcroft
fc7c25af6d Make resume idempotent (allowing you to call it twice without complaining.) 2018-05-08 13:00:05 -07:00
Scott Shawcroft
24116eff23 Tweak exception message. 2018-05-08 12:44:27 -07:00
Scott Shawcroft
50fc90bc5f Add pause/resume control to AudioOut and I2SOut
Fixes #808
2018-05-08 11:53:13 -07:00
Scott Shawcroft
d3a5d40374
Merge pull request #785 from notro/rtc_calibration
atmel-samd/samd21: Rework clock setup + calibration
2018-05-08 10:55:51 -07:00
Scott Shawcroft
64bd95ea01
Merge pull request #819 from dhalbert/cache
enable cache in SAMD51
2018-05-08 10:40:30 -07:00
Scott Shawcroft
b46cc9d29a
Merge pull request #817 from jepler/uzlib-as-submodule
uzlib: convert to submodule
2018-05-08 10:34:51 -07:00
Damien George
2ada1124d4 tests/cpydiff: Remove types_int_tobytesfloat now that it doesn't fail.
Commit e269cabe3e added a check that the
first argument to the to_bytes() method is an integer, and now uPy
follows CPython behaviour and raises a TypeError for this test.

Note: CPython checks the argument types before checking the number of
arguments, but uPy does it the other way around, so they give different
exception messages for this test, but still the same type, a TypeError.
2018-05-08 17:05:32 +10:00
Dan Halbert
e82f37c60e enable cache in SAMD51 2018-05-07 21:55:37 -04:00
Jeff Epler
a6072f7ae3 uzlib: convert to submodule
Textualy, the files in lib/uzlib/src were identical to the ones committed
in extmod/uzlib so there should be no behavioral change possible as a
result of this commit.
2018-05-07 20:03:30 -05:00
Noralf Trønnes
5d5d14709f Add clock representation with calibration
Add a python representation of the clocks with the possibility to change
the calbration of clock sources.
2018-05-07 23:04:02 +02:00
Scott Shawcroft
b0fba2864c
Merge pull request #814 from larsks/feature/utime-compile-only
esp8266/modutime.c: remove symbol conflicts between time and utime modules
2018-05-07 13:53:05 -07:00
Lars Kellogg-Stedman
56bf411d21 esp8266/modutime.c: remove symbol conflicts between time and utime modules
this renames symbols in modutime.c so that it no longer conflicts with
the time module.  This commit does not enable the utime module; it
simply makes it easier for a local developer to do so.
2018-05-07 11:55:20 -04:00
Dan Halbert
bca5aec5f4
Merge pull request #813 from jerryneedell/patch-2
Update mpconfigport.h
2018-05-07 10:19:39 -04:00
jerryneedell
b617271191
Update mpconfigport.h
comment out define of CIRCUITPYTHON_BOOT_OUTPUT_FILE  for NRF52  --  it does not work properly
2018-05-07 08:59:24 -04:00
Scott Shawcroft
d42c83ff41
Merge pull request #806 from jepler/hashlib-py3
Rename uhashlib->hashlib, improve python3 compatibility
2018-05-06 22:36:52 -07:00
Scott Shawcroft
c4cfd1170e
Merge pull request #811 from dhalbert/3.0_filesystem_writability_on_boot
3.0: boot.py change of filesystem writability would get overridden.
2018-05-06 22:27:54 -07:00
Dan Halbert
224e245e05 clarify comment 2018-05-07 00:08:26 -04:00