-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Merge in MicroPython 1.15 #4749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 micropython#6833. Signed-off-by: Damien George <[email protected]>
Because gc.h doesn't reference any symbol from these header files. Signed-off-by: Xiang Xiao <[email protected]>
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 <[email protected]>
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 <[email protected]>
To give this macro a standard MP_ prefix. Signed-off-by: Damien George <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 micropython#6837. Signed-off-by: Damien George <[email protected]>
No std-int types are used in gc.h, but size_t is which needs stddef.h. Signed-off-by: Damien George <[email protected]>
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 micropython#6777. Signed-off-by: Damien George <[email protected]>
START_SEC was changed in e0905e8. 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 <[email protected]>
Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
So that BTSTACK can be enabled with SYNC_EVENTS. Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
Synchronous events work on stm32 and unix ports. Signed-off-by: Damien George <[email protected]>
Includes support for RP2040. Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Damien George <[email protected]>
This is needed for TinyUSB to process USB device IRQs. Related to micropython#6325. Signed-off-by: Damien George <[email protected]>
Signed-off-by: Brianna Laugher <[email protected]>
Matches CPython behavior. Fixes micropython#6686
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 <[email protected]>
Signed-off-by: Damien George <[email protected]>
These allow a port to use cmake natively instead of make. Signed-off-by: Damien George <[email protected]>
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 <[email protected]>
Signed-off-by: Damien George <[email protected]>
Instantiation and init now support the rxbuf and txbuf keywords for setting the buffer size. The default size is 256 bytes. The minimum and maximum sizes are 32 and 32766 respectively. uart.write() still includes checks for timeout, even if it is very unlikely to happen due to a) lack of flow control support and b) the minimal timeout values being longer than the time it needs to send a byte.
This change allows to build firmware for different rp2-based boards, following how it is done in other ports like stm32 and esp32. So far only the original Pico and Adafruit Feather RP2040 are added. Board names should match (sans case) those in pico-sdk/src/boards/include/boards/. Usage: Pico firmware can be build either using make as previously (it is the default board) or by `make BOARD=PICO`. Feather is built by `make BOARD=ADAFRUIT_FEATHER_RP2040`. Only the board name and flash drive size is set, pin definition is taken from the appropriate pico-sdk board definition. Firmware is saved in the directory build-BOARD_NAME.
Prior to this commit, if C2 was busy (eg lots of BLE activity) then it may not have had time to respond to the notification on the IPCC_CH_MM channel by the time additional memory was available to put on that buffer. In such a case C1 would modify the free buffer list while C2 was potentially accessing it, and this would eventually lead to lost memory buffers (or a corrupt linked list). If all buffers become lost then ACL packets (asynchronous events) can no longer be delivered from C2 to C1. This commit fixes this issue by waiting for C2 to indicate that it has finished using the free buffer list. Work done in collaboration with Jim Mussared aka @jimmo. Signed-off-by: Damien George <[email protected]>
The STM32WB has a problem when address resolution is enabled: under certain conditions the MCU can get into a state where it draws an additional 10mA or so and eventually ends up with a broken BLE RX path in the silicon. A simple way to reproduce this is to enable address resolution (which is the default for NimBLE) and start the device advertising. If there is enough BLE activity in the vicinity then the device will at some point enter the bad state and, if left long enough, will have permanent BLE RX damage. STMicroelectronics are aware of this issue. The only known workaround at this stage is to not enable address resolution, which is implemented by this commit. Work done in collaboration with Jim Mussared aka @jimmo. Signed-off-by: Damien George <[email protected]>
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.
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).
So these alternate functions can be parsed by the build scripts and used in application code. Signed-off-by: Damien George <[email protected]>
This function includes the UART prescaler in the calculation (if it has one, eg on H7 and WB MCUs). Signed-off-by: Damien George <[email protected]>
This fixes `error: variable 'subpkg_tried' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]` when compiling on ppc64le and aarch64 (and possibly other architectures/toolchains).
This supports SDRAM having only 2 internal banks (using BA0 only), and only 11 (A0-A10) bits of address, such as IS42S16100H (512K x 16bit x 2bank).
This change allows running the tests in tests/basics/ without any failures (but some tests are still skipped). Signed-off-by: Damien George <[email protected]>
For an unconnected TCP socket, poll should return WR|HUP and read should raise ENOTCONN. This is implemented by this commit and now the following tests pass on esp32: extmod/usocket_tcp_basic.py, net_hosted/connect_poll.py. Signed-off-by: Damien George <[email protected]>
Commit cb68a57 broke automatic Python feature detection when running tests, because some detection relied on a crash of a feature script returning exactly b"CRASH". This commit fixes this and improves the situation by testing for the lack of a known pass result, rather than an exact failure result. Signed-off-by: Damien George <[email protected]>
Builds against IDF v4.3-beta2. Signed-off-by: Damien George <[email protected]>
The REPL will be available on the USB serial port. Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
To test different IDF's, and also test building the GENERIC_S2 board. Signed-off-by: Damien George <[email protected]>
Commit 8a917ad added the gpio_reset_pin() call to make sure that pins that were used as ADC inputs could subsequently be used as digital IO. But calling gpio_reset_pin() will enable the pull-up on the pin and so pull it high for a brief period. Instead use rtc_gpio_deinit() which will just reconfigure the pin as a digital IO and do nothing else. Fixes issue micropython#7079 (see also micropython#5771). Signed-off-by: Damien George <[email protected]>
The PIO state machines on the RP2040 have 4 word deep TX and RX FIFOs. If you only need one direction, you can "merge" them into either a single 8 word deep TX or RX FIFO. We simply add constants to the PIO object, and set the appropriate bits in `shiftctrl`. Resolves micropython#6854. Signed-off-by: Tim Radvan <[email protected]>
Because micropython.org now adds this to the headers. Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find anything of concern, except that some run-tests.py
changes in the actions yml files were missed. All tests passed locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo the run-tests
vs run-tests.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming it passes CI and there was nothing new besides the run-tests.py change, LGTM
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 65d58fbb9..b9dde92a9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -73,16 +73,16 @@ jobs:
run: |
make -C ports/unix VARIANT=coverage -j2
- name: Test all
- run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1
+ run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1
working-directory: tests
- name: Native Tests
- run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1 --emit native
+ run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --emit native
working-directory: tests
- name: mpy Tests
- run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy -d basics float micropython
+ run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy -d basics float micropython
working-directory: tests
- name: Native mpy Tests
- run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy --emit native -d basics float micropython
+ run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy --emit native -d basics float micropython
working-directory: tests
- name: Build mpy-cross.static-aarch64
run: make -C mpy-cross -j2 -f Makefile.static-aarch64
Fixes #2999 for now.