summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-08-26tests/unicode: Add test for invalid utf-8 file contents.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26py/objstr: Always validate utf-8 for mp_obj_new_str.Jim Mussared
All uses of this are either tiny strings or not-known-to-be-safe. Update comments for mp_obj_new_str_copy and mp_obj_new_str_of_type. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26py/objstr: Optimise mp_obj_new_str_from_vstr for known-safe strings.Jim Mussared
The new `mp_obj_new_str_from_utf8_vstr` can be used when you know you already have a unicode-safe string. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26py/objstr: Always ensure mp_obj_str_from_vstr is unicode-safe.Jim Mussared
Now that we have `mp_obj_new_str_type_from_vstr` (private helper used by objstr.c) split from the public API (`mp_obj_new_str_from_vstr`), we can enforce a unicode check at the public API without incurring a performance cost on the various objstr.c methods (which are already working on known unicode-safe strings). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26py/objstr: Split mp_obj_str_from_vstr into bytes/str versions.Jim Mussared
Previously the desired output type was specified. Now make the type part of the function name. Because this function is used in a few places this saves code size due to smaller call-site. This makes `mp_obj_new_str_type_from_vstr` a private function of objstr.c (which is almost the only place where the output type isn't a compile-time constant). This saves ~140 bytes on PYBV11. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26esp8266/README: Update build instructions to match ci.sh.Jim Mussared
The existing non-Docker instructions are basically impossible to follow because the esp-open-sdk does not compile. Update these instructions to use the exact toolchain that our CI uses. Also split the Docker from non-Docker instructions, to avoid confusion about which commands need to be prefixed. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26docs/library/micropython: Fix spelling of compiler.Laurens Valk
Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-08-26docs/library: Fix nested rst styles not rendering.Laurens Valk
These can't be nested, so apply styling separately. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-08-26docs/library/machine.UART: Add notes about UART init and deinit.Tomasz 'CeDeROM' CEDRO
* `init()` can be called multiple times to reconfigure UART. * After `deinit()` it is impossible to call `init()` again. Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2022-08-26docs/esp32: Update UART quickref on input-only pins.Tomasz 'CeDeROM' CEDRO
Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2022-08-26docs: Update CPython differences and improve the look of table layouts.Matt Trentini
Updated some of the CPython feature differences: - Updated status of some features. - Added CSS to fix table widths to 100% and word wrap. - Specified explicit table column ratios to improve layout appearance. - Added missing references to anchors. - Better consistency with use of formatting and case.
2022-08-26tools/mpremote: Print nicer errors for unsupported 'cp -r' arguments.Damien George
Also document support for 'cp :a :b'. Signed-off-by: Damien George <damien@micropython.org>
2022-08-26tools/pyboard.py: Add fs_cp function for direct device-to-device copy.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-08-26tools/pyboard.py: Remove implicit fs_put if source starts with ./.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-08-26tools/mpremote: Print a nicer error when a filesystem command fails.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-08-26drivers/cc3000: Remove CC3000 WiFi driver files.Damien George
It's no longer used by any port. Signed-off-by: Damien George <damien@micropython.org>
2022-08-26stm32: Remove support for CC3000 WiFi driver.Damien George
It has been about 8 years since support for this chip was added. Reasons to remove it are: - It is no longer easy to obtain this part. - There are now many other options for WiFi. - It's not a good use of developer time to maintain it. Signed-off-by: Damien George <damien@micropython.org>
2022-08-26stm32/boardctrl: Use HAL_Delay instead of mp_hal_delay_ms.Jim Mussared
Not safe to use mp_hal_delay_ms before boot if threading is enabled, because threading will not have been initialised, and MICROPY_EVENT_POLL_HOOK assumes threading is initialised. HAL_Delay doesn't call MICROPY_EVENT_POLL_HOOK, but is still power-efficient like mp_hal_delay_ms (unlike mp_hal_delay_us). Fixes #7816. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26stm32: Move board variant config to mpconfigboard.mk.Jim Mussared
Rather than having the autobuild know about the particular variants, have the mpconfigboard.mk describe them and make autobuild discover them automatically. Adds a "query-variants" target to stm32/Makefile to allow the set of possible variants to be queried. Removes pybv3 from the autobuild as this isn't use by the downloads page. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-25stm32/boards: Increase mboot region to 32k for WB55 boards.Andrew Leech
If mboot is built with support for packing (signing/encryption) it needs up to 32KiB. So for simplicity increase the mboot region to 32KiB unconditionally for WB55 boards (custom WB55 board configurations can still provide their own linker scripts to override this).
2022-08-25stm32/sdram: Enable MPU for unaligned access on H7 MCUs.Damiano Mazzella
So that SDRAM can be used as the heap on ARDUINO_PORTENTA_H7, for example. Fixes issue #9087.
2022-08-24esp32/machine_timer: Support all init arguments in Timer constructor.robert-hh
Following the usual style of instantiation and init().
2022-08-23esp32/machine_uart: Change sendbreak time to be at least 15 bit times.robert-hh
It used to be 10 bit times, which is too short. The break state must be longer than a regular character time, at least 13 bit times. This is now implemented by reducing the baudrate while sending the "0". The break time will now vary with data length and parity setting, but will at least be 15 bit times. Tested with a GENERIC_SPIRAM, GENERIC_C3 and UM_TINYS2 board.
2022-08-23esp8266/modnetwork: Add support for WLAN.config(protocol=XX) option.glenn20
Following esp32. This is preferred to using the phy_mode() function.
2022-08-23esp32/modnetwork: Add network.MODE_LR constant.glenn20
Adds the MODE_LR constant to the network module to support Espressif's long-range communication protocol.
2022-08-23esp32/network_wlan: Add support to set/get the wifi protocol.glenn20
Add 'protocol' option to WLAN.config() to support setting/getting the wifi protocol modes: MODE_11G|MODE_11G|MODE_11N.
2022-08-23esp32/network_wlan: Use esp_wifi_set/get_channel to config wifi channel.glenn20
Set the channel with esp_wifi_set_channel(), which adds support for setting the channel of the STA interface Get the channel with esp_wifi_get_channel() which returns the actual wifi channel of the radio, rather than the configured channel.
2022-08-23rp2/machine_wdt: Check for the maximum timeout value of watchdog.robert-hh
The value will be checked for timeout <= 8388. Notes were added to the documentation.
2022-08-23extmod/network_wiznet5k: Use the configured DNS address if available.robert-hh
Instead of the default 8.8.8.8. The change was suggested by @omogenot.
2022-08-23drivers/wiznet5k: Remove old Wiznet driver.robert-hh
It has been replaced by the submodule lib/wiznet5k.
2022-08-23tools/ci.sh: Split the stm32 builds for wiznet5k and cc3k.robert-hh
- Add lib/wiznet5k into the 'make submodules' step. - Split the stm32 builds for wiznet5k and cc3k. - Run 'make .... clean' after making the wiznet5k build.
2022-08-23stm32/mphalport: Add mp_hal_get_spi_obj() helper function.robert-hh
The function spi_from_mp_obj() is kept since it is used by the cc3k driver.
2022-08-23stm32: Add definitions required for lwIP version of Wiznet NIC.robert-hh
2022-08-23stm32: Switch Wiznet to use lib/wiznet5k and extmod/network_wiznet5k.robert-hh
Instead of the old Wiznet driver in drivers/wiznet5k.
2022-08-23mpy-cross,unix: Include alloca.h for NetBSD.Chris Waggoner
2022-08-23py/builtinimport: Allow overriding of mp_builtin___import__.Laurens Valk
This allows ports to override mp_builtin___import__. This can be useful in MicroPython applications where MICROPY_ENABLE_EXTERNAL_IMPORT has to be disabled due to its impact on build size (2% to 2.5% of the minimal port). By overriding the otherwise very minimal mp_builtin___import__, ports can still allow limited forms of application-specific imports. Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-08-23py: Clean up formatting of union definitions.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-08-23shared/runtime/sys_stdio_mphal: Make func static and remove some TODOs.Damien George
stdio_obj_print is private to this file so can be made static. The __del__ method does nothing so can be removed (it's only called by the GC if it exists, so if it doesn't exist it won't be called). And FileIO doesn't support a constructor in MicroPython at this stage. Signed-off-by: Damien George <damien@micropython.org>
2022-08-22javascript: Rename this port to 'webassembly'.Nicholas H.Tollervey
2022-08-19extmod/modframebuf: Improve poly-fill boundary pixels.Jim Mussared
Rather than drawing the entire boundary to catch missing pixels, just detect the cases where boundary pixels are skipped during node calculation and pre-emptively draw them then. This adds 72 bytes on PYBV11, but makes filled poly() 20% faster. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19extmod/modframebuf: Add polygon drawing methods.Mat Booth
Add method for drawing polygons. For non-filled polygons, uses the existing line-drawing code to render arbitrary polygons using the given coords list, at the given x,y position, in the given colour. For filled polygons, arbitrary closed polygons are rendered using a fast point-in-polygon algorithm to determine where the edges of the polygon lie on each pixel row. Tests and documentation updates are also included. Signed-off-by: Mat Booth <mat.booth@gmail.com>
2022-08-19extmod/modframebuf: Add ellipse drawing method.Peter Hinch
2022-08-19extmod/modframebuf: Add fill argument to rect().Jim Mussared
We plan to add `ellipse` and `poly` methods, but rather than having to implement a `fill_xyz` version of each, we can make them take an optional fill argument. This commit add this to `rect` as a starting point. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19py/dynruntime: Add mp_obj_is_true.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19extmod/modframebuf: Optimise argument handling.Jim Mussared
Several methods extract mp_int_t from adjacent arguments. This reduces code size for the repeated calls to mp_obj_get_int. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18tools/mpremote: Add "edit" command.Jim Mussared
This allows a remote file to be edited locally by copying it over, running the local editor, then copying it back. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18tools/pyboard.py: Add "touch" filesystem command.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18tools/mpremote: Allow + terminator for fs commands.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18all: Remove MICROPY_PY_IO_FILEIO config option.Damien George
Since commit e65d1e69e88268145ff0e7e73240f028885915be there is no longer an io.FileIO class, so this option is no longer needed. This option also controlled whether or not files supported being opened in binary mode (eg 'rb'), and could, if disabled, lead to confusion as to why opening a file in binary mode silently did the wrong thing (it would just open in text mode if MICROPY_PY_IO_FILEIO was disabled). The various VFS implementations (POSIX, FAT, LFS) were the only places where enabling this option made a difference, and in almost all cases where one of these filesystems were enabled, MICROPY_PY_IO_FILEIO was also enabled. So it makes sense to just unconditionally enable this feature (ability to open a file in binary mode) in all cases, and so just remove this config option altogether. That makes configuration simpler and means binary file support always exists (and opening a file in binary mode is arguably more fundamental than opening in text mode, so if anything should be configurable then it should be the ability to open in text mode). Signed-off-by: Damien George <damien@micropython.org>
2022-08-18extmod/vfs_posix_file: Remove unused MICROPY_VFS_POSIX_FILE.Damien George
This was made obsolete by 2b409ef8a46015f8f3bd20bc44e644637dbe9bd3 Signed-off-by: Damien George <damien@micropython.org>