summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2019-02-12all: Change PYB message prefix to MPY.Mike Causer
Replaces "PYB: soft reboot" with "MPY: soft reboot", etc. Having a consistent prefix across ports reduces the difference between ports, which is a general goal. And this change won't break pyboard.py because that tool only looks for "soft reboot".
2019-02-12lib/utils/gchelper: Add gchelper.h header file for assembler functions.Damien George
2019-02-12lib/utils/gchelper_m3: Add gc_helper_get_sp() function.Damien George
2019-02-12lib/utils/gchelper_m3: Add license header and clean up code.Damien George
This file generates the same code with the cortex-m3 and cortex-m4 assembler directive, so use cortex-m3 to support more CPUs.
2019-02-12stm32: Move gchelper assembler code to lib/utils for use by other ports.Damien George
2019-02-06lib/utils/printf: Exclude __GI_vsnprintf alias for gcc 9 and above.Damien George
See issue #4457.
2019-01-31lib/nrfx: Upgrade to nrfx v1.3.1.Damien George
2019-01-28lib/utils/pyexec: Implement paste mode with event driven REPL.Damien George
2019-01-24lib/stm32lib: Update library to get F413 BOR defs and fix gcc 8 warning.Damien George
2018-12-29lib/utils: Add generic MicroPython IRQ helper functions.Tobias Badertscher
Initial implementation of this is taken from the cc3200 port.
2018-10-13lib/utils/pyexec: Forcefully unlock the heap if locked and REPL active.Damien George
Otherwise there is really nothing that can be done, it can't be unlocked by the user because there is no way to allocate memory to execute the unlock. See issue #4205 and #4209.
2018-09-27lib/libm/math: Add implementation of __signbitf, if needed by a port.Damien George
2018-09-27lib/libm/math: Fix int type in float union, uint64_t should be uint32_t.Damien George
A float is 32-bits wide.
2018-09-26lib/stm32lib: Update library to fix issue with filling USB TX FIFO.Damien George
2018-09-20lib/libm_dbl: Add implementation of copysign() for DEBUG builds.Andrew Leech
This provides a double variant of the float copysignf from libm/math.c which is required for DEBUG=1 builds when MICROPY_FLOAT_IMPL=double
2018-09-04lib/libm/wf_tgamma: Fix tgammaf handling of -inf, should return nan.Damien George
2018-09-04lib/libm/math: Make tanhf more efficient and handle large numbers.Damien George
Prior to this patch tanhf(large number) would return nan due to inf/inf.
2018-09-04lib/libm_dbl/tanh: Make tanh more efficient and handle large numbers.Damien George
Prior to this patch tanh(large number) would return nan due to inf/inf.
2018-08-02py/mpconfig.h: Introduce MICROPY_DEBUG_PRINTER for debugging output.Damien George
This patch in effect renames MICROPY_DEBUG_PRINTER_DEST to MICROPY_DEBUG_PRINTER, moving its default definition from lib/utils/printf.c to py/mpconfig.h to make it official and documented, and makes this macro a pointer rather than the actual mp_print_t struct. This is done to get consistency with MICROPY_ERROR_PRINTER, and provide this macro for use outside just lib/utils/printf.c. Ports are updated to use the new macro name.
2018-07-18nrf: Upgrade to nrfx 1.1.0Glenn Ruben Bakke
2018-07-18nrf: Add support for reading output pin stateGlenn Ruben Bakke
Current adoption on top of nrfx only reads the GPIO->IN register. In order to read back an output state, nrf_gpio_pin_out_read has to be called. This patch concatinate the two read functions such that, if either IN or OUT register has a value 1 it will return this, else 0. Updating lib/nrfx submodule to latest version of master to get the new GPIO API to read pin direction. (nrfx: d37b16f2b894b0928395f6f56ca741287a31a244)
2018-07-18nrf: Replace custom-HAL with nrfx-HALglennrub
Summarized this squashed PR replaces the hal/ folder in the port. This has been replaced the official HAL layer from Nordic Semiconductor; https://github.com/NordicSemiconductor/nrfx. A Git submodule has been added under lib/nrfx, for the nrfx dependency. The drivers / modules has been updated to use this new HAL layer; nrfx at v1.0.0. Also, header files and system files for nrf51/nrf52x chip variants has been deleted from the device/ folder, only keeping back the startup files written in C. All other files are now fetched from nrfx. 3 new header files in the ports/nrf/ folder has been added to configure nrfx (nrfx_config.h), logging (nrfx_log.h) and glue nrfx together with the drivers and modules from micropython (nrfx_glue.h). The PR has been a joint effort from @aykevl (Ayke van Laethem) and @glennrub. For reference, the commit log will be kept to get an overview of the changes done: * ports/nrf: Initial commit for moving hal to Nordic Semiconductor BSD-3 licensed nrfx-hal. * ports/nrf: Adding nrfx, Nordic Semiconductor BSD-3 hal layer, as git submodule checked out at lib/nrfx. * ports/nrf/modules/machine/uart: Fixing bug which set hwfc to parity excluded, always resulting in no flow control, hence corrupted output. Also adding an extra loop on uart_tx_char to prevent any tx when any ongoing tx is in progress. * ports/nrf/i2c: Moving I2C over to nrfx driver. * ports/nrf/modules/machine/i2c: Alignment. Renaming print function param 'o' to 'self_in' * ports/nrf/spi: Updating SPI machine module to use nrfx drivers. * ports/nrf: Renaming modules/machine/rtc.c/.h to rtcounter.c/.h to not confuse the peripheral with Real-Time Clock: * ports/nrf: Updating various files after renaming machine module RTC to RTCounter. * ports/nrf: Renaming RTC to RTCounter in modmachine globals dict table. Also updating object type name to reflect new module name. * ports/nrf: Fixing leftovers after renaming rtc to rtcounter. * ports/nrf: Early untested adoption of nrfx_rtc in RTCounter. Untested. * nrf/modules/machine/i2c: Improve keyword argument handling * ports/nrf/modules/temp: Updating Temp machine module to use nrfx defined hal nrf_temp.h. Moving logic of BLE stack awareness to machine module. * ports/nrf/boards/pca10040: Enable machine Temp module. * nrf/modules/machine/rtcounter: Remove magic constants. * ports/nrf: Adding base support for nrfx module logging. Adding option to disable logging of UART as it might log its own setup over UART while the peripheral is not yet set up. Logging of UART could make sense if other transport of log is used. * ports/nrf: updating nrfx_log.h with more correct parenthisis on macro grouping. * ports/nrf: Updating nrfx logging with configuration to disable logging of UART module. The pattern can be used to turn off other modules as well. However, for now UART is the only module locking itself by logging before the peripheral is configured. Logging is turned off by default, can be enabled in nrfx_config.h by setting NRFX_LOG_ENABLED=1. * ports/nrf/modules/random: Updating modrandom to use nrfx hal for rng. Not using nrfx-driver for this peripheral as its blocking mode would do the trick on RNG. Moving softdevice aware code from legacy hal to modrandom.c. * nrf: Enable Peripheral Resource Sharing. This enables TWI and SPI to be enabled at the same time. * nrf/Makefile: Define MCU sub variant (e.g. NRF51822/NRF51422) * nrf: Port TIMER peripheral to nrfx HAL. * nrf/modules/machine/uart: Optimize UART module For a nRF51, this results in a size reduction of: .text: -68 bytes .data: -56 bytes * nrf/modules/machine/uart: Don't use magic index numbers. * nrf/modules/machine/uart: Fix off-by-one error. For nrf51: .text: -40 bytes * nrf/modules/machine/rtcounter: Update for nrfx HAL. * nrf/modules/machine/i2c: Reduce RAM consumption. Reductions for the nrf51: flash: -108 bytes RAM: -72 bytes * nrf/mpconfigport: Avoid unnecessary root pointers. This saves 92 bytes of RAM. * nrf: Support SoftDevice with nrfx HAL. * nrf: Add NVMC peripheral (microbitfs) support. There is no support yet for a SoftDevice. It also fixes a potentially serious bug in start_index generation. * nrf/modules/machine/spi: Optimize SPI peripheral. nrf51: text: -340 bytes data: -72 bytes nrf52: text: -352 bytes data: -108 bytes * nrf/modules/random: Forgot to commit header file. * nrf: Make nrfx_config.h universal for all boards. * nrf: Use SoftDevice API for flash access when built for SD * nrf/drivers/bluetooth: Remove legacy HAL driver includes. These were not used anymore so can be removed. * ports/nrf/microbit: Port microbit targets to nrfx HAL Initial port of microbit modules to use nrfx HAL layer. Tested display/image and modmusic on micro:bit to verify that softpwm and ticker for nrf51 is working as expected. Changing IRQ priority on timer to priority 2, as 1 might collide if used side by side of SD110 BLE stack. The patch reserves Timer1 peripheral compile time. This is not ideal and should be resolved in seperate task. * nrf/boards/microbit: Remove custom nrfx_config.h from microbit target, adding disablement of timer1 if softpwm is enabled. * nrf/adc: Update ADC module to use nrfx * nrf/modules/machine/pwm: Updating machine PWM module to use nrfx HAL driver. examples/nrf52_pwm.py and examples/nrf52_servo.py tested on pca10040. * nrf: Removing hal folder and boards nrf5x_hal_conf.h headers. * nrf/nrfx_glue: Adding direct NVIC access for S110 BLE stack If SoftDevice s110 has not yet been initialized, the IRQ will not be forwarded to the application using the sd_nvic* function calls. Hence, direct access to cmsi nvic functions are used instead if SoftDevice is not enabled. * nrf/drivers/ticker: Setting IRQ priority 3 on Timer1 SoftDevice fails to initilize if Timer1 has been configured to priority level 2 before enabling the SD. The timer is set to priority 1, higher than BLE stack in order to provide better quality of music rendering when used with the music module. This might be too high, time will show. * nrf/examples: Updating ubluepy_temp after moving RTCounter to nrfx. * nrf: delete duplicate files from device folder which can be located in nrfx/mdk. * nrf/Makefile: Fetch system files from nrfx. Testing on each device sub-variant to figure out which system file to use. Reason for this is that nrf52.c is actually defining nrf52832. Removing NRF_DEFINES parameter setting the device in use into the same sub-variant test, as NRF52 is unique to nrf52832 when using nrfx. Without this exclusion of -DNRF52 in compilation for nrf52840, the device will be interpreted as a nrf52, hence nrf52832. Also, changing name on variable SRC_NRF_HAL to SRC_NRFX_HAL to explicitly tell the origin of the file. * nrf: Updating device #ifdefs to be more open to non-nrf51 targets. * nrf/modules/machine/uart: Removing second instance of UART for nrf52840 as it only has one non-DMA variant. * nrf/device: Removing system files as these are now used from nrfx/mdk * nrf: Moving startup files in device one level up as there is no need for deep hierarchy. * nrf: Use NRF52_SERIES defined in nrfx/mdk/nrf.h as define value when testing for both nrf52(832) and nrf52840 variants. * nrf/modules/machine/uart: Enable UART RX by default Enable rx by default after intiialization of the peripheral. Else, the nrfx driver will re-enable rx for each byte read on uart REPL, clearing the EVENT_RXDRDY before second byte, which again will make second byte get lost and read will get stuck. This happens if the bytes are transmitted nrf(51) while still processing the previous byte. Not seen on nrf52, but should also become an issue at higher speeds. This patch sets rx to always be enabled. Hence, not clearing the event between read bytes, and it will be able to detect next byte recieved upon finishing the first. * nrf/modules/machine/timer: Fixing defines excluding Timer1 if ticker/softpwm is used. * nrf: Switching import form mpconfigboard.h to mpconfigport.h in nrfx_config.h as mpconfigboard.h might define default values for defines not set by board specific header. * nrf/modules/machine/i2c: nrfx integration fixes Increasing speed to 400K. Returning Address NACK's as MP error code; MP_ENODEV. Returning MP_ETIMEOUT on all other error codes from TWI nrfx driver except the ANACK. Enabling and disabling the TWI peripheral before and after each transaction. * nrf/examples: Updating ssd1306_mod.py to split framebuffer transfer into multiple chunks * nrf/modules/machine/i2c: Return MP_EIO error if Data NACK occurs. * nrf: Addressing review comments. * nrf: Updating git submodule and users to nrfx v1.0.0. * nrf/modules/machine/adc: Update adc module to follow v1.0.0 nrfx API. * nrf/modules/machine/spi: Implement init and deinit functions Extending SPI objects with a config member such that configuration can be kept between new() and init(). Moving initialization done in new() to common init function shared between the module functions. If SPI is already configured, the SPI peripheral will be uninitialized before initalized again. Adding logic to handle initialization of polarity and phase. As well, updating default speed to 1M from 500K. * nrf/modules/machine: Removing unused nrfx includes in machine module header files
2018-07-18lib/utils: Expose pyb_set_repl_info function publicGlenn Ruben Bakke
The patch enables the possibility to disable or initialize the repl info from outside of the module. Can also be used to initialize the repl_display_debugging_info in pyexec.c if not startup file is clearing .bss segment.
2018-07-08lib/utils: Fix to support compiling with object representation D.Damien George
2018-07-05lib/utils/printf: Make DEBUG_printf implementation more accessible.stijn
The definition of DEBUG_printf doesn't depend on MICROPY_USE_INTERNAL_PRINTF so move it out of that preprocessor block and compile it conditionally just depending on the MICROPY_DEBUG_PRINTERS macro. This allows a port to use DEBUG_printf while providing it's own printf definition.
2018-05-28lib/stm32lib: Update library to include support for STM32F0 MCUs.Damien George
Now points to branch: work-F0-1.9.0+F4-1.16.0+F7-1.7.0+H7-1.2.0+L4-1.8.1
2018-05-17lib/lwip: Update lwIP to v2.0.3, tag STABLE-2_0_3_RELEASE.Damien George
2018-03-25lib/stm32lib: Update library for fix to H7 SPI strict aliasing error.Damien George
2018-03-09lib/stm32lib: Update library to include support for STM32H7 MCUs.Damien George
Now points to the branch: work-F4-1.16.0+F7-1.7.0+H7-1.2.0+L4-1.8.1
2018-02-13lib/utils/pyexec: Update to work with new MICROPY_HW_ENABLE_USB option.Damien George
2018-01-31lib/utils/pyexec.h: Include py/obj.h because its decls are needed.Damien George
2017-12-15lib/tinytest: Clean up test reporting in the presence of stdout output.Paul Sokolovsky
tinytest is written with the idea that tests won't write to stdout, so it prints test name witjout newline, then executes test, then writes status. But MicroPython tests write to stdout, so the test output becomes a mess. So, instead print it like: # starting basics/andor.py ... test output ... basics/andor.py: OK
2017-12-13lib/upytesthelper: MicroPython test helper layer on top of tinytest.Paul Sokolovsky
Tinytest is classical assert-style framework, but MicroPython tests work in different way - they produce content, and that content should be matched against expected one to see if test passes. upytesthelper exactly adds helper functions to make that possible.
2017-12-08lib/tinytest: Move from tools/tinytest.Paul Sokolovsky
Tinytest library was misplaced under tools/. By convention, any target libraries belong to lib/, while tools/ contains host-side tools.
2017-11-16py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str.Damien George
This patch simplifies the str creation API to favour the common case of creating a str object that is not forced to be interned. To force interning of a new str the new mp_obj_new_str_via_qstr function is added, and should only be used if warranted. Apart from simplifying the mp_obj_new_str function (and making it have the same signature as mp_obj_new_bytes), this patch also reduces code size by a bit (-16 bytes for bare-arm and roughly -40 bytes on the bare-metal archs).
2017-11-05axtls: Update, exposes AES functions to implement ECB chiper mode.Paul Sokolovsky
2017-10-29lib/axtls: Update, support for SSL_EAGAIN return code.Paul Sokolovsky
A step towards implementing non-blocking stream support for SSL.
2017-10-10lib/libm: Remove implementation of log2f, use MP_NEED_LOG2 instead.Damien George
2017-10-04lib/libm: Fix tanhf so that it correctly handles +/- infinity args.Damien George
2017-10-04all: Remove inclusion of internal py header files.Damien George
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-09-22lib/embed/abort_: Use mp_raise_msg helper function.Damien George
2017-09-10berkeley-db-1.xx: Update, allow to override MINCACHE, DEFPSIZE.Paul Sokolovsky
2017-08-29stmhal: Update to new STM Cube HAL library.Damien George
This upgrades the HAL to the versions: - F4 V1.16.0 - F7 V1.7.0 - L4 V1.8.1 The main changes were in the SD card driver. The vendor changed the SD read/write functions to accept block number intead of byte address, so there is no longer any need for a custom patch for this in stm32lib. The CardType values also changed, so pyb.SDCard().info() will return different values for the 3rd element of the tuple, but this function was never documented.
2017-08-29lib: Add new submodule, stm32lib containing STM32 CMSIS and HAL source.Damien George
Linked to https://github.com/micropython/stm32lib
2017-08-13all: Raise exceptions via mp_raise_XXXJavier Candeira
- Changed: ValueError, TypeError, NotImplementedError - OSError invocations unchanged, because the corresponding utility function takes ints, not strings like the long form invocation. - OverflowError, IndexError and RuntimeError etc. not changed for now until we decide whether to add new utility functions.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-07-18all: Unify header guard usage.Alexander Steffen
The code conventions suggest using header guards, but do not define how those should look like and instead point to existing files. However, not all existing files follow the same scheme, sometimes omitting header guards altogether, sometimes using non-standard names, making it easy to accidentally pick a "wrong" example. This commit ensures that all header files of the MicroPython project (that were not simply copied from somewhere else) follow the same pattern, that was already present in the majority of files, especially in the py folder. The rules are as follows. Naming convention: * start with the words MICROPY_INCLUDED * contain the full path to the file * replace special characters with _ In addition, there are no empty lines before #ifndef, between #ifndef and one empty line before #endif. #endif is followed by a comment containing the name of the guard macro. py/grammar.h cannot use header guards by design, since it has to be included multiple times in a single C file. Several other files also do not need header guards as they are only used internally and guaranteed to be included only once: * MICROPY_MPHALPORT_H * mpconfigboard.h * mpconfigport.h * mpthreadport.h * pin_defs_*.h * qstrdefs*.h
2017-07-04py/repl: Change mp_uint_t to size_t in repl helpers.Damien George
2017-06-28lib: Add libm_dbl, a double-precision math library, from musl-1.1.16.Damien George
2017-06-15stmhal: Move pybstdio.c to lib/utils/sys_stdio_mphal.c for common use.Damien George
It provides sys.stdin, sys.stdout, sys.stderr for bare-metal targets based on mp_hal functions.