Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
70f32f0f
Commit
70f32f0f
authored
9 years ago
by
Peter Hinch
Committed by
Damien George
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
docs: Update asm_thumb2_hints_tips re return type of asm funcs.
parent
3d0e3a3d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/reference/asm_thumb2_hints_tips.rst
+17
-5
17 additions, 5 deletions
docs/reference/asm_thumb2_hints_tips.rst
with
17 additions
and
5 deletions
docs/reference/asm_thumb2_hints_tips.rst
+
17
−
5
View file @
70f32f0f
...
@@ -78,11 +78,23 @@ three arguments, which must (if used) be named ``r0``, ``r1`` and ``r2``. When
...
@@ -78,11 +78,23 @@ three arguments, which must (if used) be named ``r0``, ``r1`` and ``r2``. When
the code executes the registers will be initialised to those values.
the code executes the registers will be initialised to those values.
The data types which can be passed in this way are integers and memory
The data types which can be passed in this way are integers and memory
addresses. With current firmware all possible 32 bit values may be passed.
addresses. With current firmware all possible 32 bit values may be passed and
Returned integers are restricted in that the top two bits must be identical,
returned. If the return value may have the most significant bit set a Python
limiting the range to -2**30 to 2**30 -1. The limitations on number of arguments
type hint should be employed to enable MicroPython to determine whether the
and return values can be overcome by means of the ``array`` module which enables
value should be interpreted as a signed or unsigned integer: types are
any number of values of any type to be accessed.
``int`` or ``uint``.
::
@micropython.asm_thumb
def uadd(r0, r1) -> uint:
add(r0, r0, r1)
``hex(uadd(0x40000000,0x40000000))`` will return 0x80000000, demonstrating the
passing and return of integers where bits 30 and 31 differ.
The limitations on the number of arguments and return values can be overcome by means
of the ``array`` module which enables any number of values of any type to be accessed.
Multiple arguments
Multiple arguments
~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment