Commit Graph

4655 Commits

Author SHA1 Message Date
Jeff Epler 41b273e0c1 py/vm.c: Restore lost bits of MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE
This fixes a problem where boards that enabled this (most SAM D21s)
would crash on the first bytecode instruction.

Closes: #4686
2021-04-30 09:17:40 -05:00
Damien George 6b7c8d3e72 py/runtime: Remove commented-out code from mp_deinit().
These commented-out lines of code have been unused for a long time, so
remove them to avoid confusion as to why they are there.

mp_obj_dict_free() never existed, this line was converted from
mp_map_deinit() and commented out as soon as it was added.  The call to
mp_map_deinit(mp_loaded_modules_map) was commented in
1a1d11fa32.

Fixes issue #3507.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 16:35:14 +10:00
Damien George 916c3fd23f py/scheduler: Add optional port hook for when something is scheduled.
So that a port can "wake up" when there is work to do.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:32:16 +10:00
Damien George e9e9c76ddf all: Rename mp_keyboard_interrupt to mp_sched_keyboard_interrupt.
To match mp_sched_exception() and mp_sched_schedule().

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:13:43 +10:00
Damien George 7cbf826a95 py/scheduler: Add mp_sched_exception() to schedule a pending exception.
This helper is added to properly set a pending exception, to mirror
mp_sched_schedule(), which schedules a function.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:13:43 +10:00
Damien George 7e549b6718 py/profile: Use mp_handle_pending() to raise pending exception.
If MICROPY_ENABLE_SCHEDULER is enabled then MP_STATE_VM(sched_state) must
be updated after handling the pending exception, which is done by the
mp_handle_pending() function.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:13:43 +10:00
Jeff Epler d1e17fdccc objtype: Restore our customized behavior of instance_subscr
For pixelbuf's [] to be able to call _transmit on the Python subclass,
we need to do the subscripting operation specially.
2021-04-29 11:59:11 -05:00
microDev 1b972c51c3
add authmode class 2021-04-29 18:42:36 +05:30
Dan Halbert f06d54524d merge from adafruit 2021-04-28 23:48:26 -04:00
Dan Halbert 8500e846c6 partially working 2021-04-27 23:53:23 -04:00
Dan Halbert f98a54628b wip: compiles 2021-04-27 14:37:36 -04:00
Scott Shawcroft 17fcd499b2
Merge pull request #4649 from tannewt/merge_1.11_2
Merge MicroPython v1.11 into CircuitPython
2021-04-27 11:02:02 -07:00
Damien George c5cbfd545a py/dynruntime.h: Add mp_obj_get_array() function.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-28 00:06:46 +10:00
Damien George d4b706c4d0 py: Add option to compile without any error messages at all.
This introduces a new option, MICROPY_ERROR_REPORTING_NONE, which
completely disables all error messages.  To be used in cases where
MicroPython needs to fit in very limited systems.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-27 23:51:52 +10:00
Dan Halbert 7a40b4daec very much WIP 2021-04-26 23:54:01 -04:00
Scott Shawcroft 76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -07:00
Dan Halbert c26e49c2e6 wip: starting to try to compile 2021-04-25 23:17:41 -04:00
Dan Halbert 9d1fcc3b14 merge from main 2021-04-25 10:27:52 -04:00
Dan Halbert 2ba2574ebf
Merge pull request #4619 from tyomitch/microbit
[build] Allow USB to be set to 0
2021-04-24 10:31:29 -04:00
Scott Shawcroft 80e8b4ac14
Merge pull request #4635 from jepler/pcc
WIP: Implement 'ParallelImageCapture' for samd51
2021-04-23 13:31:53 -07:00
Artyom Skrobov 4e3c1d4a4c [build] Allow USB to be set to 0
Unify USB-related makefile var and C def as CIRCUITPY_USB.

Always define it as 0 or 1, same as all other settings.

USB_AVAILABLE was conditionally defined in supervisor.mk,
but never actually used to #ifdef USB-related code.

Loosely related to #4546
2021-04-23 11:13:34 -04:00
Damien George 3c4bfd1dec py/objexcept: Support errno attribute on OSError exceptions.
This commit adds the errno attribute to exceptions, so code can retrieve
errno codes from an OSError using exc.errno.

The implementation here simply lets `errno` (and the existing `value`)
attributes work on any exception instance (they both alias args[0]).  This
is for efficiency and to keep code size down.  The pros and cons of this
are:

Pros:
- more compatible with CPython, less difference to document and learn
- OSError().errno will correctly return None, whereas the current way of
  doing it via OSError().args[0] will raise an IndexError
- it reduces code size on most bare-metal ports (because they already have
  the errno qstr)
- for Python code that uses exc.errno the generated bytecode is 2 bytes
  smaller and more efficient to execute (compared with exc.args[0]); so
  bytecode loaded to RAM saves 2 bytes RAM for each use of this attribute,
  and bytecode that is frozen saves 2 bytes flash/ROM for each use
- it's easier/shorter to type, and saves 2 bytes of space in .py files that
  use it (for each use)

Cons:
- increases code size by 4-8 bytes on minimal ports that don't already have
  the `errno` qstr
- all exceptions now have .errno and .value attributes (a cpydiff test is
  added to address this)

See also #2407.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-23 22:03:46 +10:00
Scott Shawcroft 09f7b43c64
Merge MicroPython 1.10 into CircuitPython 2021-04-21 15:59:17 -07:00
Scott Shawcroft b057fb8a4b
codeformat 2021-04-19 22:22:44 -07:00
Dan Halbert 51ccf8dc30 wip: revert usb_descriptor changes; use raw descriptors instead 2021-04-19 23:24:18 -04:00
Jeff Epler 18548fc5d2
Merge pull request #4620 from tannewt/fix_struct_pack
Fix struct.pack with padding bytes
2021-04-19 20:43:20 -05:00
Scott Shawcroft 6620ac8bec
Fix py version of struct too. 2021-04-19 14:59:40 -07:00
Scott Shawcroft e54e5e3575
Merge pull request #4564 from tyomitch/patch-1
[build] simplify makeqstrdata heuristic
2021-04-19 14:50:42 -07:00
Jeff Epler 76d68f21ac displayio: Add RGB555/565/_SWAPPED format support
This is helpful when displaying frames from an OV7670 camera, which
uses the RGB565_SWAPPED format internally.
2021-04-19 10:23:47 -05:00
Damien George 321d1897c3 all: Bump version to 1.15.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-19 00:11:51 +10:00
Jeff Epler fc4538f845 WIP: Implement 'ParallelImageCapture' for samd51 2021-04-16 17:18:59 -05:00
Scott Shawcroft 5ccd5dc08b
Fix struct.pack with padding bytes
It used to validate the following arg could fit in a single byte.
Now, it always uses zero to pad.
2021-04-16 12:39:23 -07:00
Artyom Skrobov d9e15adb01 [repl] Don't autocomplete globals after "import " 2021-04-14 12:16:28 -04:00
Dan Halbert 4a7e129287 wip: latent usb device enabling/disabling 2021-04-13 23:33:44 -04:00
Artyom Skrobov c6ee471b52 Merge branch 'main' of https://github.com/adafruit/circuitpython into patch-3 2021-04-13 00:32:19 -04:00
Scott Shawcroft bd5a3a3ba4
Merge pull request #4583 from tyomitch/patch-2
[qstr] Separate hash and len from string data
2021-04-12 15:06:40 -07:00
matejcik 1a2ffda175 py/runtime: Make sys.modules preallocate to a configurable size.
This allows configuring the pre-allocated size of sys.modules dict, in
order to prevent unwanted reallocations at run-time (3 sys-modules is
really not quite enough for a larger project).
2021-04-12 22:36:16 +10:00
matejcik b26def0644 py/profile: Resolve name collision with STATIC unset.
When building with STATIC undefined (e.g., -DSTATIC=), there are two
instances of mp_type_code that collide at link time: in profile.c and in
builtinevex.c.  This patch resolves the collision by renaming one of them.
2021-04-12 22:31:42 +10:00
Dan Halbert c333acdbad
Merge pull request #4589 from hugodahl/feature/Remove-MicroPython-mention-in-error-messages
Make error messages platform agnostic
2021-04-10 21:30:17 -04:00
Hugo Dahl 36f3897fe3 Make error messages platform agnostic
Remove mentions of 'MicroPython' in error messages as they could lead to confusion in lesser-experienced users
2021-04-10 18:36:53 -05:00
Artyom Skrobov dcee89ade7 build: simplify compute_huffman_coding()
No functional change.
2021-04-09 08:36:26 -04:00
Artyom Skrobov 68920682b6 [build] simplify makeqstrdata heuristic
The simpler one saves, on average, 51 more bytes per translation;
the biggest translation per board is reduced, on average, by 85 bytes.
2021-04-09 07:18:40 -04:00
Damien George 5dcc9b3b16 py/py.cmake: Introduce MICROPY_INC_CORE as a list with core includes.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 13:08:35 +10:00
Damien George 0fabda31de py/py.cmake: Move qstr helper code to micropy_gather_target_properties.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 13:08:35 +10:00
Jeff Epler 3ce0b512f8 rasberrypi: IncrementalEncoder: factor out state machine 2021-04-08 16:25:47 -05:00
Artyom Skrobov c3e40d50ab [qstr] Separate hash and len from string data
This allows the compiler to merge strings: e.g. "update",
"difference_update" and "symmetric_difference_update"
will all point to the same memory.

Shaves ~1KB off the image size, and potentially allows
bigger savings if qstr attrs are initialized in qstr_init(),
and not stored in the image.
2021-04-06 12:58:42 -04:00
Artyom Skrobov 59fa9b01ad [repl] Autocomplete builtin modules 2021-04-03 16:56:02 -04:00
Artyom Skrobov 1d55dee15b [repl] Refactor autocomplete, extracting reusable parts 2021-04-03 16:54:34 -04:00
Artyom Skrobov 6e17db3286 [repl] Refactor autocomplete to reduce nesting 2021-04-03 15:54:36 -04:00
Jeff Epler fb7b968b10 py.mk: locate ulab sources with shell-find. 2021-04-02 13:09:23 -05:00
Jeff Epler dc9daba906 update ulab to 2.1.5 2021-04-02 13:09:23 -05:00
Phil Howard 0cf12dd59c rp2: Add support for USER_C_MODULES to CMake build system.
The parts that are generic are added to py/ so they can be used by other
ports that use CMake.

py/usermod.cmake:

* Creates a usermod target to hang user C/CXX modules from.
* Gathers sources from user C/CXX modules and libs for QSTR scan.

ports/rp2/CMakeLists.txt:

* Includes py/usermod.cmake.
* Links the resulting usermod library to the MicroPython target.

py/mkrules.cmake:

Add cxxflags to qstr.i.last custom command for CXX modules:

* MICROPY_CPP_FLAGS so CXX modules will find includes.
* -DNO_QSTR to fix fatal error missing "genhdr/qstrdefs.generated.h".

Usage:

The rp2 port can be linked against user C modules by running:

make USER_C_MODULES=/path/to/module/micropython.cmake

CMake will print a list of included modules.

Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.org>
Co-authored-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31 00:26:01 +11:00
Artyom Skrobov 8056af8648 [synthio] add a simple MidiTrack implementation 2021-03-26 16:38:10 -04:00
Artyom Skrobov d7dc3801ab [ure] to save space, disable debug dumps by default
Has to stay enabled in unix port for the sake of tests/extmod/ure_debug.py
2021-03-26 13:24:20 -04:00
Damien George 9fef1c0bde py: Rename remaining object types to be of the form mp_type_xxx.
For consistency with all other object types in the core.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-26 13:48:34 +11:00
Damien George 42cf77f48b py/vm: For tracing use mp_printf, and print state when thread enabled.
mp_printf should be used to print the prefix because it's also used in
mp_bytecode_print2 (otherwise, depending on the system, different output
streams may be used).

Also print the current thread state when threading is enabled to easily see
which thread executes what opcode.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-17 12:13:53 +11:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Dan Halbert 5ace7af933 disable default usb_cdc 2021-03-11 11:20:29 -05:00
Yonatan Goldschmidt e196cb762e py/nlrx64: Fix typo in comment. 2021-03-11 12:51:10 +11:00
Yonatan Goldschmidt 2d5cece5ac py/nlr: Implement NLR for AArch64. 2021-03-11 12:51:10 +11:00
Jeff Epler 1e5ffe1a53 Revert "circuitpy_mpconfig: Disable flash multi-partition"
This reverts commit 156ee4833a.
2021-03-09 11:08:36 -06:00
Scott Shawcroft b5a955a168
Merge pull request #4354 from jepler/disable-fat-partition
circuitpy_mpconfig: Disable flash multi-partition
2021-03-08 15:25:58 -08:00
Jeff Epler 156ee4833a circuitpy_mpconfig: Disable flash multi-partition
This adds some additional code in mkfs which doesn't seem necessary, and
Disabling it saves 172 bytes flash.

Testing performed: Using a Feather M0 Adalogger, checked that
 * an sdcard could still be mounted (using adafruit_sdcard)
 * os.listdir() of "/" and "/sd" worked
 * CIRCUITPY still mounted
2021-03-07 09:37:18 -06:00
Jeff Epler 4f040af481 vm: Make the speed-size trade-off compile time settable
.. and enable for all samd21 boards
2021-03-05 18:29:27 -06:00
Jeff Epler 7b359d7a8a vm: Consolodate all dispatch instructions
Flash savings: 1268 bytes
Performance: 10,000 iteration loop .665 -> .676s (+1.7%)
2021-03-05 16:52:35 -06:00
Jeff Epler 28638df589 vm: cut vmentrytable size
This also adds a bit of code everywhere we DISPATCH(), but the net is
+232 bytes free on Feather M0 Adalogger.

Key assumption: All of the offsets in mp_execute_bytecode fit in 16 bits;
it is not clear whether the compiler will verify this assumption (e.g.,
by warning that a constant will be truncated)
2021-03-05 16:52:35 -06:00
Scott Shawcroft e4f0e47d9f
Merge pull request #4233 from pewpew-game/displayio-group-list
displayio: make Group use a python list internally
2021-03-02 09:59:58 -08:00
Scott Shawcroft d0eab5c561
Merge pull request #4256 from kmatch98/bt_cleanup
Add `bitmaptools` module
2021-03-01 18:24:12 -08:00
Radomir Dopieralski 24473b7983 Separate out mp_obj_list_insert for use in display.Group
Note that for some reason this makes the binary 500 bytes larger!
2021-02-27 21:13:55 +01:00
Radomir Dopieralski e505c59ed8 Separate mp_obj_list_pop so it can be used outside of objlist.c 2021-02-27 20:52:38 +01:00
Scott Shawcroft 3f08cb47b8
Merge remote-tracking branch 'adafruit/main' into busio-uart-rp 2021-02-25 16:59:15 -08:00
Scott Shawcroft 52bc935fa7
A few minor fixes for corner cases
* Always clear the peripheral interrupt so we don't hang when full
* Store the ringbuf in the object so it gets collected when we're alive
* Make UART objects have a finaliser so they are deinit when their
  memory is freed
* Copy bytes into the ringbuf from the FIFO after we read to ensure
  the interrupt is enabled ASAP
* Copy bytes into the ringbuf from the FIFO before measuring our
  rx available because the interrupt is based on a threshold (not
  > 0). For example, a single byte won't trigger an interrupt.
2021-02-25 16:50:57 -08:00
Kevin Matocha a7a4f93ff8 Updated build configs to turn off BITMAPTOOLS for smaller builds 2021-02-25 15:44:32 -06:00
Kevin Matocha b720028642 Add bitmaptools module 2021-02-23 23:23:14 -06:00
Dan Halbert 7a4198885e Fix typos for CIRCUITPY_USB_HID_SYS_CONTROL 2021-02-23 09:22:20 -05:00
Dan Halbert 93bf269c0d Avoid pulling in extra float-uint64 routines 2021-02-21 12:05:03 -05:00
Damien George 2adf20c5f2 py/mkrules.cmake: Add MICROPY_QSTRDEFS_PORT to qstr build process.
This allows a port to specify a custom qstrdefsport.h file, the same as the
QSTR_DEFS variable in a Makefile.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-21 15:56:54 +11:00
Damien George d867d20d9a py/mkrules.cmake: Rename QSTR_DEFS variables to QSTRDEFS.
And also MICROPY_PY_QSTRDEFS to MICROPY_QSTRDEFS_PY.  These variables are
all related.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-21 15:56:54 +11:00
Jeff Epler a04369e0f5 add ifdef-guard 2021-02-20 17:41:08 -06:00
Jeff Epler 646eb9a7db py: memoryview: implement memoryview.cast if CPYTHON_COMPAT 2021-02-20 10:35:36 -06:00
Dan Halbert 076a7b7161 CIRCUITPY_BITOPS merge error 2021-02-19 15:30:27 -05:00
Dan Halbert 67406488d1 merge from upstream; re-alphabetize 2021-02-19 14:22:50 -05:00
Jeff Epler 72e8fb085c remove debug print during build 2021-02-18 16:01:23 -06:00
Jeff Epler 7fd4567893 bitops: rename from _bit_transpose, describe the algorithm 2021-02-18 15:41:23 -06:00
Jeff Epler 9cf7d73c6c core: add bit_transpose function
.. this version can only handle exactly 8 bits "across".  The restriction
may be relaxed in a future revision.
2021-02-18 11:32:47 -06:00
Dan Halbert ed49c02feb add timeout; finish up for PR 2021-02-17 23:24:11 -05:00
Maureen Helm dff6fc64d2 py: Expand lists in core cmake custom commands.
The core cmake rules use custom commands to invoke qstr processing
scripts. For the zephyr port, it's possible that list arguments to these
commands may contain generator expressions, therefore we need to expand
them properly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-16 18:38:13 +11:00
Dan Halbert 93d788543c Merge remote-tracking branch 'adafruit/main' into secondary-cdc 2021-02-15 20:03:53 -05:00
Bernhard Boser f8f59598c7 memoryview is valid argument to exec 2021-02-15 10:05:57 -08:00
Damien George 66098c0985 py,extmod: Add core cmake rule files.
These allow a port to use cmake natively instead of make.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 12:48:18 +11:00
Dan Halbert d54b5861a3 wip 2021-02-12 19:01:14 -05:00
Dan Halbert f0564b4986 merge from upstream; complicated webusb merge 2021-02-11 18:50:02 -05:00
Damien George 0a59938574 py/mpz: Fix overflow of borrow in mpn_div.
For certain operands to mpn_div, the existing code path for
`DIG_SIZE == MPZ_DBL_DIG_SIZE / 2` had a bug in it where borrow could still
overflow in the `(x >= *n || *n - x <= borrow)` branch, ie
`borrow + x - (mpz_dbl_dig_t)*n` overflows the borrow variable.  In such
cases the subsequent right-shift of borrow would not bring in the overflow
bit, leading to an error in the result.  An example division that had
overflow when MPZ_DIG_SIZE = 16 is `(2 ** 48 - 1) ** 2 // (2 ** 48 - 1)`.

This is fixed in this commit by simplifying the code and handling the low
digits of borrow first, and then the upper bits (to shift down) separately.
There is no longer a distinction between `DIG_SIZE < MPZ_DBL_DIG_SIZE / 2`
and `DIG_SIZE == MPZ_DBL_DIG_SIZE / 2`.

This commit also simplifies the second part of the calculation so that
borrow does not need to be negated (instead the code just works knowing
that borrow is negative and using + instead of - in calculations involving
borrow).

Fixes #6777.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-08 11:50:05 +11:00
Damien George 9dedcf122d py/gc: Change include of stdint.h to stddef.h.
No std-int types are used in gc.h, but size_t is which needs stddef.h.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-05 15:46:56 +11:00
Dan Halbert 0802b22ed6 usb descriptors all set; rework of enabling for USB devices 2021-02-04 19:23:40 -05:00
Damien George c891190c69 py: Rename WORD_MSBIT_HIGH to MP_OBJ_WORD_MSBIT_HIGH.
To make it clear it is for mp_obj_t/mp_uint_t "word" types, and to prefix
this macro with MP_.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-04 22:46:42 +11:00
Damien George ad4656b861 all: Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD.
The "word" referred to by BYTES_PER_WORD is actually the size of mp_obj_t
which is not always the same as the size of a pointer on the target
architecture.  So rename this config value to better reflect what it
measures, and also prefix it with MP_.

For uses of BYTES_PER_WORD in setting the stack limit this has been
changed to sizeof(void *), because the stack usually grows with
machine-word sized values (eg an nlr_buf_t has many machine words in it).

Signed-off-by: Damien George <damien@micropython.org>
2021-02-04 22:46:42 +11:00
Damien George 7e956fae28 py: Rename BITS_PER_BYTE to MP_BITS_PER_BYTE.
To give this macro a standard MP_ prefix.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-04 22:46:42 +11:00
Damien George 8a41ee19c2 py: Remove BITS_PER_WORD definition.
It's only used in one location, to test if << or >> will overflow when
shifting mp_uint_t.  For such a test it's clearer to use sizeof(lhs_val),
which will be valid even if the type of lhs_val changes.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-04 22:46:42 +11:00
Xiang Xiao 5fdf351178 py/gc: Don't include mpconfig.h and misc.h in gc.h.
Because gc.h doesn't reference any symbol from these header files.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-02-04 22:37:26 +11:00
Kevin Banks 215a56c920 Merge branch 'main' into webusb (trying to get CI back online) 2021-02-03 16:48:28 -06:00
Damien George 78b23c3a1f all: Bump version to 1.14.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-03 00:59:07 +11:00
Lucian Copeland 66639b237f Merge remote-tracking branch 'upstream/main' into sslsocket 2021-02-01 11:43:01 -05:00
iTitou 4fb5f012c3 py/makeversionhdr: Honor SOURCE_DATE_EPOCH if present.
This environment variable, if defined during the build process,
indicates a fixed time that should be used in place of "now" when
such a time is explicitely referenced.

This allows for reproducible builds of micropython.
See https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: iTitou <moiandme@gmail.com>
2021-01-31 17:48:59 +01:00
David CARLIER cb30928ac8 py/persistentcode: Introduce MICROPY_PERSISTENT_CODE_SAVE_FILE option.
This should be enabled when the mp_raw_code_save_file function is needed.

It is enabled for mpy-cross, and a check for defined(__APPLE__) is added to
cover Mac M1 systems.
2021-01-30 15:13:24 +11:00
stijn cb8e2f02ab py/gc: Fix debug printing of pointer.
When DEBUG_printf is the standard printf, compilers require the value for
%p to be an actual pointer instead of an integer.
2021-01-30 14:41:29 +11:00
stijn b9a35bebf7 py/qstr.h: Remove QSTR_FROM_STR_STATIC macro.
It practically does the same as qstr_from_str and was only used in one
place, which should actually use the compile-time MP_QSTR_XXX form for
consistency; qstr_from_str is for runtime strings only.
2021-01-30 13:40:48 +11:00
graham sanderson 794df0f1d5 py/emitnative: Support binary ops on ARMv6M without use of ite instr. 2021-01-29 23:57:10 +11:00
Damien George 75fea330bf py/emitinlinethumb: Exclude code using #if when ARMV7M disabled.
So there are no references to undeclared asm_thumb_mov_reg_i16().

Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 23:57:10 +11:00
Damien George c9f4c5acd6 py/emitnative: Ensure encoding to load prelude_offset doesn't change sz.
Based on change made by Graham Sanderson.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 23:57:10 +11:00
graham sanderson 40d2010882 py/asmthumb: Add support for ARMv6M in native emitter.
Adds a new compile-time option MICROPY_EMIT_THUMB_ARMV7M which is enabled
by default (to get existing behaviour) and which should be disabled (set to
0) when building native emitter support (@micropython.native) on ARMv6M
targets.
2021-01-29 23:57:10 +11:00
Damien George 925bd67cfb py/objfun: Support fun.__globals__ attribute.
This returns a reference to the globals dict associated with the function,
ie the global scope that the function was defined in.  This attribute is
read-only but the dict itself is modifiable, per CPython behaviour.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 23:57:10 +11:00
Kevin Banks b152c658e2 Making WebUSB default to off (build unbreakage, caught by CI) 2021-01-26 18:18:39 -06:00
Dan Halbert 13812a788f
Merge pull request #4060 from dhalbert/regularize-extmod-modules
CIRCUITPY_* switches for JSON, RE, etc. Doc cleanup
2021-01-26 12:54:21 -05:00
Dan Halbert da6869dbd5 Set MICROPY_PY_UERRNO_ERRORCODE correctly 2021-01-26 08:37:05 -05:00
Dan Halbert a9f339b461 typo in circuitpy_mpconfig.h; forgot cxd56 port 2021-01-25 22:40:31 -05:00
Kevin Banks fbfb7b68cc Most of the code we need has been pulled in from the tinyusb webusb_serial demo. Still LOTS to do regarding descriptors. 2021-01-25 20:37:58 -06:00
Scott Shawcroft a2ac2da7cc
Merge pull request #3936 from gamblor21/busdevice_fixes
Changing adafruit_bus_device to duck typing
2021-01-25 14:41:53 -08:00
Lucian Copeland 9f34ec78c4 Separate Socket and SSLSocket, add LWIP connect 2021-01-25 17:07:25 -05:00
Dan Halbert 69869e1439 CIRCUITPY_* switches for JSON, RE, etc. Doc cleanup 2021-01-24 23:10:20 -05:00
Dan Halbert e3275be8b1
Merge pull request #3911 from hugodahl/add-translation-for-builtin-object-help
Update built-in help output for localization (Issue #3907)
2021-01-22 03:49:19 -05:00
Scott Shawcroft b7a63dc498
Alphabetical 2021-01-21 10:18:04 -08:00
Scott Shawcroft 733094aead
Add initial RP2040 support
The RP2040 is new microcontroller from Raspberry Pi that features
two Cortex M0s and eight PIO state machines that are good for
crunching lots of data. It has 264k RAM and a built in UF2
bootloader too.

Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf
2021-01-20 19:16:56 -08:00
gamblor21 f50c9f4145 Reenabling busdevice in core 2021-01-16 14:21:57 -06:00
Hugo Dahl 8094435193
Merge branch 'main' of https://github.com/adafruit/circuitpython into add-translation-for-builtin-object-help 2021-01-14 22:12:30 -06:00
Jeff Epler 1ca29ec47c Merge remote-tracking branch 'origin/main' into audioout-esp32 2021-01-12 09:23:07 -06:00
Hugo Dahl 2d8404c599
Merge branch 'main' into add-translation-for-builtin-object-help 2021-01-11 18:32:07 -06:00
Scott Shawcroft ba507a8193
Merge pull request #3957 from dhalbert/gcc10-debug-builds
new CIRCUITPY_DEBUG flag passes DEBUG into C preprocessor
2021-01-11 15:36:12 -08:00
Dan Halbert 255ffa979c avoid inline compile errors 2021-01-08 23:07:21 -05:00
Jeff Epler 30c6dd3f76 Merge remote-tracking branch 'origin/main' into audioout-esp32 2021-01-07 14:11:14 -06:00
iot49 1a82555803
Merge branch 'main' into msgpack 2021-01-05 11:19:11 -08:00
Hugo Dahl ad7f4d8ae9
Merge branch 'main' of https://github.com/adafruit/circuitpython into add-translation-for-builtin-object-help
* 'main' of https://github.com/adafruit/circuitpython:
  update wake-alarm implementation
  enable light-sleep functionality
  update frozen libs for 6.1.0-beta.3
  Revert "Removing frozen libs"
  add pretend-to-sleep functionality
  expose wake pin parameter and more tweaks
  add touch alarm support for esp32s2
  implement touch alarm
2020-12-30 23:37:55 -06:00
Hugo Dahl 1407af7291
Add localization for built-in help
Support localizing the output of a call to  to match the
firmware's language.
2020-12-30 18:20:43 -06:00
microDev 28ce5e8988
Merge branch 'main' into touch-s2 2020-12-30 22:44:22 +05:30
Jeff Epler 2cd377f1a7 audiobusio: Make PDMIn optional 2020-12-29 14:06:32 -06:00
Dan Halbert 8061a2574d
Merge branch 'main' into pin_alarm 2020-12-23 22:05:02 -05:00
Jeff Epler 42a229c08b circuitpy_mpconfig.mk: Unconditionally disable CIRCUITPY_BUSDEVICE
Several issues have been found in the implementation.  While they're
unresolved, it may be better to disable the built-in module.  (This
means that to work on fixing the module, it'll be necessary to
revert this commit)
2020-12-23 10:45:07 -06:00
Scott Shawcroft 1fca297a2d
A couple sleep fixes
* Better messaging when code is stopped by an auto-reload.
* Auto-reload works during sleeps on ESP32-S2. Ticks wake up the
  main task each time.
* Made internal naming consistent. CamelCase Python names are NOT
  separated by an underscore.
2020-12-22 16:13:02 -08:00
microDev 8eaf2b0c19
implement touch alarm 2020-12-18 12:54:36 +05:30
microDev 4512290ba0
Merge branch 'main' into ota-s2 2020-12-18 00:44:00 +05:30
microDev 4863413bc9
rename ota to dualbank 2020-12-18 00:34:56 +05:30
Dan Halbert 8f9cd7075e
Merge pull request #3752 from jepler/gcc10
build: Update to gcc10
2020-12-17 11:03:40 -05:00
Scott Shawcroft 1ad49d9a18
Add alarm.pin that wakes on pin level
Fixes #3787
2020-12-15 18:12:59 -08:00
Jeff Epler afcc00fed4
Merge pull request #3771 from cwalther/exceptionprint
#3702 breaks printing an exception twice
2020-12-15 08:11:28 -06:00
Scott Shawcroft d076296659
Merge pull request #3816 from dhalbert/sleepmemory
alarm.sleep_memory + alarm.wake_alarm
2020-12-14 17:40:02 -08:00
Dan Halbert 6abe3cd0ef -Os for SAMD51; fix CSUPEROPT typo 2020-12-14 18:57:31 -05:00
Damien George 246b2e016a py/mkrules.mk: Remove stray vpath and unused -Itmp, add $(Q) for $(AR).
Signed-off-by: Damien George <damien@micropython.org>
2020-12-14 13:57:15 +11:00
Damien George 0091041f5a py/modmath: Simplify handling of positional args to reduce code size.
As a general pattern, required positional arguments that are not named do
not need to be parsed using mp_arg_parse_all().

Signed-off-by: Damien George <damien@micropython.org>
2020-12-14 13:30:56 +11:00
microDev 37ee5e683d
Merge branch 'main' into ota-s2 2020-12-12 05:25:46 +05:30
Scott Shawcroft 344d3c59cb
Merge branch 'main' into msgpack 2020-12-11 11:10:30 -08:00