aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-02-15esp32/boards: Enable BLE on all boards.Damien George
BLE was enabled by default on all boards in the existing make build. Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32/boards: Remove old IDF v3 sdkconfig values.Damien George
IDF v3 is no longer supported with the move to cmake. Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32: Remove traditional "make" capability.Damien George
It's now replaced by cmake/idf.py. But a convenience Makefile is still provided with traditional targets like "all" and "deploy". Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32: Add explicit initialisers to silence compiler warnings.Damien George
This makes no functional change. See similar commit 9aa58cf8bac353297ff5e7b4f3331e5618046095 Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32/esp32_rmt: Don't do unnecessary check for unsigned less than zero.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32: Add support to build using IDF with cmake.Damien George
This commit adds support for building the esp32 port with cmake, and in particular it builds MicroPython as a component within the ESP-IDF. Using cmake and the ESP-IDF build infrastructure makes it much easier to maintain the port, especially with the various new ESP32 MCUs and their required toolchains. Signed-off-by: Damien George <damien@micropython.org>
2021-02-15py,extmod: Add core cmake rule files.Damien George
These allow a port to use cmake natively instead of make. Signed-off-by: Damien George <damien@micropython.org>
2021-02-14stm32/mpbthciport: Only init the uart once, then use uart_set_baudrate.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-14stm32/uart: Add uart_set_baudrate function.Damien George
This allows changing the baudrate of the UART without reinitialising it (reinitialising can lead to spurious characters sent on the TX line). Signed-off-by: Damien George <damien@micropython.org>
2021-02-13extmod/uasyncio: Add asyncio.current_task().Jim Mussared
Matches CPython behavior. Fixes #6686
2021-02-13tools: Add filesystem action examples to pyboard.py help.Brianna Laugher
Signed-off-by: Brianna Laugher <brianna.laugher@gmail.com>
2021-02-13nrf/drivers/usb: Add USBD_IRQHandler which calls tud_int_handler.Damien George
This is needed for TinyUSB to process USB device IRQs. Related to #6325. Signed-off-by: Damien George <damien@micropython.org>
2021-02-12samd/mphalport: Fix USB CDC tx handling to work reliably.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-12mimxrt: Fix USB CDC handling so it works reliably.Damien George
On i.MX the SysTick IRQ cannot wake the CPU from a WFI so the CPU was blocked on WFI waiting for USB data in mp_hal_stdin_rx_chr() even though it had already arrived (because it may arrive just after calling the check tud_cdc_available()). This commit fixes this problem by using SEV/WFE to indicate that there has been a USB event. The mp_hal_stdout_tx_strn() function is also fixed so that it doesn't overflow the USB buffers. Signed-off-by: Damien George <damien@micropython.org>
2021-02-12rp2: Use local tinyusb instead of the one in pico-sdk.Damien George
So that all MicroPython ports that use tinyusb use the same version. Also requires fewer submodule checkouts when building rp2 along with other ports that use tinyusb. Signed-off-by: Damien George <damien@micropython.org>
2021-02-12ports: Update to build with new tinyusb.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-12lib/tinyusb: Update to version 0.8.0.Damien George
Includes support for RP2040. Signed-off-by: Damien George <damien@micropython.org>
2021-02-12extmod/btstack: Enable SYNC_EVENTS, PAIRING_BONDING by default.Damien George
Synchronous events work on stm32 and unix ports. Signed-off-by: Damien George <damien@micropython.org>
2021-02-12extmod/btstack: Add stub functions for passkey, l2cap bindings.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-12extmod/btstack: Add HCI trace debugging option in btstack_hci_uart.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-12unix/mpbtstackport_common: Implement mp_bluetooth_hci_active.Damien George
So that BTSTACK can be enabled with SYNC_EVENTS. Signed-off-by: Damien George <damien@micropython.org>
2021-02-11tests/extmod/vfs_posix.py: Add more tests for VfsPosix class.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-11extmod/vfs_posix_file: Allow closing an already closed file.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-09esp8266/modules: Fix fs_corrupted() to use start_sec not START_SEC.Damien George
START_SEC was changed in e0905e85a7ad2961aa9192f6130565860e531ad3. Also, update the error message to mention how to format the partition at the REPL, and make the total message shorter to save a bit of flash. Signed-off-by: Damien George <damien@micropython.org>
2021-02-08py/mpz: Fix overflow of borrow in mpn_div.Damien George
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-05py/gc: Change include of stdint.h to stddef.h.Damien George
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-05rp2/micropy_rules.cmake: Fix makemoduledefs vpath to work with abs path.Damien George
In particular the firmware can now be built in a build directory that lives outside the source tree, and the py/modarray.c file will still be found. See issue #6837. Signed-off-by: Damien George <damien@micropython.org>
2021-02-04py: Rename WORD_MSBIT_HIGH to MP_OBJ_WORD_MSBIT_HIGH.Damien George
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-04all: Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD.Damien George
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-04py: Rename BITS_PER_BYTE to MP_BITS_PER_BYTE.Damien George
To give this macro a standard MP_ prefix. Signed-off-by: Damien George <damien@micropython.org>
2021-02-04py: Remove BITS_PER_WORD definition.Damien George
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-04ports: Remove def of MP_PLAT_PRINT_STRN if it's the same as the default.Damien George
To simplify config, there's no need to specify MP_PLAT_PRINT_STRN if it's the same as the default definition in py/mpconfig.h. Signed-off-by: Damien George <damien@micropython.org>
2021-02-04py/gc: Don't include mpconfig.h and misc.h in gc.h.Xiang Xiao
Because gc.h doesn't reference any symbol from these header files. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-02-04rp2/machine_adc: Only initialise the ADC periph if not already enabled.Damien George
Otherwise it resets the ADC peripheral each time a new ADC object is constructed, which can reset other state that has already been set up. See issue #6833. Signed-off-by: Damien George <damien@micropython.org>
2021-02-03all: Bump version to 1.14.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-03docs/library/machine.Pin.rst: Make it clear which methods are not core.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-02rp2/modmachine: Implement additional functions incl unique_id and idle.Damien George
Added functions in the machine module are: - unique_id (returns 8 bytes) - soft_reset - idle - lightsleep, deepsleep (not power saving at the moment) - disable_irq, enable_irq - time_pulse_us Signed-off-by: Damien George <damien@micropython.org>
2021-02-02windows/msvc: Use same default python command as core.stijn
2021-02-02tests/run-tests: Change default Python command used on Windows.stijn
Default to just calling python since that is most commonly available: the official installer or zipfiles from python.org, anaconda, nupkg all result in python being available but not python3. In other words: the default used so far is wrong. Note that os.name is 'posix' when running the python version which comes with Cygwin or MSys2 so they are not affected by this. However of all possible ways to get Python on Windows, only Cygwin provides no python command so update the default way for running tests in the README.
2021-02-02stm32/mboot: Change debug compiler optimisation from -O0 to -Og.Andrew Leech
With mboot encrpytion and fsload enabled, the DEBUG build -O0 compiler settings result in mboot no longer fitting in the 32k sector. This commit changes this to -Og which also brings it into line with the regular stm32 build.
2021-02-02stm32/usbd_cdc_interface: Don't wait in usbd_cdc_tx_always if suspended.Damien George
MCUs with device-only USB peripherals (eg L0, WB) do not implement (at least not in the ST HAL) the HAL_PCD_DisconnectCallback event. So if a USB cable is disconnected the USB driver does not deinitialise itself (usbd_cdc_deinit is not called) and the CDC driver can stay in the USBD_CDC_CONNECT_STATE_CONNECTED state. Then if the USB was attached to the REPL, output can become very slow waiting in usbd_cdc_tx_always for 500ms for each character. The disconnect event is not implemented on these MCUs but the suspend event is. And in the situation where the USB cable is disconnected the suspend event is raised because SOF packets are no longer received. The issue of very slow output on these MCUs is fixed in this commit (really worked around) by adding a check in usbd_cdc_tx_always to see if the USB device state is suspended, and, if so, breaking out of the 500ms wait loop. This should also help all MCUs for a real USB suspend. A proper fix for MCUs with device-only USB would be to implement or somehow synthesise the HAL_PCD_DisconnectCallback event. See issue #6672. Signed-off-by: Damien George <damien@micropython.org>
2021-02-02examples/rp2: Add pio_uart_rx.py example.Tim Radvan
This was adapted from the `pio/uart_rx` example from the `pico-examples` repository: https://github.com/raspberrypi/pico-examples/blob/master/pio/uart_rx/uart_rx.pio It demonstrates the `jmp_pin` feature in action. Signed-off-by: Tim Radvan <tim@tjvr.org>
2021-02-02rp2/rp2_pio: Add JMP PIN support for PIO.Tim Radvan
PIO state machines can make a conditional jump on the state of a pin: the `JMP PIN` command. This requires the pin to be configured with `sm_config_set_jmp_pin`, but until now we didn't have a way of doing that in MicroPython. This commit adds a new `jmp_pin=None` argument to `StateMachine`. If it is not `None` then we try to interpret it as a Pin, and pass its value to `sm_config_set_jmp_pin`. Signed-off-by: Tim Radvan <tim@tjvr.org>
2021-02-02lib/pico-sdk: Update to latest version v1.0.1.Damien George
In particular it fixes GPIO19 so that it can be used as an output. Signed-off-by: Damien George <damien@micropython.org>
2021-02-02rp2/memmap_mp.ld: Update for latest SDK.graham sanderson
2021-02-02rp2/machine_pin: Change N_GPIOS to NUM_BANK0_GPIOS for pico-sdk compat.Andrew Scheller
This fixes machine_pin.c to build against the new pico-sdk coming down the pipeline, whilst still working with the existing version.
2021-02-01zephyr/machine_uart: Fix arg of machine_uart_ioctl to make it uintptr_t.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-01tests/extmod/utime_time_ns.py: Relax bounds on time_ns measurement.Damien George
Some devices have lower precision than 1ms for time_ns() (eg PYBv1.x has 3.9ms resolution of the RTC) so make the test more lenient for them. Signed-off-by: Damien George <damien@micropython.org>
2021-02-01github/workflows/ports_unix.yml: Add job for a reproducible build.iTitou
With a check for reproducible build date. Invocation of the test suite is not needed because it's already run in another job. Signed-off-by: iTitou <moiandme@gmail.com>
2021-01-31py/makeversionhdr: Honor SOURCE_DATE_EPOCH if present.iTitou
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>