asm_thumb2_index.rst 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. .. _asm_thumb2_index:
  2. Inline Assembler for Thumb2 architectures
  3. =========================================
  4. This document assumes some familiarity with assembly language programming and should be read after studying
  5. the :ref:`tutorial <pyboard_tutorial_assembler>`. For a detailed description of the instruction set consult the
  6. Architecture Reference Manual detailed below.
  7. The inline assembler supports a subset of the ARM Thumb-2 instruction set described here. The syntax tries
  8. to be as close as possible to that defined in the above ARM manual, converted to Python function calls.
  9. Instructions operate on 32 bit signed integer data except where stated otherwise. Most supported instructions
  10. operate on registers ``R0-R7`` only: where ``R8-R15`` are supported this is stated. Registers ``R8-R12`` must be
  11. restored to their initial value before return from a function. Registers ``R13-R15`` constitute the Link Register,
  12. Stack Pointer and Program Counter respectively.
  13. Document conventions
  14. --------------------
  15. Where possible the behaviour of each instruction is described in Python, for example
  16. * add(Rd, Rn, Rm) ``Rd = Rn + Rm``
  17. This enables the effect of instructions to be demonstrated in Python. In certain case this is impossible
  18. because Python doesn't support concepts such as indirection. The pseudocode employed in such cases is
  19. described on the relevant page.
  20. Instruction Categories
  21. ----------------------
  22. The following sections details the subset of the ARM Thumb-2 instruction set supported by MicroPython.
  23. .. toctree::
  24. :maxdepth: 1
  25. :numbered:
  26. asm_thumb2_mov.rst
  27. asm_thumb2_ldr.rst
  28. asm_thumb2_str.rst
  29. asm_thumb2_logical_bit.rst
  30. asm_thumb2_arith.rst
  31. asm_thumb2_compare.rst
  32. asm_thumb2_label_branch.rst
  33. asm_thumb2_stack.rst
  34. asm_thumb2_misc.rst
  35. asm_thumb2_float.rst
  36. asm_thumb2_directives.rst
  37. Usage examples
  38. --------------
  39. These sections provide further code examples and hints on the use of the assembler.
  40. .. toctree::
  41. :maxdepth: 1
  42. :numbered:
  43. asm_thumb2_hints_tips.rst
  44. References
  45. ----------
  46. - :ref:`Assembler Tutorial <pyboard_tutorial_assembler>`
  47. - `Wiki hints and tips
  48. <http://wiki.micropython.org/platforms/boards/pyboard/assembler>`__
  49. - `uPy Inline Assembler source-code,
  50. emitinlinethumb.c <https://github.com/micropython/micropython/blob/master/py/emitinlinethumb.c>`__
  51. - `ARM Thumb2 Instruction Set Quick Reference
  52. Card <http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf>`__
  53. - `RM0090 Reference
  54. Manual <http://www.google.ae/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&sqi=2&ved=0CBoQFjAA&url=http%3A%2F%2Fwww.st.com%2Fst-web-ui%2Fstatic%2Factive%2Fen%2Fresource%2Ftechnical%2Fdocument%2Freference_manual%2FDM00031020.pdf&ei=G0rSU66xFeuW0QWYwoD4CQ&usg=AFQjCNFuW6TgzE4QpahO_U7g3f3wdwecAg&sig2=iET-R0y9on_Pbflzf9aYDw&bvm=bv.71778758,bs.1,d.bGQ>`__
  55. - ARM v7-M Architecture Reference Manual (Available on the
  56. ARM site after a simple registration procedure. Also available on academic sites but beware of out of date versions.)