summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-10-06samd/boards: Move mcu-specific settings into a mpconfig_samdXX.h file.robert-hh
Located at the boards directory. That way, the mpconfigboard.h files are almost empty, just setting the board name and the MCU name.
2022-10-06samd/boards: Replace pins.c and pins.h by pins.csv.robert-hh
The files pins.c and pins.h are generated during the build process from pins.csv, using a make-pins.py script.
2022-10-06samd: Remove the existing provisional support for REPL on UART.robert-hh
It was only partially working and will be rpelaced later by a full machine.UART class implementation.
2022-10-06tools/mpremote: Bump version to 0.4.0.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-10-06tools/mpremote: Fix argument handling for follow and add help strings.Jim Mussared
Fixes in this commit are: - Make --follow the default for "run" (accidentally changed in 68d094358). - Add help strings for "repl": --capture --inject-file --inject-code - Update help strings for "run". - Fix encoding for --inject-code (accidentally broken in 68d094358). - Remove ability to --no-follow for "eval". It was there previously because it shared the same code path with "exec" and "run", but makes no sense for "eval", so might as well remove. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-04esp32/machine_hw_spi: Use auto DMA channel on S2, S3, C3 chips.Damien George
Auto DMA channel is supported in IDF v4.4, and is required to be used on S3 chips, so use this simpler configuration option where possible. Fixes issue #8634. Signed-off-by: Damien George <damien@micropython.org>
2022-10-04tools: Add pre-commit support.Angus Gratton
Tweak the existing codeformat.py and verifygitlog.py to allow them to be easily called by pre-commit. (This turned out to be easier than using any existing pre-commit hooks, without making subtle changes in the formatting.) This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2022-10-04tools: Add note about uncrustify versions.Angus Gratton
Uncrustify versions are not mutually compatible: 1. Version 0.73 or newer produce slightly different formatting. It may be possible to tweak these by adding more config items, but this will cause older versions to error out with 'Unknown option'. 2. Version 0.75 prints a range of deprecation warnings due to config file changes, and returns a non-zero exit code. These are actually fixable as most are the default value, and pp_indent has changed from 'true' to '1' which is backwards compatible. However issue 1 remains, so probably better to have it fail explicitly. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2022-10-04esp32/machine_i2s: Add I2S finaliser which calls deinit().Damien George
So that the FreeRTOS resources can be freed, eg on soft reset. Fixes issue #9366. Signed-off-by: Damien George <damien@micropython.org>
2022-10-01tools/pyboard.py: Handle unsupported fs command.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-01tools/mpremote: Add `mpremote mip install` to install packages.Jim Mussared
This supports the same package sources as the new `mip` tool. - micropython-lib (by name) - http(s) & github packages with json description - directly downloading a .py/.mpy file The version is specified with an optional `@version` on the end of the package name. The target dir, index, and mpy/no-mpy can be set through command line args. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-01tools/mpremote: Use argparse for command line parsing.Jim Mussared
No functional change other than to allow slightly more flexibility in how --foo arguments are specified. This removes all custom handling for --foo args in all commands and replaces it with per-command argparse configs. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-01tools/mpremote: Simplify dispatch of commands.Jim Mussared
No functional change. This makes each built-in command defined by just a handler method and simplifies a lot of the logic around tracking the board state. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-30tools/manifestfile.py: Replace recursive glob with os.walk.Jim Mussared
Recursive glob isn't supported before Python 3.5. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-30top: Replace upip with mip everywhere.Jim Mussared
Updates all README.md and docs, and manifests to `require("mip")`. Also extend and improve the documentation on freezing and packaging. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-30lib/micropython-lib: Update submodule to latest.Jim Mussared
This brings in the `mip` tool for installing packages. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-29tools/manifestfile.py: Add `author` kwarg to metadata().Jim Mussared
This allows future micropython-lib packages to specify an author. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-29docs/Makefile: Enable parallel compilation for Sphinx.Jim Mussared
This has a fairly dramatic (nearly 3x on a 6-core machine) speedup for docs compilation, with no impact on correctness. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-29py/mkenv.mk: Make CPP definition explicit for consistency.stijn
2022-09-28mpy-cross/mpy_cross: Add docstrings to public methods.Jim Mussared
2022-09-28mpy-cross/mpy_cross: Add list of architectures to `__all__`.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-28mpy-cross/mpy_cross: Add a way to query the mpy version.Jim Mussared
This returns the mpy version and sub-version for files compiled with this mpy-cross binary. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-28mpy-cross/mpy_cross: Fix default path to mpy-cross binary.Jim Mussared
Needed to be updated to use build/mpy-cross. Also fixes some other issues in the Python wrapper: - Rename find_mpy_cross_binary to _find_mpy_cross_binary - Fix passing of -march arg. - Decode stdout from subprocess. - Print stdout from mpy-cross in __main__.py. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-26rp2/boards/WEACTSTUDIO: Add WEACTSTUDIO with multiple variants.Matt Trentini
This supports 2, 4, 8 and 16MB flash variants.
2022-09-26rp2/Makefile: Add support for BOARD_VARIANTS.Matt Trentini
Following stm32. This allows a single board definition to define variants of its configuration.
2022-09-26py/objstr: Don't treat bytes as unicode in str.count.Jim Mussared
`b'\xaa \xaa'.count(b'\xaa')` now (correctly) returns 2 instead of 1. Fixes issue #9404. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-26esp32/machine_pwm: Don't use LEDC_USE_REF_TICK on ESP32-C3 variants.Damien George
Because it's not supported by this particular MCU (since IDF v4.4.2). Signed-off-by: Damien George <damien@micropython.org>
2022-09-26esp32/modsocket: Use mp_obj_is_integer to test port type.Damien George
Because the value may be a big integer, which is still a valid type to use. Fixes issue #9410. Signed-off-by: Damien George <damien@micropython.org>
2022-09-25stm32/boards/NUCLEO_L152RE: Add NUCLEO-L152RE board support.yn386
This change adds NUCLEO-L152RE support to the STM32 port. NUCLEO-L152RE: https://www.st.com/en/evaluation-tools/nucleo-l152re.html This board use STM32L152RE: https://www.st.com/en/microcontrollers-microprocessors/stm32l152re.html
2022-09-25stm32: Add support for STM32L1 MCUs.yn386
This change adds STM32L1 support to the STM32 port.
2022-09-25lib/stm32lib: Update library to get L1 v1.10.3, and some other fixes.yn386
Changes in this new library version are: - Add L1 HAL at v1.10.3. - H7_HAL/rcc_ex: Add SPI45 to HAL_RCCEx_GetPeriphCLKFreq. - L4_HAL/gpio_ex: Add #define for GPIO_AF14_TIM2 on L4P5/L4Q5. - F4_HAL/i2c: Fix I2C frequency calculation macros. - L1_HAL/utils: Fix compile error when USE_HAL_DRIVER is defined.
2022-09-23stm32/make-stmconst.py: Support TypeDef's with a single char prefix.Jatty_
Update the regex to support parsing files from the STM32CubeU5 library.
2022-09-23py/parse: Allow const types other than int to optimise as true/false.Angus Gratton
Allows optimisation of cases like: import micropython _DEBUG = micropython.const(False) if _DEBUG: print('Debugging info') Previously the 'if' statement was only optimised out if the type of the const() argument was integer. The change is implemented in a way that makes the compiler slightly smaller (-16 bytes on PYBV11) but compilation will also be very slightly slower. As a bonus, if const support is enabled then the compiler can now optimise const truthy/falsey expressions of other types, like: while "something": pass ... unclear if that is useful, but perhaps it could be. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2022-09-23tests: Allow 'special' tests to output "SKIP" on a single line.Angus Gratton
2022-09-23extmod/modbluetooth: Run BLE IRQ callback in protected NLR context.Damien George
The call to invoke_irq_handler_run() always needs to run in a protected NLR context, to catch exceptions from the Python handler, and the m_new's (and also mp_local_alloc when PYSTACK is enabled). With MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS_WITH_INTERLOCK enabled there was already an explicit nlr_push, and that is now used in all cases. Without this change, on stm32 (for example), the callbacks from the BLE stack to invoke_irq_handler() were made via static scheduled nodes which do not have any NLR protection, and hence would lead to a hard fault (uncaught NLR) if an exception was raised in the Python BLE IRQ handler. This was a regression introduced by 8045ac07f599c0ccc447c88a0b778f704b497559, which is fixed by this commit. Signed-off-by: Damien George <damien@micropython.org>
2022-09-22extmod/modbluetooth: Do GATTC reassembly in protected uPy context.Damien George
The calls to m_new and m_del require an exclusive uPy (really a GC) context. In particular these functions cannot be called directly from a FreeRTOS task on esp32. Fixes issue #9369. Signed-off-by: Damien George <damien@micropython.org>
2022-09-22extmod/modbluetooth: Change data_len type from size_t to uint16_t.Damien George
For consistency, and to remove the need for additional conversion of types. Signed-off-by: Damien George <damien@micropython.org>
2022-09-20tests/run-multitests: Make paths more deterministic.Andrew Leech
Allows running from a different directory, etc. This work was funded by Planet Innovation.
2022-09-20tests/run-multitests: Extend usage information.Andrew Leech
2022-09-19unix/variants/coverage: Add test for manifest freeze_mpy().Jim Mussared
This uses the frozentest.mpy that is also used by ports/minimal. Also fixes two bugs that these new tests picked up: - File extension matching in manifestfile.py. - Handling of freeze_mpy results in makemanifest. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19tests/frozen: Move frozentest.mpy from ports/ to tests/.Jim Mussared
frozentest.mpy was previously duplicated in ports/minimal and ports/powerpc. This needs to be re-generated on every .mpy version increase, so might as well just have a single copy of it. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19extmod/vfs_posix_file: Implement finaliser for files.stijn
Prevent handle leaks when file objects aren't closed explicitly and fix some MICROPY_CPYTHON_COMPAT issues: this wasn't properly adhered to because #ifdef was used so it was always on, and closing files multiple times should be avoided unconditionally.
2022-09-19py: Include filename in errors from loading/saving files via "open".Damien George
This improves error messages in mpy-cross: - When loading a .py file that doesn't exist (or can't be opened) it now includes the filename in the OSError. - When saving a .mpy file that can't be opened it now raises an exception (prior, it would silently fail), and includes the filename in the OSError. Signed-off-by: Damien George <damien@micropython.org>
2022-09-19py/runtime: Add mp_raise_OSError_with_filename helper function.Damien George
Useful when more detail is needed for an OSError associated with a file. Signed-off-by: Damien George <damien@micropython.org>
2022-09-19py/objmodule: Add support for __dict__.Jim Mussared
This matches class `__dict__`, and is similarly gated on MICROPY_CPYTHON_COMPAT. Unlike class though, because modules's globals are actually dict instances, the result is a mutable dictionary. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19py/persistentcode: Introduce .mpy sub-version.Jim Mussared
The intent is to allow us to make breaking changes to the native ABI (e.g. changes to dynruntime.h) without needing the bytecode version to increment. With this commit the two bits previously used for the feature flags (but now unused as of .mpy version 6) encode a sub-version. A bytecode-only .mpy file can be loaded as long as MPY_VERSION matches, but a native .mpy (i.e. one with an arch set) must also match MPY_SUB_VERSION. This allows 3 additional updates to the native ABI per bytecode revision. The sub-version is set to 1 because the previous commits that changed the layout of mp_obj_type_t have changed the native ABI. Signed-off-by: Jim Mussared <jim.mussared@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
2022-09-19py/obj: Optimise code size and performance for make_new as a slot.Jim Mussared
The check for make_new (i.e. used to determine something's type) is now more complicated due to the slot access. This commit changes the inlining of a few frequently-used helpers to overall improve code size and performance.
2022-09-19py/obj: Convert make_new into a mp_obj_type_t slot.Jim Mussared
Instead of being an explicit field, it's now a slot like all the other methods. This is a marginal code size improvement because most types have a make_new (100/138 on PYBV11), however it improves consistency in how types are declared, removing the special case for make_new. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19py/obj: Merge getiter and iternext mp_obj_type_t slots.Jim Mussared
The goal here is to remove a slot (making way to turn make_new into a slot) as well as reduce code size by the ~40 references to mp_identity_getiter and mp_stream_unbuffered_iter. This introduces two new type flags: - MP_TYPE_FLAG_ITER_IS_ITERNEXT: This means that the "iter" slot in the type is "iternext", and should use the identity getiter. - MP_TYPE_FLAG_ITER_IS_CUSTOM: This means that the "iter" slot is a pointer to a mp_getiter_iternext_custom_t instance, which then defines both getiter and iternext. And a third flag that is the OR of both, MP_TYPE_FLAG_ITER_IS_STREAM: This means that the type should use the identity getiter, and mp_stream_unbuffered_iter as iternext. Finally, MP_TYPE_FLAG_ITER_IS_GETITER is defined as a no-op flag to give the default case where "iter" is "getiter". Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19py/objnamedtuple: Optimise slot RAM usage for namedtuple.Jim Mussared
Rather than reserving a full 12-slot mp_obj_type_t, reserve enough room for seven and cast as necessary. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>