aboutsummaryrefslogtreecommitdiff
path: root/lib/utils
AgeCommit message (Collapse)Author
2019-05-01lib/utils/interrupt_char: Invalidate interrupt char at start up.Damien George
Otherwise mp_interrupt_char will have a value of zero on start up (because it's in the BSS) and a KeyboardInterrupt may be raised during start up. For example this can occur if there is a UART attached to the REPL which sends spurious null bytes when the device turns on.
2019-05-01lib/utils: Make pyexec_file_if_exists run frozen scripts if they exist.Andrew Leech
So that boot.py and/or main.py can be frozen (either as STR or MPY) in the same way that other scripts are frozen. Frozen scripts have preference to scripts in the VFS.
2019-04-26lib/utils/pyexec: Add pyexec_file_if_exists() helper function.Damien George
It will only execute the script if it can be stat'd and is a file.
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-28lib/utils/pyexec: Implement paste mode with event driven REPL.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-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-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-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-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-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-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.
2017-06-02lib/utils/interrupt_char: Remove support for KBD_EXCEPTION disabled.Damien George
If a port is using interrupt_char.c then it must enable MICROPY_KBD_EXCEPTION. This is the case for all official ports.
2017-05-29various: Spelling fixesVille Skyttä
2017-05-05lib/utils/pyexec: Update event-driven REPL to match non-event REPL.Tom Collins
Don't print dupe ">>> " prompt when starting event-driven REPL. Clear incomplete line in transition from raw to friendly REPL.
2017-03-20py: Add micropython.schedule() function and associated runtime code.Damien George
2017-03-14lib/utils/pyexec: Fix bug with pyexec_file not setting flag for source.Damien George
2017-03-14lib/utils/pyexec: Refactor to put lexer constructors all in one place.Damien George
The lexer can now raise an exception on construction so it must go within an nlr handler block.
2017-02-27lib/utils/pyexec: Allow to compile when the uPy compiler is disabled.Damien George
2017-01-22lib/utils/pyexec: Only print help prompt if HELP feature is enabled.Damien George
2017-01-22lib/utils: Remove old pyhelp helper, replaced with py/builtinhelp.c.Damien George
Ports should no longer use pyhelp_print_obj but instead should define MICROPY_PY_BUILTINS_HELP to 1 and then specify their help text using MICROPY_PY_BUILTINS_HELP_TEXT.
2016-12-15lib/utils/interrupt_char: Use core-provided mp_kbd_exception if enabled.Damien George
Ultimately all ports that use lib/utils/interrupt_char would enable MICROPY_KBD_EXCEPTION, so this is an interim solution.
2016-10-26zephyr: Fix mp_hal_set_interrupt_char() declaration to be compatible.Paul Sokolovsky
With other ports. Other ports declare it in mphalport.h, it can be inline or macro.
2016-10-26lib/utils/pyexec: Fix compilation warning of type vs format mismatch.Paul Sokolovsky
This happens with some compilers on some architectures, which don't define size_t as unsigned int. MicroPython's printf() dooesn't support obscure format specifiers for size_t, so the obvious choice is to explicitly cast to unsigned, to match %u used in printf().
2016-10-26lib/utils/pyexec: Add mp_hal_set_interrupt_char() prototype.Vincenzo Frascino
This patch removes a compilation warning in pyexec. Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-10-21lib/utils/pyhelp.c: Use mp_printf() instead of printf()Erik Moqvist
This patch introduces MP_PYTHON_PRINTER for general use.
2016-10-21py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.Damien George
In order to have more fine-grained control over how builtin functions are constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific, with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW. These names now match the MP_DEFINE_CONST_FUN_OBJ macros.
2016-10-17lib/utils/pyexec: Allow behaviour of SystemExit to be configurable.Damien George
Setting the pyexec_system_exit variable to PYEXEC_FORCED_EXT allows SystemExit exceptions to terminate the pyexec functions.
2016-10-14py/vstr: Combine vstr_new_size with vstr_new since they are rarely used.Damien George
Now there is just one function to allocate a new vstr, namely vstr_new (in addition to vstr_init etc). The caller of this function should know what initial size to allocate for the buffer, or at least have some policy or config option, instead of leaving it to a default (as it was before).
2016-10-12lib/utils/pyexec: Don't treat SystemExit as "forced exit".Paul Sokolovsky
"Forced exit" is treated as soft-reboot (Ctrl+D). But expected effect of calling sys.exit() is termination of the current script, not any further and more serious actions like mentioned soft reboot.
2016-09-29lib/interrupt_char: Factor out typical Ctrl+C handling from esp8266 port.Paul Sokolovsky
Utility functions for keyboard interrupt handling, to be reused across (baremetal) ports.
2016-09-05py: Add MICROPY_USE_INTERNAL_PRINTF option, defaults to enabled.Delio Brignoli
This new config option allows to control whether MicroPython uses its own internal printf or not (if not, an external one should be linked in). Accompanying this new option is the inclusion of lib/utils/printf.c in the core list of source files, so that ports no longer need to include it themselves.
2016-08-30lib/utils/pyexec: qstr_pool_info() requires size_t* parameters.Paul Sokolovsky
2016-08-25lib/utils/stdout_helpers: Fix function signature to match py/mphal.h.Paul Sokolovsky
2016-07-22lib/utils/stdout_helpers: Move from minimal/uart_extra.c for reuse.Paul Sokolovsky
2016-07-21lib/utils/pyexec: Use full path to readline.h header, per latest conventions.Paul Sokolovsky
2016-04-25lib/utils/pyhelp: Extract implementation of help(obj) to a library function.Colin Hogben
Several ports use identical code for the 1-argument form of the builtin help function. Move this code to a library function to allow easier re-use by ports.
2016-04-19lib/utils/pyexec: Condition-out GC calls from pyexec.Colin Hogben
A port which uses lib/utils/pyexec.c but which does not enable garbage collection should not need to implement the gc_collect function. This patch also moves the gc_collect call to after printing the qstr info. Since qstrs cannot be collected it should not make any difference to the printed statistics.
2016-04-13py: Add ability to have frozen persistent bytecode from .mpy files.Damien George
The config variable MICROPY_MODULE_FROZEN is now made of two separate parts: MICROPY_MODULE_FROZEN_STR and MICROPY_MODULE_FROZEN_MPY. This allows to have none, either or both of frozen strings and frozen mpy files (aka frozen bytecode).
2016-04-13lib/utils/printf: Rework overriding printer of DEBUG_printf().Paul Sokolovsky
By default it uses mp_plat_print, but a port may override it to another value with MICROPY_DEBUG_PRINTER_DEST.