aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-01-29stm32/mboot: Don't auto-detect littlefs block size.Damien George
Instead it is now passed in as an optional parameter to the ELEM_MOUNT element, with a compile-time configurable default. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/main: Check block 0 and 1 when auto-detecting littlefs.Damien George
The superblock for littlefs is in block 0 and 1, but block 0 may be erased or partially written, so block 1 must be checked if block 0 does not have a valid littlefs superblock in it. Prior to this commit, if block 0 did not contain a valid littlefs superblock (but block 1 did) then the auto-detection would fail, mounting a FAT filesystem would also fail, and the system would reformat the flash, even though it may have contained a valid littlefs filesystem. This is now fixed. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29extmod/vfs: Check block 0 and 1 when auto-detecting littlefs.Damien George
The superblock for littlefs is in block 0 and 1, but block 0 may be erased or partially written, so block 1 must be checked if block 0 does not have a valid littlefs superblock in it. Prior to this commit, the mount of a block device which auto-detected the filysystem type would fail for littlefs if block 0 did not contain a valid superblock. That is now fixed. Signed-off-by: Damien George <damien@micropython.org>
2021-01-27docs/develop: Add MicroPython Internals chapter.nanjekyejoannah
This commit adds many new sections to the existing "Developing and building MicroPython" chapter to make it all about the internals of MicroPython. This work was done as part of Google's Season of Docs 2020.
2021-01-24tools/ci.sh: For code size build, fetch history of master branch only.Damien George
It's not necessary to fetch all branches. Signed-off-by: Damien George <damien@micropython.org>
2021-01-24github/workflows: Fix code-size CI workflow.Damien George
Changes are: - Use ubuntu-20.04 so that gcc-multilib installs without error. - Use "fetch-depth: 100" to get history prior to pull request. Signed-off-by: Damien George <damien@micropython.org>
2021-01-23cc3200: Fix debug build.Vincent Duvert
* Fix a typo in the Makefile that prevented the debug build to be actually enabled when BTYPE=debug is used. * Add a missing header in modmachine.c that is used when a debug build is created.
2021-01-23cc3200/ftp: Add quotes to PWD response and allow FEAT prior to login.Vincent Duvert
This commit improves some FTP implementation details for better compatibility with FTP clients: * The PWD command now puts quotes around the directory name before returning it. This fixes BBEdit’s FTP client, which performs a PWD after each CWD and gets confused if the returned directory path is not surrounded by quotes. * The FEAT command is now allowed before logging in. This fixes the lftp client, which send FEAT first and gets confused (tries to use TLS) if the server responds with 332.
2021-01-23unix/modtime: Fix time() precision on unix ports with non-double floats.Oliver Joos
With MICROPY_FLOAT_IMPL_FLOAT the results of utime.time(), gmtime() and localtime() change only every 129 seconds. As one consequence tests/extmod/vfs_lfs_mtime.py will fail on a unix port with LFS support. With this patch these functions only return floats if MICROPY_FLOAT_IMPL_DOUBLE is used. Otherwise they return integers.
2021-01-23tests/extmod: Add test for the precision of utime functions.Oliver Joos
According to documentation time() has a precision of at least 1 second. This test runs for 2.5 seconds and calls all utime functions every 100ms. Then it checks if they returned enough different results. All functions with sub-second precision will return ~25 results. This test passes with 15 results or more. Functions that do not exist are skipped silently.
2021-01-23esp32/modnetwork: Synchronize WiFi AUTH_xxx constants with IDF values.IhorNehrutsa
2021-01-23zephyr: Add basic UART functionality to machine module.Yonatan Schachter
Currently supports only polling read and write. Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2021-01-22extmod/modbluetooth: Add ble.hci_cmd(ogf, ocf, req, resp) function.Jim Mussared
This allows sending arbitrary HCI commands and getting the response. The return value of the function is the status of the command. This is intended for debugging and not to be a part of the public API, and must be enabled via mpconfigboard.h. It's currently only implemented for NimBLE bindings. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-01-18stm32/Makefile: Use MBOOT_PACK_KEYS_FILE as depedency of .pack.dfu.Damien George
To match the definition of GENERATE_PACK_DFU, so a board can customise the location/name of this file if needed. Signed-off-by: Damien George <damien@micropython.org>
2021-01-18tools/ci.sh: Pip install pyhy for stm32 builds.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-18stm32/boards/NUCLEO_WB55: Enable MBOOT with packing mode.Damien George
To have at least one board configured with MBOOT_ENABLE_PACKING, for CI testing purposes and demonstration of the feature. Signed-off-by: Damien George <damien@micropython.org>
2021-01-18stm32/mboot: Add support for signed and encrypted firmware updates.Damien George
This commit adds support to stm32's mboot for signe, encrypted and compressed DFU updates. It is based on inital work done by Andrew Leech. The feature is enabled by setting MBOOT_ENABLE_PACKING to 1 in the board's mpconfigboard.mk file, and by providing a header file in the board folder (usually called mboot_keys.h) with a set of signing and encryption keys (which can be generated by mboot_pack_dfu.py). The signing and encryption is provided by libhydrogen. Compression is provided by uzlib. Enabling packing costs about 3k of flash. The included mboot_pack_dfu.py script converts a .dfu file to a .pack.dfu file which can be subsequently deployed to a board with mboot in packing mode. This .pack.dfu file is created as follows: - the firmware from the original .dfu is split into chunks (so the decryption can fit in RAM) - each chunk is compressed, encrypted, a header added, then signed - a special final chunk is added with a signature of the entire firmware - all chunks are concatenated to make the final .pack.dfu file The .pack.dfu file can be deployed over USB or from the internal filesystem on the device (if MBOOT_FSLOAD is enabled). See #5267 and #5309 for additional discussion. Signed-off-by: Damien George <damien@micropython.org>
2021-01-18stm32/mboot/gzstream: Fix lost data decompressing final part of file.Damien George
Prior to this fix, the final piece of data in a compressed file may have been lost when decompressing. Signed-off-by: Damien George <damien@micropython.org>
2021-01-18lib/libhydrogen: Add new libhydrogen submodule.Damien George
This library is a small and easy-to-use cryptographic library which is well suited to embedded systems. Signed-off-by: Damien George <damien@micropython.org>
2020-12-23extmod/nimble: Don't assert on save-IRK failure.Jim Mussared
2020-12-23extmod/nimble: Reset NimBLE BSS in mp_bluetooth_init.Jim Mussared
Without this fix, each time service registration happened it would do an increasingly large malloc() for service state. See https://github.com/apache/mynewt-nimble/issues/896.
2020-12-18tests/misc/sys_settrace_features.py: Fix running with non-dflt encoding.stijn
Notably git-cmd which comes with git installations on Windows alters the encoding resulting in CPython tracing encodings/cp1252.py calls.
2020-12-18tests/misc/sys_settrace: Make test output independent of invoked path.stijn
The original logic of reducing a full path to a relative one assumes "tests/misc" is in the filename which is limited in usage: it never works for CPython on Windows since that will use a backslash as path separator, and also won't work when the filename is a path not relative to the tests directory which happens for example in the common case of running "./run-tests -d misc". Fix all cases by printing only the bare filename, which requires them all to start with sys_settrace_ hence the renaming.
2020-12-18teensy: Fix build errors and warnings and enable -Werror.Damien George
Changes are: - Remove include of stm32's adc.h because it was recently changed and is no longer compatible with teensy (and not used anyway). - Remove define of __disable_irq in mpconfigport.h because it was clashing with an equivalent definition in core/mk20dx128.h. - Add -Werror to CFLAGS, and change -std=gnu99 to -std=c99. Signed-off-by: Damien George <damien@micropython.org>
2020-12-18stm32/boards/PYBD_SF2: Disable SPIFLASH_ENABLE_CACHE for mboot builds.Damien George
Mboot builds do not use the external SPI flash in caching mode, and explicitly disabling it saves RAM and a small bit of flash. Signed-off-by: Damien George <damien@micropython.org>
2020-12-18drivers/memory/spiflash: Add MICROPY_HW_SPIFLASH_ENABLE_CACHE option.Damien George
This only needs to be enabled if a board uses FAT FS on external SPI flash. When disabled (and using external SPI flash) 4k of RAM can be saved. Signed-off-by: Damien George <damien@micropython.org>
2020-12-18stm32/main: Do extended readblocks call when auto-detecting littlefs.Damien George
When littlefs is enabled extended reading must be supported, and using this function to read the first block for auto-detection is more efficient (a smaller read) and does not require a cached SPI-flash read. Signed-off-by: Damien George <damien@micropython.org>
2020-12-18stm32/adc: Deselect VBAT after reading to prevent battery drain.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-12-17stm32/sdram: Add SDRAM enter/leave self-refresh mode functions.iabdalkader
These functions enable SDRAM data retention in stop mode. Example usage, in mpconfigboard.h: #define MICROPY_BOARD_ENTER_STOP sdram_enter_low_power(); #define MICROPY_BOARD_LEAVE_STOP sdram_leave_low_power();
2020-12-17stm32/system_stm32: Enable DBGMCU in low-power modes for debug builds.iabdalkader
2020-12-17stm32/pyb_can: Add ability to calculate CAN bit timing from baudrate.iabdalkader
Calculate the bit timing from baudrate if provided, allowing sample point override. This makes it a lot easier to make CAN work between different MCUs with different clocks, prescalers etc. Tested on F4, F7 and H7 Y/V variants.
2020-12-17extmod/vfs: Raise OSError(ENODEV) if mounting bdev without a filesystem.Oliver Joos
This commit prevents uos.mount() from raising an AttributeError. vfs_autodetect() is supposed to return an object that has a "mount" method, so if no filesystem is found it should raise an OSError(ENODEV) and not return the bdev itself which has no "mount" method.
2020-12-17tests/extmod: Add test to try and mount a block device directly.Oliver Joos
Mounting a bdev directly tries to auto-detect the filesystem and if none is found an OSError(19,) should be raised. The fourth parameter of readblocks() and writeblocks() must be optional to support ports with MICROPY_VFS_FAT=1. Otherwise mounting a bdev may fail because looking for a FATFS will call readblocks() with only 3 parameters.
2020-12-14extmod/modubinascii: Update code, docs for hexlify now CPython has sep.Damien George
Since CPython 3.8 the optional "sep" argument to hexlify is officially supported, so update comments in the code and the docs to reflect this. Signed-off-by: Damien George <damien@micropython.org>
2020-12-14py/mkrules.mk: Remove stray vpath and unused -Itmp, add $(Q) for $(AR).Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-12-14py/modmath: Simplify handling of positional args to reduce code size.Damien George
As a general pattern, required positional arguments that are not named do not need to be parsed using mp_arg_parse_all(). Signed-off-by: Damien George <damien@micropython.org>
2020-12-14tools/ci.sh: Use pip-install to get latest version of esptool.py.Damien George
Because the version included in xtensa-lx106-elf-standalone.tar.gz needs Python 2 (and pyserial for Python 2). Signed-off-by: Damien George <damien@micropython.org>
2020-12-14tools/ci.sh: Put echo of CI path in a separate function.Damien George
Because the setup functions may print other information which should not be added to the path. Signed-off-by: Damien George <damien@micropython.org>
2020-12-14tests/misc/sys_settrace_features.py: Ignore CPython zipimport traces.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-12-10stm32/usb: Allocate 128 bytes to CDC data out EPs on non-multi-OTG MCUs.Damien George
This much buffer space is required for CDC data out endpoints to avoid any buffer overflows when the USB CDC is saturated with data. Signed-off-by: Damien George <damien@micropython.org>
2020-12-10lib/stm32lib: Update library for WB v1.10.0.Damien George
Changes in this new library version are: - Update WB HAL to v1.10.0. Signed-off-by: Damien George <damien@micropython.org>
2020-12-09stm32/mboot: Enable LFS2_READONLY for mboot builds with littlefs.Damien George
To reduce code size, since mboot does not modify the filesystem. Signed-off-by: Damien George <damien@micropython.org>
2020-12-09lib/littlefs: Guard lfs2_mlist_isopen with LFS2_NO_ASSERT.Damien George
To prevent warnings about this function being unused when assertions are disabled. Signed-off-by: Damien George <damien@micropython.org>
2020-12-09lib/littlefs: Update littlefs2 to v2.3.0.Damien George
At commit 1a59954ec64ca168828a15242cc6de94ac75f9d1 Signed-off-by: Damien George <damien@micropython.org>
2020-12-08stm32/boards/NUCLEO_H743ZI: Enable ethernet peripheral.Reinhard Feger
2020-12-08stm32/eth: Add support for H7 processors.Reinhard Feger
2020-12-08stm32/boards/stm32h743.ld: Enable D2 RAM and add eth-buffer section.Reinhard Feger
2020-12-07nrf: Change selected boards to utilize pre-flashed bootloader.Glenn Ruben Bakke
The nrf52840-mdk-usb-dongle and pca10050 comes with a pre-flashed bootloader (OpenBootloader). This commit updates the boards "mpconfigboard.mk" to use DFU as default flashing method and set the corresponding BOOTLOADER settings such that nrf52840_open_bootloader_1.2.x.ld linker script is used. The default DFU flashing method can be disabled by issuing "DFU=0" when invoking make. This will lead to "segger" being used as default flashing tool. When using "DFU=0", the linker scripts will not compensate for any MBR and Bootloader region being present, and might overwrite them if they were present. The commit also removes the custom linker script specific to nrf52840-mdk-usb-dongle as it now points to a generic. Updated nrf52840-mdk-usb-dongle's README.md to be more clear on how to deploy the built firmware. The port README.md has also been updated. In the list of target boards a new column has been added to indicate which bootloader is present on the target board. And for consistency, changed all examples in the README.md to use "deploy" instead of "flash".
2020-12-07nrf/boards: Add linker script for nrf52840 Open Bootloader 1.2.0.Glenn Ruben Bakke
2020-12-07nrf/Makefile: Add support for flashing with nrfutil.Glenn Ruben Bakke
An additional Makefile parameter NRFUTIL_PORT can be set in order to define the serial port to used for the DFU (Default: /dev/ttyACM0). The "nrfutil" that is used as flasher towards OpenBootloader is available for installation through Python "pip". In case of SD=s140, SoftDevice ID 0xB6 is passed to nrfutil's package generation which corresponds to SoftDevice s140 v6.1.1.