Thanks for the tip! I found the scripts folder in the v3.7.2.4 package in the archives. In this I found scripts/tools/script_tlv.jcsh which showed an example of arguments used by DEFUN:
So with the script "myscript.jcsh":
# Testing function arguments
DEFUN my_test_function
/echo argv[0] is ${argv[0]}
/echo argv[1] is ${argv[1]}
/echo argv[2] is ${argv[2]}
END
# Run it with various arguments
my_test_function A B C
my_test_function A B
my_test_function A
And executing it using:
myscript 1 2 3
(I deliberately put "1 2 3" to make sure it is not getting argv from the arguments to the main script instead of the call to the function)
And I get the output:
argv[0] is A
argv[1] is B
argv[2] is C
argv[0] is A
argv[1] is B
argv[2] is
argv[0] is A
argv[1] is
argv[2] is
Thanks!
P.S. @Kan_Li a suggestion for NXP is to update and re-introduce these scripts into the JCShell releases as well as explicitly document DEFUN.