summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-07-01tools/pyboard.py: Add cmd-line option to make soft reset configurable.Frank Pilhofer
Leaves the default as-is, but allows using --no-soft-reset to disable the soft reset when connecting.
2021-07-01tools/autobuild: Add mimxrt port to build scripts for nightly builds.robert-hh
The firmware for Teensy 4.0, Teensy 4.1 and MIMXRT1020_EVK are created. Users of other MIMXRT10xx_EVK boards should be able to build the firmware themselves, they might need specific DEBUG settings. The Makefile had to be changed in order to build the .bin file as well.
2021-07-01stm32/main: Call mp_deinit() at end of main.David Lechner
This adds a call to mp_deinit() in the main function of the STM32 port. This enables the use of MICROPY_PORT_DEINIT_FUNC on that port, as well as cleaning up the GIL if threading is enabled.
2021-07-01stm32/dma: Add DMAMUX configuration for H7 to fix dma_nohal_init.iabdalkader
Fixes issue #5619.
2021-07-01stm32/sdio: Fix undefined reference to DMA stream on H7.iabdalkader
Follow up to a96afae90f6e5d693173382561d06e583b0b5fa5
2021-06-30stm32/boardctrl: Skip running main.py if boot.py had an error.Damien George
Previous behaviour was: if boot.py had an exception then main.py would still run, which is arguably unexpected behaviour. This commit changes the behaviour so main.py is not run if boot.py has an error. Signed-off-by: Damien George <damien@micropython.org>
2021-06-28tools/makemanifest.py: Allow passing flags to mpy-tool.py.Yonatan Goldschmidt
2021-06-26extmod/uasyncio: Get addr and bind server socket before creating task.Damien George
Currently when using uasyncio.start_server() the socket configuration is done inside a uasyncio.create_task() background function. If the address and port are already in use however this throws an OSError which cannot be cleanly caught behind the create_task(). This commit moves the getaddrinfo and socket binding to the start_server() function, and only creates the task if that succeeds. This means that any OSError from the initial socket configuration is propagated directly up the call stack, compatible with CPython behaviour. See #7444. Signed-off-by: Damien George <damien@micropython.org>
2021-06-26mimxrt/modmachine: Add a few minor methods to the machine module.robert-hh
Mostly for compatibility reasons: - idle() - disable_irq() - enable_irq() - time_pulse_us()
2021-06-26mimxrt/mimxrt_flash: Remove commented-out code.robert-hh
2021-06-26mimxrt/main: Extend the information returned by help().robert-hh
2021-06-26mimxrt/main: Skip running main.py if boot.py failed.robert-hh
See related #7379.
2021-06-26mimxrt/boards: Set vfs partition start to 1 MBbyte.robert-hh
This avoids the irritation of the PJRC HalfKay loader on Teensy 4.0. Block 0 and 1 are properly erased and the additional formatting in the make script is not required anymore.
2021-06-26mimxrt/moduos: Seed the PRNG on boot using the TRNG.robert-hh
2021-06-26mimxrt/machine_spi: Add the SPI class to the machine module.robert-hh
This class supports SPI bus controller mode, with blocking transfers. SPI device numbers start at 0, to comply with the pinout of the Teensy boards. With the configured clock frequency the fastest baud rate is 33MHz. For messages longer 16 bytes DMA is used. The class uses the existing framework with extmod/machine_spi.c. Extended driver options: - drive=n with n being between 1 and 6 or PIN.POWER_1 to PIN.POWER_6. Since the pins used by the SPI are fixed, no Pin settings can be made. Thus the drive option is added allowing to control ringing and crosstalk on the connection. - gap_ns=nnnnn is the time between sent data items in a frame given in ns. Default is 2 clock cycles.
2021-06-26github/workflows: Switch from lcov to gcov.Damien George
Coverage calculated by Codecov has the same reliability/deterministic issues as Coveralls did, so the problem is likely to do with the output of lcov/gcov, rather than the analysis and display of the data. Switch from lcov to gcov for data generation to try and simplify this process of computing coverage. Signed-off-by: Damien George <damien@micropython.org>
2021-06-25github/workflows: Switch from Coveralls to Codecov.Damien George
As discussed in #7455, Coveralls doesn't work properly anymore, it has many spurious errors with reduced coverage. Signed-off-by: Damien George <damien@micropython.org>
2021-06-25esp32/esp32_rmt: Fix RMT looping in newer IDF versions.Jonathan Hogg
When looping, now disable the TX interrupt after calling rmt_write_items() function to handle change in IDF behaviour (since v4.1). Also check length of pulses to ensure it fits hardware limit. Fixes issue #7403.
2021-06-25tests/extmod: Make uasyncio_heaplock test more deterministic.Damien George
This helps the test pass on systems with an inaccurate sleep time. Signed-off-by: Damien George <damien@micropython.org>
2021-06-25github/workflows: Add workflow to build and test javascript port.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-06-25javascript: Rework Makefile and GC so it works with latest Emscripten.Damien George
The GC now works correctly using asyncify and the functions emscripten_scan_stack() and emscripten_scan_registers(). Stack/call depth is monitored via the use of the pystack option. Fixes issue #6738. Signed-off-by: Damien George <damien@micropython.org>
2021-06-25py: Mark unused arguments from bytecode decoding macros.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-06-25py/makeqstrdefs.py: Don't include .h files explicitly in preprocessing.Damien George
Only include .c and .cpp files explicitly in the list of files passed to the preprocessor for QSTR extraction. All relevant .h files will be included in this process by "#include" from the .c(pp) files. In particular for moduledefs.h, this is included by py/objmodule.c (and doesn't actually contain any extractable MP_QSTR_xxx, but rather defines macros with MP_QSTR_xxx's in them which are then part of py/objmodule.c). The main reason for this change is to simplify the preprocessing step on the javascript port, which tries to compile .h files as C++ precompiled headers if they are passed with -E to clang. Signed-off-by: Damien George <damien@micropython.org>
2021-06-25mpy-cross: Disable stack check when building with Emscripten.David Lechner
`mpy-cross` can be compiled to WASM using Emscripten, but it is not happy unless the stack check is disabled. Signed-off-by: David Lechner <david@pybricks.com>
2021-06-25tools/ci.sh: Run apt-get update in ci_powerpc_setup.David Lechner
This fixes failing builds when the GitHub CI image lags behind Ubuntu security updates.
2021-06-25rp2/machine_rtc: In RTC.datetime, compute weekday automatically.Krzysztof Adamski
Calculating the weekday each time you want to set a date is error prone and tiresome. MicroPython can do it on its own - hardware on some ports do not support storing weekday in hardware and always computes it on the fly, ignoring the value given to the constructor. During discussion for #7432 the conclusion was that there seems to be no obvious reason to let user set the weekday to an incorrect value so it makes sense to just ignore the provided weekday value and always compute the correct value. This patch introduces this change for the rp2 port. Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-06-25rp2: Use 0=Monday datetime convention in RTC.Krzysztof Adamski
The RTC in rp2 can store any, even wrong, number as a weekday in RTC. It was, however, discussed in #7394 that we would like to unify all ports and use 0 as Monday, not Sunday in the machine.RTC implementation. This patch makes sure that the default date set in RTC is adheres to this convention. It also fixes the example in quickref to use proper weekday to avoid confusion. Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-06-25mimxrt: Move calc_weekday helper function to timeutils.Krzysztof Adamski
This function may be useful for other ports as well so lets move it to timeutils so it can be reused. Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-06-24py/mperrno: Add MP_ECANCELED error code.David Lechner
This is useful when binding asynchronous functions in C. Signed-off-by: David Lechner <david@pybricks.com>
2021-06-24unix/modffi: Add option to lock GC in callback, and cfun access.Amir Gonnen
Add an optional 'lock' kwarg to callback that locks GC and scheduler. This allows the callback to be invoked asynchronously in 'interrupt context', for example as a signal handler. Also add the 'cfun' member function to callback, that allows retrieving the C callback function address. This is needed when the callback should be set to a struct field. See related #7373. Signed-off-by: Amir Gonnen <amirgonnen@gmail.com>
2021-06-24all: Fix signed shifts and NULL access errors from -fsanitize=undefined.Jeff Epler
Fixes the following (the line numbers match commit 0e87459e2bfd07): ../../extmod/crypto-algorithms/sha256.c:49:19: runtime error: left shif... ../../extmod/moduasyncio.c:106:35: runtime error: member access within ... ../../py/binary.c:210:13: runtime error: left shift of negative value -... ../../py/mpz.c:744:16: runtime error: negation of -9223372036854775808 ... ../../py/objint.c:109:22: runtime error: left shift of 1 by 31 places c... ../../py/objint_mpz.c:374:9: runtime error: left shift of 4611686018427... ../../py/objint_mpz.c:374:9: runtime error: left shift of negative valu... ../../py/parsenum.c:106:14: runtime error: left shift of 46116860184273... ../../py/runtime.c:395:33: runtime error: left shift of negative value ... ../../py/showbc.c:177:28: runtime error: left shift of negative value -... ../../py/vm.c:321:36: runtime error: left shift of negative value -1``` Testing was done on an amd64 Debian Buster system using gcc-8.3 and these settings: CFLAGS += -g3 -Og -fsanitize=undefined LDFLAGS += -fsanitize=undefined The introduced TASK_PAIRHEAP macro's conditional (x ? &x->i : NULL) assembles (under amd64 gcc 8.3 -Os) to the same as &x->i, since i is the initial field of the struct. However, for the purposes of undefined behavior analysis the conditional is needed. Signed-off-by: Jeff Epler <jepler@gmail.com>
2021-06-24esp32/main: Allow MICROPY_DIR to be overridden.Damien George
This is necessary when building a custom out-of-tree board. Signed-off-by: Damien George <damien@micropython.org>
2021-06-23tools: Remove obsolete build-stm-latest.sh script.Damien George
The tools/autobuild/ scripts replace this. Signed-off-by: Damien George <damien@micropython.org>
2021-06-23tools/autobuild: Add scripts to build release firmware.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-06-23stm32/usb: Make irq's default trigger enable all events.Damien George
Following how other .irq() methods work on other objects. Signed-off-by: Damien George <damien@micropython.org>
2021-06-23extmod/btstack: Check that BLE is active before performing operations.Damien George
Otherwise it can easily lead to a hard crash. Signed-off-by: Damien George <damien@micropython.org>
2021-06-23extmod/btstack: Add missing call to mp_bluetooth_hci_uart_deinit.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-06-23stm32: Provide a custom BTstack runloop that integrates with soft timer.Damien George
It reschedules the BT HCI poll soft timer so that it is called exactly when the next timer expires. Signed-off-by: Damien George <damien@micropython.org>
2021-06-23stm32/mpbthciport: Change from systick to soft-timer for BT scheduling.Damien George
Instead of using systick the BT subsystem is now scheduled using a soft timer. This means it is scheduled only when it is enabled. Signed-off-by: Damien George <damien@micropython.org>
2021-06-23stm32/softtimer: Add soft_timer_reinsert() helper function.Damien George
And call mp_pairheap_init_node() in soft_timer_static_init() so that reinsert can be called after static_init. Signed-off-by: Damien George <damien@micropython.org>
2021-06-22esp32,esp8266: Add __len__ to NeoPixel driver to support iterating.Michael Weiss
Signed-off-by: mishafarms <github@mishafarms.us>
2021-06-22LICENSE: Reference third-party licenses.Jim Mussared
This is to provide a summary of the licenses used by MicroPython. - Add SPDX identifier for every directory that includes non-MIT-licensed content. - Add brief summary. - Update docs license to be more explicit. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-06-20esp32/boards/sdkconfig.base: Disable MEMPROT_FEATURE to alloc from IRAM.Damien George
Dynamically generate/loaded native code (eg from @micropython.native or native .mpy files) needs to be able allocate from IRAM, and the memory protection feature must be disabled for that to work. Disabling it is needed to get native code working on ESP32-S2 and -C3. Signed-off-by: Damien George <damien@micropython.org>
2021-06-19py/mpstate: Schedule KeyboardInterrupt on main thread.David Lechner
This introduces a new macro to get the main thread and uses it to ensure that asynchronous exceptions such as KeyboardInterrupt (CTRL+C) are only scheduled on the main thread. This is more deterministic than being scheduled on a random thread and is more in line with CPython that only allow signal handlers to run on the main thread. Fixes issue #7026. Signed-off-by: David Lechner <david@pybricks.com>
2021-06-19py/mpstate: Make exceptions thread-local.David Lechner
This moves mp_pending_exception from mp_state_vm_t to mp_state_thread_t. This allows exceptions to be scheduled on a specific thread. Signed-off-by: David Lechner <david@pybricks.com>
2021-06-18all: Bump version to 1.16.v1.16Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-06-18tests/float: Make bytes/bytearray construct tests work with obj repr C.Damien George
2.5 can be represented correctly in object representation C, but 2.3 cannot (it is slightly truncated). Signed-off-by: Damien George <damien@micropython.org>
2021-06-18py/gc: Only use no_sanitize_address attribute for GCC 4.8 and above.Damien George
It's not supported on older GCC versions. Signed-off-by: Damien George <damien@micropython.org>
2021-06-18esp8266/boards/GENERIC_512K: Add custom minimal _boot.py.Damien George
Commit 0abf6f830cd390e2e5dbd4a2c68f611f5c9507dc removed _boot.py from the manifest for the GENERIC_512K board because the build does not include a filesystem. But the main code expects _boot.py to be there and prints an error if it's not. So add a custom _boot.py, which just sets the gc.threshold(). Signed-off-by: Damien George <damien@micropython.org>
2021-06-18esp32/machine_sdcard: Use deinit_p to deinit SD bus in SPI mode.Damien George
Fixes issue #7352. Signed-off-by: Damien George <damien@micropython.org>