summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-05-22samd/mcu/samd51: Enable MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF.robert-hh
Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22samd: Rearrange the MCU-specific loader files.robert-hh
Such that they are easier to adapt. The maximum code size is set by: MICROPY_HW_CODESIZE=xxxK in mpconfigmcu.mk for the MCU family as default or in mpconfigboard.mk for a specific board. Setting the maximum code size allows the loader to error out if the code gets larger than the space dedicated for it. Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22samd/boards/MINISAM_M4: Update pins.csv for the Mini SAM M4 board.robert-hh
Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22samd/mpconfigport: Drop support for SoftSPI max speed.robert-hh
Saves ~140 bytes and is not really needed, since for higher baud rates hard SPI is available. Signed-off-by: robert-hh <robert@hammelrath.com>
2023-05-22tools/mpremote: Add repl option to escape non-printable characters.Damien George
This commit adds the "--escape-non-printable" option to the repl command. When specified the REPL console will escape non-printable characters, printing them as their hex value in square brackets. This escaping behaviour was previously the default and only behaviour, but it is now opt-in. As part of this change, the speed of echoing device data to the console is improved by by reading and writing in chunks. Signed-off-by: Damien George <damien@micropython.org>
2023-05-22esp32/uart: Use xtal as UART clock source on S3 and C3.patrick
Change UART clock source on S3/C3 so the UART can operate when CPU frequency is below 80MHz. This allows the UART to remain operational when using Dynamic Frequency Scaling (DFS). Signed-off-by: Patrick Joy <patrick@joytech.com.au>
2023-05-19esp32/esp32_ulp: Enable FSM ULP for S2 and S3 chips.patrick
This commit enables the ULP for the S2 and S3 chips. Note this is the FSM (Finite State Machine) ULP. Signed-off-by: Patrick Joy <patrick@joytech.com.au>
2023-05-19esp32/boards: Add some missing board configs for two UM boards.UnexpectedMaker
2023-05-19stm32/irq: Fix typo in comment about priorities.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-05-19renesas-ra/irq: Fix typo in comment about IRQ priorities.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-05-19stm32/mboot: Fix alignment of packed final buffer.Andrew Leech
Once all the firmware has been flashed and the final signatures checked, mboot writes the "all good" byte into the header of the application. This step uses the buffer firmware_head which, if unaligned in the build, fails when cast to a uint64_t* in flash.c. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-05-19stm32/boards/stm32h723_af.csv: Fix ADC AF definitions.brave ulysses
These were incorrectly added in d995c010428420c7690d5cd59b9580c3f4f9649a. The fix here includes the full differential ADC definitions. Signed-off-by: brave ulysses <brave_ulysses@email.com>
2023-05-19extmod/extmod.mk: Suppress deprecated-non-prototype warning.Chris Wilson
Signed-off-by: Chris Wilson <chris@cgnd.dev>
2023-05-19extmod/vfs_lfsx: Fix offset used before range check.Mingjie Shen
Use of offset 'from' should follow the range check. Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-05-19shared/upytesthelper: Fix spelling of "default".David Lechner
Signed-off-by: David Lechner <david@pybricks.com>
2023-05-19tools/manifestfile.py: Fix license capturing.Jim Mussared
The license field was incorrectly being set to the version. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-05-19docs/develop/porting: Add missing code to example main.c and Makefile.marble
These two missing lines caused the build process to fail when implementing the tutorial example port. Signed-off-by: marble <git@computer-in.love>
2023-05-19docs/library/espnow: Update espnow docs for WLAN.config(pm=x) options.glenn20
Update docs/library/espnow.rst to add: - guidance on using WLAN.config(pm=WLAN.PM_NONE) for reliable espnow performance while also connected to a wifi access point; - guidance on receiving encrypted messages; - correction for default value of "encrypt" parameter (add_peer()); - guidance on use of ESPNow.irq(): recommand users readout all messages in the buffer each time the callback is called. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2023-05-19py/runtime: If inplace binop fails then try corresponding normal binop.Damien George
The code that handles inplace-operator to normal-binary-operator fallback is moved in this commit from py/objtype.c to py/runtime.c, making it apply to all types, not just user classes. Signed-off-by: Damien George <damien@micropython.org>
2023-05-19py/objstr: Return unsupported binop instead of raising TypeError.Damien George
So that user types can implement reverse operators and have them work with str on the left-hand-side, eg `"a" + UserType()`. Signed-off-by: Damien George <damien@micropython.org>
2023-05-19py/objarray: Disallow memoryview addition.Damien George
Following CPython. This is important for subsequent commits to work correctly. Signed-off-by: Damien George <damien@micropython.org>
2023-05-19tests/basics: Add more tests for hashing of various types.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-05-19py/objdict: Fix __hash__ for dict_view types.David Lechner
This adds a unary_op implementation for the dict_view type that makes the implementation of `hash()` for these types compatible with CPython. Signed-off-by: David Lechner <david@pybricks.com>
2023-05-19py/objslice: Ensure slice is not hashable.David Lechner
As per https://bugs.python.org/issue408326, the slice object should not be hashable. Since MicroPython has an implicit fallback when the unary_op slot is empty, we need to fill this slot. Signed-off-by: David Lechner <david@pybricks.com>
2023-05-19py/obj: Remove mp_generic_unary_op().David Lechner
Since converting to variable sized slots in mp_obj_type_t, we can now reduce the code size a bit by removing mp_generic_unary_op() and the corresponding slots where it is used. Instead we just implement the generic `__hash__` operation in the runtime. Signed-off-by: David Lechner <david@pybricks.com>
2023-05-18esp32,esp8266: Change network.WLAN from a function to a type.Damien George
When the network module was first introduced in the esp8266 port in ee3fec3167db6e28869d37fb60058c884fb36264 there was only one interface (STA) and, to save flash, the WLAN object was aliased to the network module, which had just static methods for WLAN operations. This was subsequently changed in 9e8396accbcb695e2fe9def666bfb31b26efde06 when the AP interface was introduced, and the WLAN object became a true class. But, network.WLAN remained a function that returned either the STA or AP object and was never upgraded to the type itself. This scheme was then copied over to the esp32 port when it was first introduced. This commit changes network.WLAN from a function to a reference to the WLAN type. This makes it consistent with other ports and network objects, and allows accessing constants of network.WLAN without creating an instance. Signed-off-by: Damien George <damien@micropython.org>
2023-05-18tests/run-tests.py: Ensure correct cwd for mpy tests.Jim Mussared
Previously when using --via-mpy, the file was compiled to tests/<tmp>.mpy and then run using `micropython -m <tmp>` in the current cwd (usually tests/). This meant that an import in the test would be resolved relative to tests/. This is different to regular (non-via-mpy) tests, where we run (for example) `micropython basics/test.py` which means that an import would be resolved relative to basics/. Now --via-mpy matches the .py behavior. This is important because: a) It makes it so import tests do the right thing. b) There are directory names in tests/ that match built-in module names. Furthermore, it always ensures the cwd (for both micropython and cpython) is the test directory (e.g. basics/) rather than being left unset. This also makes it clearer inside the test that e.g. file access is relative to the Python file. Updated tests with file paths to match. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-05-18github/workflows: Force use of Ubuntu-20.04 for unix 32-bit builds.Damien George
To be able to install libffi-dev:i386. Signed-off-by: Damien George <damien@micropython.org>
2023-05-18rp2/mphalport: Only use CYW43 MAC for WLAN0 interface.Ondrej Wisniewski
Building the Pico-W needs the MICROPY_PY_NETWORK_CYW43 flag to be set in order to include building the CYW43 Wifi driver. But then mp_hal_get_mac() handles the MAC assignment for all nics the "CYW43 way", copying the real MAC provided by the WiFi hardware. This will fail for all other NIC types, resulting in an invalid MAC address. The solution in this commit is to add a check for the NIC type parameter idx and handle the MAC address respectively.
2023-05-18rp2/CMakeLists: Allow relative MICROPY_BOARD_DIR when invoking cmake.Phil Howard
Convert to an absolute path to always reliably locate manifest.py. This is already done in Makefile, but is also needed in CMakeLists.txt if cmake is invoked directly. Signed-off-by: Phil Howard <phil@pimoroni.com>
2023-05-18rp2: Make rp2_state_machine_exec accept integers.Adam Green
Currently rp2.StateMachine.exec(instr_in) requires that the instr_in parameter be a string representing the PIO assembly language instruction to be encoded by rp2.asm_pio_encode(). This commit allows the parameter to also be of integral type. This is useful if the exec() method is being called often where the use of pre-encoded machine code is desireable. This commit still supports calls like: sm.exec("set(0, 1)") It also now supports calls like: # Performed once earlier, maybe in __init__() assembled_instr = rp2.asm_pio_encode("out(y, 8)", 0) # Performed multiple times later as the PIO state machine is # configured for its next run. sm.exec(assembled_instr) The existing examples/rp2/pio_exec.py and examples/rp2/pio_pwm.py that exercise the rp2.StateMachine.exec() method still work with this change. Signed-off-by: Adam Green <adamgrym@yahoo.com>
2023-05-11renesas-ra: Add a macro definition to avoid compile error of FSP v4.4.0.Takeo Takahashi
FSP v4.4.0 refers to CMSIS V5.4.1, and __COMPILER_BARRIER() is used in bsp. On the other hand, lib/cmsis is V5.1.0 and the macro is not defined. Therefore, compile error happens. As the workaround, the macro definition is added. If lib/cmsis is updated in the future, this addition can be removed. Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-05-11renesas-ra: Update boards and ra directory files to support FSP v4.4.0.Takeo Takahashi
* Update boards and ra files * Remove unreferenced files, board_init.c and board_leds.c, from Makefile * Remove unreferenced FSP instances from ra_gen/*.[ch] * Remove unreferenced FSP config files ra_cfg/*.h * e2 studio generates FSP instances but renesas-ra uses only followings: lpm, flash, ioport Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-05-11lib/fsp: Update FSP for renesas-ra to the latest version v4.4.0.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-05-11windows/Makefile: Allow variants to add QSTR_DEFS.David Lechner
This modifies the windows port Makefile to use += for QSTR_DEFS and QSTR_GLOBAL_DEPENDENCIES so that variants can add additional files if needed (similar to stm32 port). Signed-off-by: David Lechner <david@pybricks.com>
2023-05-11unix/Makefile: Allow variants to add QSTR_DEFS.David Lechner
This modifies the unix port Makefile to use += for QSTR_DEFS and QSTR_GLOBAL_DEPENDENCIES so that variants can add additional files if needed (similar to stm32 port). Signed-off-by: David Lechner <david@pybricks.com>
2023-05-11docs/reference/mpyfiles: Add release info on v6.1.David Lechner
This documents when MPY v6.1 was released. Also add some clarification on how the version is encoded in the header. Signed-off-by: David Lechner <david@pybricks.com>
2023-05-10top: Add ruff to pre-commit.Christian Clauss
This does not align with the other pre-commit jobs with are local custom code but it should run accurately and quickly. Signed-off-by: Christian Clauss <cclauss@me.com>
2023-05-09tools/pyboard.py: Import errno to fix undefined name in PyboardError.Christian Clauss
This will keep line 96 from raising a NameError. Signed-off-by: Christian Clauss <cclauss@me.com>
2023-05-09mimxrt/machine_pin: Perform full configuration in machine_pin_set_mode.robert-hh
machine_pin_set_mode() is used by the internal mp_hal_pin_xxx() set of functions to configure pins.
2023-05-09mimxrt/machine_spi: Ignore transfers with len=0.robert-hh
It was treated as an error before. The error surfaced when using the NINAW10 drivers for WiFi support. Even if this is a bad behavior of the NINA driver, machine_spi can be forgiving in that situation.
2023-05-09mimxrt: Add missing UART defintion and remove obsolete config.robert-hh
Changes in this commit: - Add a missing UART defintion for MIMXRT1010_EVK. - Remove an obsolete line from mpconfigport.h.
2023-05-09mimxrt/mpconfigport: Add back lost uos.urandom().robert-hh
It got lost in a clean-up session recently.
2023-05-09mimxrt/flash: Separate low level driver code from flash object.Philipp Ebensberger
Separate low level flash access from mimxrt flash driver object. Allows better abstraction from hardware for testing and reuse in other areas (e.g. bootloader). Signed-off-by: Philipp Ebensberger <philipp.ebensberger@3bricks-software.de>
2023-05-09stm32/boards/ARDUINO_PORTENTA_H7: Enable FDCAN.Jim Lipsey
Add pin definitions to enable FDCAN support using the pyb.CAN() class.
2023-05-09py/gc: Make improvements to MICROPY_GC_HOOK_LOOP.David Lechner
Changes in this commit: - Add MICROPY_GC_HOOK_LOOP to gc_info() and gc_alloc(). Both of these can be long running (many milliseconds) which is too long to be blocking in some applications. - Pass loop variable to MICROPY_GC_HOOK_LOOP(i) macro so that implementers can use it, e.g. to improve performance by only calling a function every X number of iterations. - Drop outer call to MICROPY_GC_HOOK_LOOP in gc_mark_subtree().
2023-05-08CODECONVENTIONS: Require that commits be signed-off by the author.Damien George
And use "must" instead of "should" where appropriate in related text. Signed-off-by: Damien George <damien@micropython.org>
2023-05-08extmod/network_cyw43: Add power management constants.Damien George
And allow querying the current power management mode. Signed-off-by: Damien George <damien@micropython.org>
2023-05-06esp32,esp8266: Add support to set/get power saving mode of WLAN.glenn20
For esp32 and esp8266 this commit adds: - a 'pm' option to WLAN.config() to set/get the wifi power saving mode; and - PM_NONE, PM_PERFORMANCE and PM_POWERSAVE constants to the WLAN class. This API should be general enough to use with all WLAN drivers. Documentation is also added.
2023-05-04docs/samd: Make use of pin names more consistent in examples.robert-hh
This keeps up with the changed Pin naming scheme.