Commit Graph

10438 Commits

Author SHA1 Message Date
Eric Poulsen
01054f2092 py/objdict: Quote non-string types when used as keys in JSON output.
JSON requires that keys of objects be strings.  CPython will therefore
automatically quote simple types (NoneType, bool, int, float) when they are
used directly as keys in JSON output.  To prevent subtle bugs and emit
compliant JSON, MicroPython should at least test for such keys so they
aren't silently let through.  Then doing the actual quoting is a similar
cost to raising an exception, so that's what is implemented by this patch.

Fixes issue #4790.
2019-07-30 16:34:27 +10:00
Damien George
8f55a8fab6 travis: Build an stm32 board with threading enabled to test it with CI. 2019-07-26 12:44:47 +10:00
Damien George
473157eeb9 stm32/usbd_hid_interface: Include extra header to build with threading. 2019-07-26 12:44:14 +10:00
Damien George
ad0b7cb017 stm32/boards/xxx_WB55: Enable USB HID now that it works on WB MCUs. 2019-07-25 17:49:53 +10:00
Damien George
fa07deda9f stm32/usbd_hid_interface: Rewrite USB HID interface code.
The previous version did not work on MCUs that only had USB device mode
(compared to OTG) because of the handling of NAK.  And this previous
handling of NAK had a race condition where a new packet could come in
before USBD_HID_SetNAK was called (since USBD_HID_ReceivePacket clears NAK
as part of its operation).  Furthermore, the double buffering of incoming
reports was not working, only one buffer could be used at a time.

This commit rewrites the HID interface code to have a single incoming
buffer, and only calls USBD_HID_ReceivePacket after the user has read the
incoming report (similar to how the VCP does its flow control).  As such,
USBD_HID_SetNAK and USBD_HID_ClearNAK are no longer needed.

API functionality from the user's point of view should be unchanged with
this commit.
2019-07-25 17:42:17 +10:00
Damien George
b1129df478 stm32/dma: Fix re-start of DMA stream by clearing all event flags.
As per the datasheet, all event flags for a stream must be cleared before
enabling it.  Fixes issue #4944 (with DAC.write_timed).
2019-07-25 16:48:26 +10:00
Yonatan Goldschmidt
e9593d5075 py/sequence: Fix grammar in comment about equality. 2019-07-25 16:37:25 +10:00
badlyby
3b258ef213 stm32/boards/NUCLEO_F722ZE: Add definition files for new board. 2019-07-25 16:31:36 +10:00
badlyby
09267bb147 stm32/boards/stm32f722.ld: Provide memory regions for internal FS. 2019-07-25 16:31:36 +10:00
badlyby
0da2f6f23a stm32/flashbdev: Support internal filesystem on STM32F722/23/32/33. 2019-07-25 16:31:12 +10:00
Damien George
4d94fae833 tools/pyboard.py: Add filesystem commands to ls/cat/cp/rm remote files.
Use "-f" to select filesystem mode, followed by the command to execute.
Optionally put ":" at the start of a filename to indicate that it's on the
remote device, if it would otherwise be ambiguous.

Examples:

    $ pyboard.py -f ls
    $ pyboard.py -f cat main.py
    $ pyboard.py -f cp :main.py .   # get from device
    $ pyboard.py -f cp main.py :    # put to device
    $ pyboard.py -f rm main.py
2019-07-25 15:56:01 +10:00
Amir Gonnen
995f9cfdfc esp32: Pin MicroPython tasks to a specific core.
On this port the GIL is enabled and everything works under the assumption
of the GIL, ie that a given task has exclusive access to the uPy state, and
any ISRs interrupt the current task and therefore the ISR inherits
exclusive access to the uPy state for the duration of its execution.

If the MicroPython tasks are not pinned to a specific core then an ISR may
be executed on a different core to the task, making it possible for the
main task and an ISR to execute in parallel, breaking the assumption of the
GIL.

The easiest and safest fix for this is to pin all MicroPython related code
to the same CPU core, as done by this patch.  Then any ISR that accesses
MicroPython state must be registered from a MicroPython task, to ensure it
is invoked on the same core.

See issue #4895.
2019-07-25 15:33:47 +10:00
Damien George
e3e7e3a781 esp32/Makefile: Simplify include of IDF source by using wildcards. 2019-07-20 14:07:18 +10:00
Damien George
b88e51d718 esp32/Makefile: Put OBJ and LIB rule additions in gen_espidf_lib_rule. 2019-07-20 13:04:55 +10:00
Jim Mussared
331c224e07 esp32/Makefile: Fix path expansion for ESPIDF_DRIVER_O.
It was using subst to s/.c/.o/ which changed .c anywhere in the path.
2019-07-20 12:32:43 +10:00
stijn
9da46a98cb windows/mpconfigport.h: Don't define restrict/inline/alignof for C++.
The C++ standard forbids redefining keywords, like inline and alignof, so
guard these definitions to avoid that, allowing to include the MicroPython
headers by C++ code.
2019-07-19 16:58:02 +10:00
Damien George
a29334761d esp32: Add support for hardware I2C. 2019-07-19 16:31:25 +10:00
Damien George
3967dd68e8 tests/run-perfbench.py: Add --emit option to select emitter for tests. 2019-07-19 14:07:41 +10:00
Damien George
0c12adca46 stm32/boards/USBDONGLE_WB55: Add definition files for new board. 2019-07-17 17:00:34 +10:00
Damien George
d2a8fb747f stm32/boards/NUCLEO_WB55: Add definition files for new board. 2019-07-17 17:00:34 +10:00
Damien George
9849567a06 stm32/boards: Add MCU support files for STM32WB55. 2019-07-17 16:50:42 +10:00
Damien George
59b7166d87 stm32: Add initial support for STM32WBxx MCUs.
This new series of MCUs is similar to the L4 series with an additional
Cortex-M0 coprocessor.  The firmware for the wireless stack must be managed
separately and MicroPython does not currently interface to it.  Supported
features so far include: RTC, UART, USB, internal flash filesystem.
2019-07-17 16:33:31 +10:00
Damien George
d42392b9a7 stm32/make-stmconst.py: Allow more variation in parens and int-suffix L. 2019-07-17 16:27:17 +10:00
Damien George
02b2ad4fbd stm32/boards/STM32F769DISC: Fix length of FLASH_APP section.
Fixes issue #4924.
2019-07-17 16:19:50 +10:00
Paul m. p. P
3b3a4749ce py/objstringio: Guard bytesio_stream_p struct w/ MICROPY_PY_IO_BYTESIO.
It's static and can lead to a compilation warning/error when
MICROPY_PY_IO_BYTESIO is disabled.
2019-07-17 16:12:19 +10:00
Jim Mussared
bc66fe9064 py/scheduler: Rename sched_stack to sched_queue.
Behaviour was changed from stack to queue in
8977c7eb58, and this updates variable names
to match.  Also updates other references (docs, error messages).
2019-07-17 16:09:32 +10:00
Damien George
3e55830066 tests/stress/recursive_iternext.py: Increase large depth to 5000.
So it fails correctly on Linux with clang.
2019-07-17 15:52:41 +10:00
Damien George
a67d9155e6 travis: Switch unix stackless build to use clang.
To test a different compiler, other than gcc.
2019-07-17 15:52:27 +10:00
Damien George
baea43bba7 stm32/boards/B_L072Z_LRWAN1: Enable USB VCP support. 2019-07-16 14:50:44 +10:00
Damien George
64aebca155 stm32/Makefile: Allow a board to disable float support.
By using "MICROPY_FLOAT_IMPL = none" in its mpconfigboard.mk file.
2019-07-16 14:47:32 +10:00
Damien George
102d9911e9 stm32/mphalport: Fix GPIO clock enable for L0 MCUs. 2019-07-16 14:47:12 +10:00
Damien George
4096fa397b stm32/powerctrlboot: Increase SYSCLK to 32MHz for L0 MCUs. 2019-07-16 14:46:31 +10:00
Damien George
4c1ad1f691 stm32: Add support for USB on L0 MCUs. 2019-07-16 14:45:53 +10:00
Damien George
788e7f50f2 stm32/usbd_cdc_interface: Make CDC TX/RX buffer sizes configurable. 2019-07-16 14:41:59 +10:00
Damien George
f302f784e9 stm32/usb: Add config options to disable USB MSC and/or HID.
The new configurations MICROPY_HW_USB_MSC and MICROPY_HW_USB_HID can be
used by a board to enabled or disable MSC and/or HID.  They are both
enabled by default.
2019-07-16 14:39:21 +10:00
Paul m. p. P
154062d9cb py/makeqstrdata.py: Allow using \r\n as a qstr if a port requires it. 2019-07-12 17:10:11 +10:00
David Lechner
82dc9856b0 py/asmarm: Use __builtin___clear_cache instead of __clear_cache.
__clear_cache causes a compile error when using clang.  Instead use
__builtin___clear_cache which is available under both gcc and clang.

Also replace tabs with spaces in this section of code (introduced by a
previous commit).
2019-07-12 16:48:37 +10:00
Damien George
d6e3038a08 ACKNOWLEDGEMENTS: Remove entry as requested by backer. 2019-07-12 12:57:37 +10:00
Damien George
fd49fcb229 stm32/gccollect: Always use MP_STATE_THREAD(stack_top) to get stack top.
In a non-thread build, using &_ram_end as the top-of-stack is no longer
correct because the stack is not always at the very top end of RAM.  See
eg 04c7cdb668 and
3786592097.  The correct value to use is
&_estack, which is the value stored in MP_STATE_THREAD(stack_top), and
using the same code for both thread and non-thread builds makes the code
cleaner.
2019-07-11 17:32:01 +10:00
Laurens Valk
a73859d5af py/objgenerator: Add missing #if guard for PY_GENERATOR_PEND_THROW.
Without it, gen_instance_pend_throw_obj is defined but not used when
MICROPY_PY_GENERATOR_PEND_THROW is set to 0.
2019-07-09 13:24:23 +10:00
Paul m. p. P
a1c870e9f4 javascript: Enable support for frozen bytecode via FROZEN_MPY_DIR. 2019-07-09 13:17:15 +10:00
Paul m. p. P
42d30c5baf unix/unix_mphal: Include time.h for CLOCK_MONOTONIC. 2019-07-09 13:05:59 +10:00
Damien George
a17b901a9e stm32/boards/B_L072Z_LRWAN1: Add definition files for new board. 2019-07-09 12:54:09 +10:00
Damien George
14f61a224d travis: Build stm32 mboot for PYBD_SF6 as part of CI. 2019-07-09 11:47:57 +10:00
Damien George
278e9bffe9 stm32/mboot: Update dependencies to enable parallel build with -j. 2019-07-09 11:46:47 +10:00
Damien George
342539bdcc stm32/mboot: Use STARTUP_FILE from stm32lib. 2019-07-09 11:35:47 +10:00
Damien George
5a81d2d6b8 stm32/mboot: Remove use of BSRRL/H for H7 MCUs due to stm32lib update. 2019-07-09 11:34:54 +10:00
Damien George
c8f19f1371 stm32/mboot: Make _estack an array to avoid compiler warnings.
The compiler can warn about out-of-bounds array access if _estack is just a
single uint8_t.
2019-07-09 11:33:57 +10:00
Damien George
d43dd886a5 stm32/boards/NUCLEO_F413ZH: Remove STARTUP_FILE, it's defined globally.
The Makefile now defines this variable to the correct value (but it can
still be overridden by a board if necessary).
2019-07-09 11:32:12 +10:00
Chris Mason
c24d81119c stm32/boards/NUCLEO_L452RE: Add definition files for new board. 2019-07-08 16:50:45 +10:00