Hi,
OpenOCD uses script command to execute config file passed through "-f"
option. script command is defined as a function
proc script {filename} {
source [find $filename]
}
Thus when executing the config file, global variables defined in that
config file is not global any more. If I define a global variable
set foo 1
in target config file, then trying to read its value by
obj = Jim_GetGlobalVariableStr (interp, "foo", 0);
Jim_GetLong(interp, obj, &foo);
in OpenOCD will fail because "foo" is not defined in global namespace.
And the following code in a target config file will not work as
expected:
set foo 1
proc test { } {
puts $::foo
}
test
It's counterintuitive.
Is this effect is by design or by accident? I can see that using
"script" command can avoid name conflicts between config files. But it
prevents config files from sharing global variables. It also prevents
OpenOCD from accessing global variables defined in config files by
Jim_GetGlobalVariableStr.
Regards,
Jie
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development