summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-12-14samd/mpconfigport: Use __WFE() in MICROPY_EVENT_POLL_HOOK.robert-hh
Like WFI, WFE also responds to a hardware interrupt, and using WFE speeds up at least spi.read(). Power consumption at an idle REPL is unchanged.
2022-12-14samd/mpconfigport: Support MICROPY_HW_SOFTSPI_MIN_DELAY.robert-hh
Bringing the SoftSPI baudrate up to about 500 kHz.
2022-12-13stm32/boards/NUCLEO_F429ZI: Enable I2C1 and I2C2 with default pins.Dale Weber
The datasheet on page 55 shows PF0 (SDA) and PF1 (SCL) are the pins for I2C2, but these pins do not work. Checking the MBED pinout for the NUCLEO-F429ZI shows: I2C1: PB8 (SCL) and PB9 (SDA). I2C2: PB10 (SCL) and PB11 (SDA). Both of these work and can be scanned and find devices connected to them. Signed-off-by: Dale Weber <hybotics.sd@gmail.com>.
2022-12-13windows/.gitignore: Simplify by removing build artefacts.stijn
Since all output is now in the build-<variant>/ directory, which is already excluded by the root .gitignore, we don't need to repeat that.
2022-12-13all: Keep msvc build output in build/ directories.stijn
This follow the change made for Makefile-based projects in b2e82402.
2022-12-13webassembly/library: Extract and send data to print as UInt8Array.Antonin ENFRUN
This allows utf-8 data to work. It's the receiving layer's responsibility to deal with decoding the data.
2022-12-13docs/differences: Add Python 3.10 page.David Lechner
This adds a new page for Python 3.10 implementation status similar to previous releases. Signed-off-by: David Lechner <david@pybricks.com>
2022-12-13docs/differences: Update Python 3.9 status.David Lechner
This marks PEP 584 as complete and notes a few PEPs as not relevant. Signed-off-by: David Lechner <david@pybricks.com>
2022-12-09extmod/modframebuf: Fix crash in FrameBuffer scrolling beyond extents.TPReal
Fixed the crash occurring when scrolling by at least the size of the framebuffer.
2022-12-09tests/extmod/framebuf_scroll: Add tests for FrameBuffer scrolling.TPReal
Includes a currently-failing test of scrolling by at least the size of the buffer.
2022-12-09drivers/bus: Change QSPI read_cmd signature to return an error code.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-12-09drivers/bus: Detect QSPI transfer errors and pass up to spiflash driver.Andrew Leech
This changes the signatures of QSPI write_cmd_data, write_cmd_addr_data and read_cmd_qaddr_qdata so they return an error code. The softqspi and stm32 hardware qspi driver are updated to follow this new signature. Also the spiflash driver is updated to use these new return values. Signed-off-by: Damien George <damien@micropython.org>
2022-12-08py/gc: Fix debug printing of GC layout.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-12-08unix/coverage: Add extra GC coverage test for ATB gap byte.Jeff Epler
The assertion that is added here (to gc.c) fails when running this new test if ALLOC_TABLE_GAP_BYTE is set to 0. Signed-off-by: Jeff Epler <jepler@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
2022-12-08py/gc: Ensure a gap of one byte after the ATB.Jeff Epler
Prior to this fix the follow crash occurred. With a GC layout of: GC layout: alloc table at 0x3fd80428, length 32001 bytes, 128004 blocks finaliser table at 0x3fd88129, length 16001 bytes, 128008 blocks pool at 0x3fd8bfc0, length 2048064 bytes, 128004 blocks Block 128003 is an AT_HEAD and eventually is passed to gc_mark_subtree. This causes gc_mark_subtree to call ATB_GET_KIND(128004). When block 1 is created with a finaliser, the first byte of the finaliser table becomes 0x2, but ATB_GET_KIND(128004) reads these bits as AT_TAIL, and then gc_mark_subtree references past the end of the heap, which happened to be past the end of PSRAM on the esp32-s2. The fix in this commit is to ensure there is a one-byte gap after the ATB filled permanently with AT_FREE. Fixes issue #7116. See also https://github.com/adafruit/circuitpython/issues/5021 Signed-off-by: Jeff Epler <jepler@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
2022-12-08py/gc: Avoid valgrind false positives.Jeff Epler
When you want to use the valgrind memory analysis tool on MicroPython, you can arrange to define MICROPY_DEBUG_VALGRIND to enable use of special valgrind macros. For now, this only fixes `gc_get_ptr` so that it never emits the diagnostic "Conditional jump or move depends on uninitialised value(s)". Signed-off-by: Jeff Epler <jepler@gmail.com>
2022-12-08py: Pass in address to compiled module instead of returning it.Damien George
This change makes it so the compiler and persistent code loader take a mp_compiled_module_t* as their last argument, instead of returning this struct. This eliminates a duplicate context variable for all callers of these functions (because the context is now stored in the mp_compiled_module_t by the caller), and also eliminates any confusion about which context to use after the mp_compile_to_raw_code or mp_raw_code_load function returns (because there is now only one context, that stored in mp_compiled_module_t.context). Reduces code size by 16 bytes on ARM Cortex-based ports. Signed-off-by: Damien George <damien@micropython.org>
2022-12-07github/workflows: Fix code size comment workflow for non-PR.David Lechner
This fixes the case for the code size comment action where there is no matching artifact. Apparently, the result of the github-script action was not treating `false` as a boolean value. To fix the problem we change the result to use string. Also add some logging to make the step a bit less cryptic. Signed-off-by: David Lechner <david@pybricks.com>
2022-12-07docs/library/neopixel: Update GitHub URL for neopixel.py link.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-12-06docs/library/struct: Embed format tables.Laurens Valk
Also add note about long support. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-12-06docs/library/struct: Fix buffer argument description.Laurens Valk
The buffer is the data in this case. There is no buffer argument. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-12-06py: Remove the word "yet" from exception messages.Damien George
These unimplemented features may never be implemented, and having the word "yet" there takes up space. Signed-off-by: Damien George <damien@micropython.org>
2022-12-06py/mpconfig: Include micropython module in core features.Laurens Valk
This excludes it from the minimal builds. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-12-06py/modmicropython: Make module optional.Laurens Valk
This module is useful, but it is not always needed. Disabling it saves several kilobytes of build size, depending on other config options. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-12-01stm32/boards: Add missing LPUART macros for H7 HAL.iabdalkader
The STM32H7xx HAL LPUART AF macros are missing the number, this HAL is the only one that's inconsistent in the way it defines LPUART AF macros, so we only need to define them for H7.
2022-11-30stm32/mboot: Make all mboot sectors erase/write protected.Damien George
Prior to this commit, only sector 0 was erase/write protected, which may not be enough to protect all of mboot (especially if mboot lives at a higher address than the start of flash). This commit makes sure all internal flash sectors that mboot lives in are protected from erasing and writing. The linker script must define _mboot_writable_flash_start for this to work. Signed-off-by: Damien George <damien@micropython.org>
2022-11-29github/workflows: Comment on code size change instead of failing CI.David Lechner
This changes the code size workflow to post a comment on pull requests with the code size report. It also removes the error threshold so that the test won't fail if code size increases. Allowable code size changes are subjective, so shouldn't cause CI to fail. In addition, failing CI tests can cause other hooks like code coverage reports to be suppressed, so this fixes that problem as well. Fixes issue #8464. Signed-off-by: David Lechner <david@pybricks.com>
2022-11-28py/bc: Fix checking for duplicate **kwargs.David Lechner
The code was already checking for duplicate kwargs for named parameters but if `**kwargs` was given as a parameter, it did not check for multiples of the same argument name. This fixes the issue by adding an addition test to catch duplicates and adds a test to exercise the code. Fixes issue #10083. Signed-off-by: David Lechner <david@pybricks.com>
2022-11-28gitignore: Add comment about keeping this file minimal.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-11-28gitignore: Simplify top-level gitignore file.Damien George
All build artefacts are now placed in build*/ directories so there's no longer any need to hide files like .o with .gitignore. Signed-off-by: Damien George <damien@micropython.org>
2022-11-25tools/mpremote: Only auto connect to serial device with USB VID/PID.Michael Mogenson
On MacOS and Windows there are a few default serial devices that are returned by `serial.tools.list_ports.comports()`. For example on MacOS: ``` {'description': 'n/a', 'device': '/dev/cu.Bluetooth-Incoming-Port', 'hwid': 'n/a', 'interface': None, 'location': None, 'manufacturer': None, 'name': 'cu.Bluetooth-Incoming-Port', 'pid': None, 'product': None, 'serial_number': None, 'vid': None} {'description': 'n/a', 'device': '/dev/cu.wlan-debug', 'hwid': 'n/a', 'interface': None, 'location': None, 'manufacturer': None, 'name': 'cu.wlan-debug', 'pid': None, 'product': None, 'serial_number': None, 'vid': None} ``` Users of mpremote most likely do not want to connect to these ports. It would be desirable if mpremote did not select this ports when using the auto connect behavior. These serial ports do not have USB VID or PID values and serial ports for Micropython boards with FTDI/serial-to-USB adapter or native USB CDC/ACM support do. Check for the presence of a USB VID / PID int value when selecting a serial port to auto connect to. All serial ports will still be listed by the `list` command and can still be selected by name when connecting. Signed-off-by: Michael Mogenson <michael.mogenson@gmail.com>
2022-11-25tests/misc/cexample_class: Fix timing sensitivity.Laurens Valk
This test could occasionally fail because some operations take longer than expected. This relaxes the timing constraints and defers printing until the very end. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-11-25tests/misc/cexample_module: Test class presence.Laurens Valk
Now that the Timer class has been merged in a separate pull request, this can be added to the module test too. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-11-25tools/mpremote: Allow EDITOR environment variable to work on Windows.Tobias Thyrrestrup
2022-11-25py/objdict: Implement dictionary union (PEP 584).Rayane Chatrieux
Implements dictionary union according to PEP 584's specifications, minus the fact that dictionary entries are not guaranteed to be in insertion order. This feature is enabled with MICROPY_CPYTHON_COMPAT. Includes a new test. With the assistance of Fangrui Qin <qinf@purdue.edu> Signed-off-by: Rayane Chatrieux <rayane.chatrieux@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
2022-11-23esp32/machine_timer: Fix ESP32C3 timer period doubling.Brian Cooke
The original ESP32 only supports timer source clock APB so it doesn't need and doesn't have a clk_src field. The ESP32C3 supports timer source clock APB and XTAL so it does have a clk_src field, and this needs to be configured to get the correct period. Fixes #8084.
2022-11-23examples/usercmodule: Add example of a native C class.Laurens Valk
This shows how ports can add their own custom types/classes. It is part of the unix coverage build, so we can use it for tests too. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-11-23tests/misc: Add test for cexample module.Laurens Valk
This also moves the existing test for cexample.add_ints originally done in extra_coverage. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-11-23tools/ci.sh: Don't print python2 version.Damien George
Because python2 may not be available. Signed-off-by: Damien George <damien@micropython.org>
2022-11-23github/workflows: Run mpy-format CI when tests and examples change.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-11-23github/workflows: Use ubuntu-20.04 when python2 is required.Damien George
Python 2 is no longer included in the latest Ubuntu 22.04. Signed-off-by: Damien George <damien@micropython.org>
2022-11-23esp32/boards/GENERIC_S3_SPIRAM: Enable BLE.Jim Mussared
Follow up to 8a91c719 to no longer explicitly disable BLE in mpconfigport.h. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-22py/makeversionhdr.py: Allow running outside of repo.Jim Mussared
If a CMake-build is run with `make BUILD=/outside/path` then makeversionheader.py is run with the CWD set to the build directory, which means the git version lookup will fail and silently fall back to the mpconfig.h mode (giving the wrong result). This commit: - Uses the location of makeversionheader.py to find the repo path. - Allows overriding this path via --repo-path. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-18mpy-cross/main: Add MSVC-compatible architecture checks.David Lechner
MSVC doesn't define `__i386__` or `__x86_64__` so we have to check `_M_IX86` and `_M_X64` as well. Signed-off-by: David Lechner <david@pybricks.com>
2022-11-18extmod/moduplatform: Fix MSVC x86_64 check.David Lechner
`_WIN64` is defined for all 64-bit targets, including Arm, so it doesn't work for detecting `x86_64`. We can use `_M_X64` instead. Signed-off-by: David Lechner <david@pybricks.com>
2022-11-18extmod/moduplatform: Remove _M_IX86 test for xtensa.David Lechner
Since _M_IX86 is already being checked in the x86 case, it will never be true in the xtensa case and can be removed. Signed-off-by: David Lechner <david@pybricks.com>
2022-11-18mimxrt/mpconfigport: Remove config options that are set by default.robert-hh
Remove every setting that is already included in MICROPY_CONFIG_ROM_LEVEL_FULL_FEATURES.
2022-11-18stm32/i2c: Add hardware I2C implementation for STM32L4.yn386
For STM32L4, hardware I2C can be implemented by using TIMINGR. This commit enables: - Use of hardware I2C in machine.I2C. - Specifying a frequency greater than or equal to 400KHz with pyb.I2C.
2022-11-18stm32/i2c: Add hardware I2C implementation for STM32L1.yn386
For STM32L1, hardware I2C can be implemented the same as STM32F4 for machine.I2C. Tested on NUCLEO-L152RE.
2022-11-18stm32/adc: Fix ADCAll.read_core_temp() on L4 MCUs.yn386
TS_CAL1 and TS_CAL2 of STM32L4 are at VDDA=3.0V, so the reference correction factor should be updated before reading tempsensor.