paul@263 | 1 | Introduction
|
paul@263 | 2 | ------------
|
paul@28 | 3 |
|
paul@263 | 4 | Micropython is a language environment incorporating a compiler for a
|
paul@263 | 5 | simplified version of the Python programming language which targets a simple
|
paul@263 | 6 | instruction set supported by a virtual machine known as RSVP (a Really Simple
|
paul@263 | 7 | Virtual Processor).
|
paul@30 | 8 |
|
paul@263 | 9 | The RSVP instruction set is intended to map relatively closely to instructions
|
paul@263 | 10 | employed by real processors, with only a few "macroinstructions" which would
|
paul@263 | 11 | probably be implemented as short macros or library routines in programs
|
paul@263 | 12 | translated to the instruction set of a real target processor.
|
paul@30 | 13 |
|
paul@263 | 14 | Quick Start
|
paul@263 | 15 | -----------
|
paul@29 | 16 |
|
paul@263 | 17 | Currently, the test.py program is the principal means of compiling and running
|
paul@295 | 18 | code. For example, to inspect the logical.py test program (with all
|
paul@295 | 19 | optimisations enabled)...
|
paul@29 | 20 |
|
paul@295 | 21 | python -i test.py tests/logical.py -m -omax
|
paul@29 | 22 |
|
paul@263 | 23 | ...will provide a number of objects which can then be inspected, notably the
|
paul@263 | 24 | rm (RSVP machine) object which provides the following methods:
|
paul@29 | 25 |
|
paul@263 | 26 | * show - reveals the contents of the machine's memory
|
paul@263 | 27 | * run - starts execution of the code in the memory
|
paul@263 | 28 | * step - steps through the code one instruction at a time
|
paul@263 | 29 | * dump - shows the machine's registers
|
paul@28 | 30 |
|
paul@263 | 31 | To run a test and check the output, specify the -t option:
|
paul@28 | 32 |
|
paul@295 | 33 | python test.py tests/logical.py -t -omax
|
paul@29 | 34 |
|
paul@263 | 35 | To run all tests, use the test_all.py program:
|
paul@29 | 36 |
|
paul@295 | 37 | python test_all.py -omax
|
paul@29 | 38 |
|
paul@263 | 39 | Both programs support optimisations either using the -o flag immediately
|
paul@263 | 40 | followed (no space or separator) by a comma-separated list of options (defined
|
paul@263 | 41 | in the docs/optimisations.txt document) or by specifying -omax to apply all
|
paul@263 | 42 | possible optimisations.
|
paul@30 | 43 |
|
paul@295 | 44 | It is generally recommended to apply all possible optimisations when
|
paul@295 | 45 | generating programs as this dramatically reduces the size of the program and
|
paul@295 | 46 | accompanying structures, and it also makes the code generation process
|
paul@295 | 47 | substantially faster. Optimisations should not cause programs to fail: they
|
paul@295 | 48 | should all always be "safe" to apply.
|
paul@295 | 49 |
|
paul@263 | 50 | Contact, Copyright and Licence Information
|
paul@263 | 51 | ------------------------------------------
|
paul@30 | 52 |
|
paul@263 | 53 | The current Web page for micropython at the time of release is:
|
paul@261 | 54 |
|
paul@263 | 55 | http://www.boddie.org.uk/python/micropython.html
|
paul@261 | 56 |
|
paul@263 | 57 | Copyright and licence information can be found in the docs directory - see
|
paul@263 | 58 | docs/COPYING.txt and docs/gpl-3.0.txt for more information.
|