summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2022-04-29lib/fsp: Add renesas fsp git repository as submodule.TakeoTakahashi2020
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-28lib/stm32lib: Update library for G0 v1.5.1.Damien George
Changes in this new library version are: - Add G0 HAL at v1.5.1. Signed-off-by: Damien George <damien@micropython.org>
2022-03-16lib/re1.5: Distinguish between subject start-of-line and start-of-srch.Damien George
Otherwise a repeated sub/split will continue to match ^ to the start of that search. Signed-off-by: Damien George <damien@micropython.org>
2022-01-06lib/stm32lib: Update library for fix to F7 USB HS.Damien George
Fixes build on MCUs with built-in USB HS PHY. Signed-off-by: Damien George <damien@micropython.org>
2021-12-14lib/stm32lib: Update library for L4 v1.17.0, new G4, WL, and MMC fixes.Damien George
Changes in this new library version are: - Update L4 HAL to v1.17.0. - Add G4 HAL at v1.3.0. - Add WL HAL at v1.1.0. - Fix F4 UART and DMA data loss with RX hardware flow control. - Optimise USB to pass config struct by reference. - Fix bug in F4 MMC HAL_MMC_Erase function. - Fix bug setting MMC relative address in F4 and F7 HAL. Signed-off-by: Damien George <damien@micropython.org>
2021-11-26lib: Update pico-sdk to 1.3.0 and tinyusb to 0.12.0.iabdalkader
Fixes #8025
2021-11-18lib/asf4: Point submodule to latest commit on circuitpython branch.Damien George
2021-10-26extmod/nimble: Update to NimBLE v1.4.Jim Mussared
We're using the MicroPython fork of NimBLE, which on the `micropython_1_4_0` branch re-adds support for 64-bit targets and fixes initialisation of g_msys_pool_list. Also updates modbluetooth_nimble.c to suit v1.4. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-07-13lib,shared: Update README's based on contents of these dirs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-07-12shared: Introduce new top-level dir and move 1st party lib code there.Damien George
This commit moves all first-party code developed for this project from lib/ to shared/, so that lib/ now only contains third-party code. The following directories are moved as-is from lib to shared: lib/libc -> shared/libc lib/memzip -> shared/memzip lib/netutils -> shared/netutils lib/timeutils -> shared/timeutils lib/upytesthelper -> shared/upytesthelper All files in lib/embed/ have been moved to shared/libc/. lib/mp-readline has been moved to shared/readline. lib/utils has been moved to shared/runtime, with the exception of lib/utils/printf.c which has been moved to shared/libc/printf.c. Signed-off-by: Damien George <damien@micropython.org>
2021-07-12lib/crypto-algorithms: Move crypto-algorithms code from extmod to lib.Damien George
It's third-party code, and not necessarily tied to extmod. Signed-off-by: Damien George <damien@micropython.org>
2021-07-12lib/uzlib: Move uzlib code from extmod to lib.Damien George
It's third-party code, and not necessarily tied to extmod. Signed-off-by: Damien George <damien@micropython.org>
2021-07-12lib/re1.5: Move re1.5 code from extmod to lib.Damien George
It's third-party code, and not necessarily tied to extmod. Signed-off-by: Damien George <damien@micropython.org>
2021-07-08lib/axtls: Update to latest axtls 2.1.5 wih additional commits.Damien George
Changes are: - update axTLS from 2.1.3 to 2.1.5 - os_port.h is now provided by the user of the library - PLATFORM_RNG_U8 can be defined for get_random - fix -fsanitize=undefined diagnostics Signed-off-by: Damien George <damien@micropython.org>
2021-07-08lib/utils/stdout_helpers: Make mp_hal_stdout_tx_strn_cooked efficient.Damien George
To reduce the number of calls to mp_hal_stdout_tx_strn and improve the overall throughput of printing data. This implementation is taken from ports/stm32/mphalport.c. Signed-off-by: Damien George <damien@micropython.org>
2021-07-05lib/pico-sdk: Update to version 1.2.0.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-07-05lib/tinyusb: Update to version 0.10.1.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-06-25mimxrt: Move calc_weekday helper function to timeutils.Krzysztof Adamski
This function may be useful for other ports as well so lets move it to timeutils so it can be reused. Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-05-25lib/mbedtls: Switch to currently latest commit of LTS branch v2.16.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-05-11lib/utils: Add ARM semihosting utility functions.Ayke van Laethem
This can be a replacement for a UART in custom ports.
2021-05-10py/gc: Make gc_lock_depth have a count per thread.Damien George
This commit makes gc_lock_depth have one counter per thread, instead of one global counter. This makes threads properly independent with respect to the GC, in particular threads can now independently lock the GC for themselves without locking it for other threads. It also means a given thread can run a hard IRQ without temporarily locking the GC for all other threads and potentially making them have MemoryError exceptions at random locations (this really only occurs on MCUs with multiple cores and no GIL, eg on the rp2 port). The commit also removes protection of the GC lock/unlock functions, which is no longer needed when the counter is per thread (and this also fixes the cas where a hard IRQ calling gc_lock() may stall waiting for the mutex). It also puts the check for `gc_lock_depth > 0` outside the GC mutex in gc_alloc, gc_realloc and gc_free, to potentially prevent a hard IRQ from waiting on a mutex if it does attempt to allocate heap memory (and putting the check outside the GC mutex is now safe now that there is a gc_lock_depth per thread). Signed-off-by: Damien George <damien@micropython.org>
2021-04-24lib/utils: Remove unused PYEXEC_SWITCH_MODE from pyexec.h.Damien George
It was made obsolete by commit c98c128fe885e539ecd73843756340f8950115c8. Signed-off-by: Damien George <damien@micropython.org>
2021-03-12lib/pico-sdk: Update to latest version 1.1.0.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-11lib/utils/gchelper_generic: Implement AArch64 support.Yonatan Goldschmidt
2021-03-11lib/mbedtls: Switch to currently latest commit of LTS branch v2.16.Mirko Vogt
From a version numbering point of view this is a downgrade (2.17.0 -> 2.16.x). However the latest commit for version 2.17.0 is from March 2019 and no further minor release happened after 2.17.0. This version is EOL. 2.16.x though is still actively maintained as a long term release, hence security and stability fixes are still being backported, including compatibility with upcoming compiler releases.
2021-02-12lib/tinyusb: Update to version 0.8.0.Damien George
Includes support for RP2040. Signed-off-by: Damien George <damien@micropython.org>
2021-02-02lib/pico-sdk: Update to latest version v1.0.1.Damien George
In particular it fixes GPIO19 so that it can be used as an output. Signed-off-by: Damien George <damien@micropython.org>
2021-01-30lib/utils/pyexec: Remove obsolete LCD initialization.stijn
This was added a long time ago in 75abee206d1a575aa98a486d043c94d64df432c1 when USB host support was added to the stm (now stm32) port, and when this pyexec code was actually part of the stm port. It's unlikely to work as intended anymore. If it is needed in the future then generic hook macros can be added in pyexec.
2021-01-29lib/pico-sdk: Add new pico-sdk submodule, for the rp2 port.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29lib/timeutils: Provide simple impl of extra funcs when Epoch is 1970.Damien George
Dates/times must be post 2000/1/1 to work correctly with these simple implementations. 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-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-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-11-30lib/utils/pyexec: Add stdin-reader on raw REPL with flow control.Damien George
Background: the friendly/normal REPL is intended for human use whereas the raw REPL is for computer use/automation. Raw REPL is used for things like pyboard.py script_to_run.py. The normal REPL has built-in flow control because it echos back the characters. That's not so with raw REPL and flow control is just implemented by rate limiting the amount of data that goes in. Currently it's fixed at 256 byte chunks every 10ms. This is sometimes too fast for slow MCUs or systems with small stdin buffers. It's also too slow for a lot of higher-end MCUs, ie it could be a lot faster. This commit adds a new raw REPL mode which includes flow control: the device will echo back a character after a certain number of bytes are sent to the host, and the host can use this to regulate the data going out to the device. The amount of characters is controlled by the device and sent to the host before communication starts. This flow control allows getting the maximum speed out of a serial link, regardless of the link or the device at the other end. Also, this new raw REPL mode parses and compiles the incoming data as it comes in. It does this by creating a "stdin reader" object which is then passed to the lexer. The lexer requests bytes from this "stdin reader" which retrieves bytes from the host, and does flow control. What this means is that no memory is used to store the script (in the existing raw REPL mode the device needs a big buffer to read in the script before it can pass it on to the lexer/parser/compiler). The only memory needed on the device is enough to parse and compile. Finally, it would be possible to extend this new raw REPL to allow bytecode (.mpy files) to be sent as well as text mode scripts (but that's not done in this commit). Some results follow. The test was to send a large 33k script that contains mostly comments and then prints out the heap, run via pyboard.py large.py. On PYBD-SF6, prior to this PR: $ ./pyboard.py large.py stack: 524 out of 23552 GC: total: 392192, used: 34464, free: 357728 No. of 1-blocks: 12, 2-blocks: 2, max blk sz: 2075, max free sz: 22345 GC memory layout; from 2001a3f0: 00000: h=hhhh=======================================hhBShShh==h=======h 00400: =====hh=B........h==h=========================================== 00800: ================================================================ 00c00: ================================================================ 01000: ================================================================ 01400: ================================================================ 01800: ================================================================ 01c00: ================================================================ 02000: ================================================================ 02400: ================================================================ 02800: ================================================================ 02c00: ================================================================ 03000: ================================================================ 03400: ================================================================ 03800: ================================================================ 03c00: ================================================================ 04000: ================================================================ 04400: ================================================================ 04800: ================================================================ 04c00: ================================================================ 05000: ================================================================ 05400: ================================================================ 05800: ================================================================ 05c00: ================================================================ 06000: ================================================================ 06400: ================================================================ 06800: ================================================================ 06c00: ================================================================ 07000: ================================================================ 07400: ================================================================ 07800: ================================================================ 07c00: ================================================================ 08000: ================================================================ 08400: ===============================================.....h==......... (349 lines all free) (the big blob of used memory is the large script). Same but with this PR: $ ./pyboard.py large.py stack: 524 out of 23552 GC: total: 392192, used: 1296, free: 390896 No. of 1-blocks: 12, 2-blocks: 3, max blk sz: 40, max free sz: 24420 GC memory layout; from 2001a3f0: 00000: h=hhhh=======================================hhBShShh==h=======h 00400: =====hh=h=B......h==.....h==.................................... (381 lines all free) The only thing in RAM is the compiled script (and some other unrelated items). Time to download before this PR: 1438ms, data rate: 230,799 bits/sec. Time to download with this PR: 119ms, data rate: 2,788,991 bits/sec. So it's more than 10 times faster, and uses significantly less RAM. Results are similar on other boards. On an stm32 board that connects via UART only at 115200 baud, the data rate goes from 80kbit/sec to 113kbit/sec, so gets close to saturating the UART link without loss of data. The new raw REPL mode also supports a single ctrl-C to break out of this flow-control mode, so that a ctrl-C can always get back to a known state. It's also backwards compatible with the original raw REPL mode, which is still supported with the same sequence of commands. The new raw REPL mode is activated by ctrl-E, which gives an error on devices that do not support the new mode. Signed-off-by: Damien George <damien@micropython.org>
2020-11-11lib/utils/pyexec: Add MICROPY_BOARD hooks before/after executing code.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-09-18all: Rename absolute time-based functions to include "epoch".Damien George
For time-based functions that work with absolute time there is the need for an Epoch, to set the zero-point at which the absolute time starts counting. Such functions include time.time() and filesystem stat return values. And different ports may use a different Epoch. To make it clearer what functions use the Epoch (whatever it may be), and make the ports more consistent with their use of the Epoch, this commit renames all Epoch related functions to include the word "epoch" in their name (and remove references to "2000"). Along with this rename, the following things have changed: - mp_hal_time_ns() is now specified to return the number of nanoseconds since the Epoch, rather than since 1970 (but since this is an internal function it doesn't change anything for the user). - littlefs timestamps on the esp8266 have been fixed (they were previously off by 30 years in nanoseconds). Otherwise, there is no functional change made by this commit. Signed-off-by: Damien George <damien@micropython.org>
2020-09-08stm32/uart: Allow static IRQ handler registration.Jim Mussared
This will allow the HCI UART to use a non-heap mp_irq_obj_t, which avoids needing to make a root pointer for it.
2020-09-04lib/utils/mpirq: Add mp_irq_init func, and clean up unused init method.Damien George
mp_irq_init() is useful when the IRQ object is allocated by the caller. The mp_irq_methods_t.init method is not used anywhere so has been removed. Signed-off-by: Damien George <damien@micropython.org>
2020-09-04lib/libm: Reduce size of static two_over_pi array.Damien George
Thanks to Jeff Epler for the idea. Signed-off-by: Damien George <damien@micropython.org>
2020-08-22lib/timeutils: Add helper functions to deal with nanosecs since 1970.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-07-22lib/libc: Fix string0's implementation of strncpy.Damien George
Fixing 98e583430fb7b793119db27bad9f98119e81579f, the semantics of strncpy require that the remainder of dst be filled with null bytes. Signed-off-by: Damien George <damien@micropython.org>
2020-07-21lib/libm_dbl: Add round.c source code.Zoltán Vörös
This code is imported from musl, to match existing code in libm_dbl. The file is also added to the build in stm32/Makefile. It's not needed by the core code but, similar to c5cc64175be32cb1e4f3f1a249667bc9f5a12613, allows round() to be used by user C modules or board extensions.
2020-07-21lib/stm32lib: Update library for H7 v1.6.0 and WB v1.6.0.Damien George
Changes in this new library version are: - Update H7 HAL to v1.6.0. - Update WB HAL to v1.6.0. - Add patches to fix F4 ll_uart clock selection for UART9/UART10. Signed-off-by: Damien George <damien@micropython.org>
2020-07-20lib/mbedtls_errors: Add code to patch mbedtls for shortened error strs.Thorsten von Eicken
The file `mbedtls_errors/mp_mbedtls_errors.c` can be used instead of `mbedtls/library/error.c` to give shorter error strings, reducing the build size of the error strings from about 12-16kB down to about 2-5kB.
2020-07-20lib/libc: Add implementation of strncpy.Thorsten von Eicken
2020-06-30lib/utils: Protect all of mpirq.c with MICROPY_ENABLE_SCHEDULER.Damien George
So it can be unconditionally included in a port's build even if certain configurations in that port do not use its features, to simplify the Makefile. Signed-off-by: Damien George <damien@micropython.org>
2020-06-19tools/uncrustify: Enable more opts to remove space between func and '('.David Lechner
With only `sp_func_proto_paren = remove` set there are some cases where uncrustify misses removing a space between the function name and the opening '('. This sets all of the related options to `force` as well.
2020-06-02lib/utils/pyexec: Add missing MP_ERROR_TEXT when compiler disabled.Damien George
2020-05-27lib/utils: Lock the scheduler when executing hard callback functions.Damien George
Otherwise scheduled functions may execute during the hard callback and then fail if they try to allocate heap memory.