summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/pyexec.c
Commit message (Collapse)AuthorAge
* stmhal: Change type of received chr from char to int.Damien George2015-02-08
|
* py: Protect mp_parse and mp_compile with nlr push/pop block.Damien George2015-02-07
| | | | | | | | | | To enable parsing constants more efficiently, mp_parse should be allowed to raise an exception, and mp_compile can already raise a MemoryError. So these functions need to be protected by an nlr push/pop block. This patch adds that feature in all places. This allows to simplify how mp_parse and mp_compile are called: they now raise an exception if they have an error and so explicit checking is not needed anymore.
* py: Change vstr_null_terminate -> vstr_null_terminated_str, returns str.Damien George2015-01-29
|
* py: Change vstr so that it doesn't null terminate buffer by default.Damien George2015-01-28
| | | | | | | | | This cleans up vstr so that it's a pure "variable buffer", and the user can decide whether they need to add a terminating null byte. In most places where vstr is used, the vstr did not need to be null terminated and so this patch saves code size, a tiny bit of RAM, and makes vstr usage more efficient. When null termination is needed it must be done explicitly using vstr_null_terminate.
* stmhal: Remove unnecessary #include "systick.h" from pyexec.c.Damien George2015-01-28
| | | | Makes pyexec.c more re-usable for other ports.
* py, unix, stmhal: Allow to compile with -Wshadow.Damien George2015-01-20
| | | | See issue #699.
* pyexec: Add event-driven variant pyexec_friendly_repl().Paul Sokolovsky2015-01-16
| | | | | | | | | | pyexec_friendly_repl_process_char() and friends, useful for ports which integrate into existing cooperative multitasking system. Unlike readline() refactor before, this was implemented in less formal, trial&error process, minor functionality regressions are still known (like soft&hard reset support). So, original loop-based pyexec_friendly_repl() is left intact, specific implementation selectable by config setting.
* stmhal: Prefix includes with py/; remove need for -I../py.Damien George2015-01-01
|
* py: Add include guards to mpconfig,misc,qstr,obj,runtime,parsehelper.Damien George2014-12-29
|
* stmhal: gccollect.h is superfluous in many places.Paul Sokolovsky2014-12-21
|
* stmhal: Use gc_dump_info() function instead of adhoc code.Paul Sokolovsky2014-12-21
|
* stmhal: Include MICROPY_HAL_H only if defined.Paul Sokolovsky2014-12-20
| | | | Helps other ports.
* modsys: Add sys.print_exception(exc, file=sys.stdout) function.Paul Sokolovsky2014-12-08
| | | | | | | | | | | | The function is modeled after traceback.print_exception(), but unbloated, and put into existing module to save overhead on adding another module. Compliant traceback.print_exception() is intended to be implemented in micropython-lib in terms of sys.print_exception(). This change required refactoring mp_obj_print_exception() to take pfenv_t interface arguments. Addresses #751.
* py: Optimise lexer by exposing lexer type.Damien George2014-12-05
| | | | | | | | | mp_lexer_t type is exposed, mp_token_t type is removed, and simple lexer functions (like checking current token kind) are now inlined. This saves 784 bytes ROM on 32-bit unix, 348 bytes on stmhal, and 460 bytes on bare-arm. It also saves a tiny bit of RAM since mp_lexer_t is a bit smaller. Also will run a bit more efficiently.
* stmhal: Reduce coupling between USB driver and readline.Damien George2014-11-27
| | | | | This makes it easier to re-use readline.c and pyexec.c from stmhal in other ports.
* stmhal: Improve REPL control codes; improve pyboard.py script.Damien George2014-10-26
| | | | | | | | | | | | | | | | | | | | Improvements are: 2 ctrl-C's are now needed to truly kill running script on pyboard, so make CDC interface allow multiple ctrl-C's through at once (ie sending b'\x03\x03' to pyboard now counts as 2 ctrl-C's). ctrl-C in friendly-repl can now stop multi-line input. In raw-repl mode, use ctrl-D to indicate end of running script, and also end of any error message. Thus, output of raw-repl is always at least 2 ctrl-D's and it's much easier to parse. pyboard.py is now a bit faster, handles exceptions from pyboard better (prints them and exits with exit code 1), prints out the pyboard output while the script is running (instead of waiting till the end), and allows to follow the output of a previous script when run with no arguments.
* stmhal: Don't return SystemExit value from parse_compile_execute.Damien George2014-10-22
| | | | There is no need, since we don't (currently) use the value.
* Add pyb.hard_reset, and make sys.exit() or raise SystemExit do a soft reset.Dave Hylands2014-10-22
|
* stmhal: Use mp_uint_t where appropriate.Damien George2014-10-05
| | | | | | Found these by compiling stmhal with mp_uint_t of type uint32_t instead of unsigned int. This actually makes a difference to the code, but just a curiosity.
* py: Make compiler return a proper exception on SyntaxError.Damien George2014-10-05
|
* py: Free non-interned strings in the parser when not needed.Damien George2014-09-23
| | | | | | | | | | | mp_parse_node_free now frees the memory associated with non-interned strings. And the parser calls mp_parse_node_free when discarding a non-used node (such as a doc string). Also, the compiler now frees the parse tree explicitly just before it exits (as opposed to relying on the caller to do this). Addresses issue #708 as best we can.
* stmhal: Fix REPL printing by cooking output sent to stdout_obj.Damien George2014-07-20
| | | | | | Recent changes to builtin print meant that print was printing to the mp_sys_stdout_obj, which was sending data raw to the USB CDC device. The data should be cooked so that \n turns into \r\n.
* Merge branch 'teensy-new' of github.com:dhylands/micropython into ↵Damien George2014-07-02
|\ | | | | | | | | | | | | | | | | | | | | | | dhylands-teensy-new Conflicts: stmhal/pin_named_pins.c stmhal/readline.c Renamed HAL_H to MICROPY_HAL_H. Made stmhal/mphal.h which intends to define the generic Micro Python HAL, which in stmhal sits above the ST HAL.
| * Updated teensy to build.Dave Hylands2014-06-15
| | | | | | | | Refactored some stmhal files which are shared with teensy.
* | Change MCU name config micromux2014-06-27
| |
* | Add MICROPY_HW_MICRO_NAME to boards configmux2014-06-19
|/
* stmhal: Improve handling of out-of-memory in REPL.Damien George2014-05-10
| | | | | | Addresses issue #558, but it's likely that other out-of-memory errors could crash the pyboard. Reason is that qstrs use m_new and can raise an exception within the parser.
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
* Don't print git hash as well as git tag in banner.v1.0Damien George2014-05-03
|
* py: Print tag/version/git describe in uPy banner.Damien George2014-05-03
|
* stmhal: Remove #include <stdint.h> from mpconfigport.h.Damien George2014-05-03
| | | | | Make include dependencies neater, and adheres to the coding convention that headers should not include headers.
* unix,stmhal: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
|
* build: Simplify build directory layout by putting all headers in genhdr.Damien George2014-04-17
| | | | | Any generated headers go in $(BUILD)/genhdr/, and are #included as 'genhdr/xxx.h'.
* stmhal: Improve flash storage cache management.Damien George2014-04-16
| | | | | | | | | | | | | | | | Internal flash used for the filesystem is now written (from the cache) only after a 5s delay, or when a file is closed, or when the drive is unmounted from the host. This delay means that multiple writes can accumulate in the cache, and leads to less writes to the flash, making it last longer. It's implemented by a high-priority interrupt that takes care of flash erase and write, and flushing the cache. This is still only an interim solution for the flash filesystem. It eventually needs to be replaced with something that uses less RAM for the cache, something that can use more of the flash, and something that does proper wear levelling.
* Improve REPL detecting when input needs to continue.Damien George2014-04-08
| | | | | | | | Full CPython compatibility with this requires actually parsing the input so far collected, and if it fails parsing due to lack of tokens, then continue collecting input. It's not worth doing it this way. Not having compatibility at this level does not hurt the goals of Micro Python.
* py: Add option to compiler to specify default code emitter.Damien George2014-04-06
| | | | Also add command line option to unix port to select emitter.
* Add the git version to the bannerDave Hylands2014-04-03
|
* stmhal: Fix raw REPL so that it passes through more ASCII chars.Damien George2014-04-03
|
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
* stmhal: Factor out stdio and readline to separate files.Damien George2014-03-29
| | | | | Adds readline_init() to clear readline history on soft reset. Addresses issue #387.
* stmhal: Improve REPL CTRL commands.Damien George2014-03-24
|
* stmhal: Add fatfs support, working with flash and SD card.Damien George2014-03-17
|
* Add vstr_ins and vstr_cut_out; improve stmhal readline.Damien George2014-03-15
|
* stmhal: Fix escape sequences in USB CDC input.Damien George2014-03-15
|
* stmhal: Get USB CDC REPL working.Damien George2014-03-15
| | | | | | | | New USB HAL is quite a bit improved over previous one. Now has better callbacks and flow control. REPL over USB CDC now works as before, except for soft-reset (since USB driver uses malloc...).
* stmhal - More systick cleanup. Fix HAL_DelayDave Hylands2014-03-13
|
* REPl working on UART6 with STMHALDave Hylands2014-03-12