请阅读【ARM Coresight SoC-400/SoC-600 专栏导读】
文章目录
- 参数传递命令 ENTRY
参数传递命令 ENTRY
ENTRY <parlist>
The ENTRY command can be used to
- Pass parameters to a PRACTICE script or to a subroutine
- To return a value from a subroutine
使用示例:
AREA.view
AREA.CLEAR
LOCAL &x
&x=0x25PRINT "Value of &"+"x before subroutine level 1 = " &xGOSUB level1 0x55PRINT "Value of &"+"x after subroutine level 1 = " &xENDDOlevel1:
(ENTRY &xIF &x==0x55(PRINT "par is:" &x)RETURN
)
运行结果如下:
从上面输出 log 可以看到,变量 x
作为形参传给子函数 level1
的时候,它的值被修改了,那么如如何才能保证它的值不被修改呢?
可以使用 命令 PARMETERS, 如下:
AREA.view
AREA.CLEAR
LOCAL &x
&x=0x25PRINT "Value of &"+"x before subroutine level 1 = " &xGOSUB level1 "0x55"PRINT "Value of &"+"x after subroutine level 1 = " &xENDDOlevel1:
(ENTRY &xIF &x==0x55(PRINT "par is:" &x)RETURN
)
注意:传入的参数需要时字符串格式
运行结果如下: