I am trying to implement a "generic" TRACE32 menu that takes a parameter and can be reused across different projects.
Would something like that be possible? How do I pass an argument to a .mem
file loaded by MENU.ReProgram
?
;my_menu.mem
ADD
MENU
(
POPUP "&User"
(
DEFAULT
MENUITEM "Disable watchdog"
(
DO ~~~~/boards/&board/disable_wdg.cmm
; ^^^^^^
)
)
)
Put the menu into a PRACTICE script as an embedded menu block. Start the block with &+
to enable macro replacement in the embedded block.
You can pass the parameters for the menu to the embedding script using the PARAMETERS
keyword.
Note: You can not use ~~~~/
in a menu command. ~~~~/
means path of currently executed PRACTICE script. At the time the menu command is executed, most likely the script is no longer running, and the value of ~~~~/
is not valid anymore.
Example:
;my_menu.cmm
LOCAL &rootpath &user &board
PARAMETERS &rootpath &user &board
MENU.ReProgram
(&+
ADD
MENU
(
POPUP "&user"
(
DEFAULT
MENUITEM "Disable watchdog"
(
DO "&rootpath/boards/&board/disable_wdg.cmm"
)
)
)
)
ENDDO
Call with e.g.:
DO d:\my_menu.cmm "/home/user/t32" "MyName" "MyBoardName"