Skip to content

Commit 664f03f

Browse files
committed
tests: Add a test for argument passing to inline-asm functions.
1 parent 9a58316 commit 664f03f

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

tests/inlineasm/asmargs.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# test passing arguments
2+
3+
@micropython.asm_thumb
4+
def arg0():
5+
mov(r0, 1)
6+
print(arg0())
7+
8+
@micropython.asm_thumb
9+
def arg1(r0):
10+
add(r0, r0, 1)
11+
print(arg1(1))
12+
13+
@micropython.asm_thumb
14+
def arg2(r0, r1):
15+
add(r0, r0, r1)
16+
print(arg2(1, 2))
17+
18+
@micropython.asm_thumb
19+
def arg3(r0, r1, r2):
20+
add(r0, r0, r1)
21+
add(r0, r0, r2)
22+
print(arg3(1, 2, 3))
23+
24+
@micropython.asm_thumb
25+
def arg4(r0, r1, r2, r3):
26+
add(r0, r0, r1)
27+
add(r0, r0, r2)
28+
add(r0, r0, r3)
29+
print(arg4(1, 2, 3, 4))

tests/inlineasm/asmargs.py.exp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1
2+
2
3+
3
4+
6
5+
10

0 commit comments

Comments
 (0)