summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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.
2022-11-18stm32/adc: Fix reading internal ADC channels on L4 MCUs.yn386
For STM32L4 series, the internal sensors are connected to: - ADC1_IN0: Internal voltage reference - ADC1_IN17: Temperature sensor - ADC1_IN18: VBAT battery voltage monitoring but ADC_CHANNEL_VREFINT, ADC_CHANNEL_VBAT, ADC_CHANNEL_TEMPSENSOR are not defined as 0, 17, 18. This commit converts channel 0, 17, 18 to ADC_CHANNEL_x in adc_get_internal_channel().
2022-11-18stm32/i2c: Fix I2C frequency calc so it doesn't exceed requested rate.yn386
Prior to this commit, the actual I2C frequency can be faster than specified one and it may exceed the I2C's specification for Fast Mode. The frequency of SCL should be less than or equal to 400KHz in Fast Mode. This commit fixes this issue for F4 MCUs by rounding up the division in the frequency calculation.
2022-11-18stm32/pyb_i2c: Fix failing pyb.I2C(dma=True) after receiving 1 byte.yn386
Excuting the code: i2c = I2C(1, I2C.CONTROLLER, dma=True) tmp = i2c.recv(1, i2c_addr) recv_data = bytearray(56) i2c.recv(recv_data, i2c_addr) The second i2c.recv() fails with OSError: [Errno 110] ETIMEDOUT. When receiving greater than or equal to 2 bytes at first i2c.recv(), the second i2c.recv() succeeds. This issue does not occur without DMA. Details of change: when executing I2C with DMA: - Bit 11 of I2Cx_CR2 (DMA Request Enable) should be 1 to indicate that DMA transfer is enabled. This bit is set after I2C event interrupt is enabled in HAL_I2C_Master_Transmit_DMA()/HAL_I2C_Master_Receive_DMA(), so DMA Request Enable bit might be 0 in IRQHandler. - In case of data receive: - When only 1 byte receiption, clear I2Cx_CR1's bit 10 (ACK). - When only 2 byte receiption, clear I2Cx_CR1's bit 10 (ACK) and set bit 11 (POS). - When greater than or equal to 2 byte receiption, bit 12 of I2Cx_CR2 (DMA Last Transfer) should set to generate NACK when DMA transfer completed. Otherwise, the I2C bus may be busy after received data from peripheral.
2022-11-17extmod/extmod.cmake: Add MICROPY_PY_BTREE compiler definition.David Lechner
Instead of defining `MICROPY_PY_BTREE` in `mpconfigport.h` we can define it via CMake similar to how other ports that use Makefiles define it in `mpconfigport.mk`. Signed-off-by: David Lechner <david@pybricks.com>
2022-11-17docs/library/framebuf: Clarify docs for blit regarding palette.TPReal
Clarified the behaviour when both key and palette are specified.
2022-11-17tests/run-tests.py: Use host arch for mpy-cross for target=unix.Jim Mussared
This will make mpy-cross auto-detect. Allow overriding for non-default configurations (e.g. using 32-bit build of the unix port). Also use armv7m by default for qemu-arm (the default qemu target is Cortex-M3). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-17github/workflows: Run unix port workflow if mpy-cross changes.Damien George
Otherwise there is no CI for mpy-cross if only it changes. Signed-off-by: Damien George <damien@micropython.org>
2022-11-17mpy-cross/main: Don't set a default native architecture.Jim Mussared
If `-march` isn't set then it means the user hasn't thought about it, or in the case of freezing, MPY_CROSS_FLAGS isn't set. It's almost certainly going to lead to problems, as there's no reason why the host architecture is likely to be the right choice. Compiling regular Python code is unaffected, but if `@native`/`@viper` is used, the compiler will raise `SyntaxError: invalid arch`. For situations where you explicitly want to use the host architecture (e.g. for running tests on the unix port), added -march=host that keeps the old behavior. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-17stm32/Makefile: Set MPY_CROSS_FLAGS based on MCU type.Jim Mussared
Previously it was hardcoded to armv7m, which would have failed on M0/M0+. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-17samd/Makefile: Set MPY_CROSS_FLAGS.Jim Mussared
Otherwise this port will be unable to freeze `@native`/`@viper` code. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-17samd: Move MCU-specific CFLAGS to mpconfigmcu.mk.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-17mimxrt/Makefile: Set MPY_CROSS_FLAGS.Jim Mussared
Otherwise this port will be unable to freeze `@native`/`@viper` code. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-17mimxrt/network: Rename the argument clock_mode to ref_clk_mode.robert-hh
The definitions for LAN.IN and LAN.OUT are kept, but in the code Pin.IN and Pin.OUT can be used as well as values for the ref_clk_mode argument.
2022-11-17mimxrt/usb: Change macro name MICROPY_HW_USB_STR_MANUF.robert-hh
Change it into MICROPY_HW_USB_MANUFACTURER_STRING to be compatible with other ports.
2022-11-17mimxrt/README: Add build and flashing instructions.Patrick Joy
2022-11-17mimxrt: Add support for MIMXRT1176 MCUs, and MIMXRT1170_EVK board.robert-hh
The RT1176 has two cores, but the actual firmware supports only the CM7. There are currently no good plans on how to use the CM4. The actual MIMXRT1170_EVK board is on par with the existing MIMXRT boards, with the following extensions: - Use 64 MB RAM for the heap. - Support both LAN interfaces as LAN(0) and LAN(1), with LAN(1) being the 1GB interface. The dual LAN port interface can eventually be adapted as well for the RT1062 MCU. This work was done in collaboration with @alphaFred.
2022-11-16docs/library/uasyncio: Describe restriction on ThreadSafeFlag.Peter Hinch
As per Issue #7965, this class does not work on the Unix build.
2022-11-16tools/ci.sh: Remove one build from zephyr CI to speed it up.Damien George
The zephyr CI takes the most time out of all CI jobs, so remove the standard qemu_x86 build to speed it up. The remaining builds should still cover enough cases to catch errors. Signed-off-by: Damien George <damien@micropython.org>
2022-11-16tools/ci.sh: Add ARDUINO_NANO_RP2040_CONNECT to rp2 CI build.iabdalkader
2022-11-16drivers/ninaw10: Connect to WiFi asynchronously.iabdalkader
Before this patch, WiFi connection was blocking, and could raise exceptions if the connection failed for any reason (including timeouts). This doesn't match the behavior of other WiFi modules, which connect asynchronously, and requires handling of exceptions on connect. This change makes `connect()` work asynchronously by scheduling code to poll connection status, and handle reconnects (if needed), and return immediately without blocking.
2022-11-15esp32/boards/GENERIC_S3_SPIRAM: Enable BLE support.PGE
2022-11-15tools/gendoc.py: Remove unused script.Jim Mussared
This used to be used to generate .rst docs from inline comments in the C code (specifically for APIs) but is now unused. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-15tools/gen-cpydiff.py: Use os.path.join and os.path.isdir.Andrew Scheller
Makes path handling clearer and simpler. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-15docs/library/pyb.CAN: Update the recv example to take a 5-tuple.Sky
A supplement to commit 5cdf9645711cc12b45e602ef5795c33895116fc4
2022-11-15docs/library/array: Add docs for dunder methods.Howard Lovatt
Signed-off-by: Damien George <damien@micropython.org>
2022-11-15py/nlrmips: Add native NLR support for MIPS architecture.Jan Willeke
This can be tested using ports/minimal and qemu: make CC=mips-linux-gnu-gcc-8 Then run with qemu-mips: stty raw opost -echo; QEMU_LD_PREFIX=/usr/mips-linux-gnu/ qemu-mips build/firmware.elf; sleep 1; reset Signed-off-by: Jan Willeke <willeke@smartmote.de>
2022-11-15minimal/Makefile: Set linker to $(CC).Jan Willeke
Changed 'LD = gcc' too 'LD = $(CC)' to support other compilers. Signed-off-by: Jan Willeke <willeke@smartmote.de>
2022-11-15windows: Make project file read-only for IDE.stijn
Avoids the 'warning: Wildcards in project items are not supported' message from the C++ project system in Visual Studio, while otherwise remaining completely functional.
2022-11-15stm32/usbd_desc: Support USB strings on CDC interface descriptors.Koen De Vleeschauwer
A board can now name the CDC ports, eg: #define MICROPY_HW_USB_CDC_NUM (3) #define MICROPY_HW_USB_INTERFACE_CDC0_STRING "REPL" #define MICROPY_HW_USB_INTERFACE_CDC1_STRING "GDB Server" #define MICROPY_HW_USB_INTERFACE_CDC2_STRING "UART Port" Signed-off-by: Damien George <damien@micropython.org>
2022-11-15esp8266/machine_pin: Disable open drain when pin becomes input/output.Damien George
Otherwise the pin stays in open drain mode. Signed-off-by: Damien George <damien@micropython.org>
2022-11-15esp8266/machine_pwm: Enable real open drain output on pin driven by PWM.Trammell hudson
The PWM module now detects if the pin is open drain and if so switches it to hardware open drain before starting the PWM. The code that was explicitly turning off the open drain output during PWM is also removed. Together these changes allow driving external transistor high-current switches with PWM. Signed-off-by: Trammell hudson <hudson@trmm.net>
2022-11-15renesas-ra: Change file system size to 64KB for RA6M1.Takeo Takahashi
Changes in this commit: - Change file system size from 128KB to 64KB in ra6m1_ek.ld. - Change EK-RA6M1's file system size in renesas-ra port document. Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-11-15docs/renesas-ra: Correct the internal file system size of EK-RA6M2.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>