Let's me explain more on what I'm trying to do.

In Blackfin gdbproxy, I hardcoded memory maps in C source code. When
moving to OpenOCD, I'm trying to put them in the config files, which
is something in my TODO list for a long time. At that time I thought
about using an XML file for this purpose. But since OpenOCD has
builtin tcl, I'm trying to save some time by just using tcl. So I can
define

set sdram_start 0
set sdram_end 0x20000000

in the target config file and then target create function can read
these variables to create a memory map.

I'm still considering using XML, since tcl is good for memory maps but
not good for MMRs when MMRs have different size. Do you think it's a
good idea to linked in expat library?

Jie

On Fri, Jul 29, 2011 at 7:12 AM, Øyvind Harboe <oyvindhar...@gmail.com> wrote:
> Its historical. Perhaps it should be this way? Perhaps ot is better to pass
> args as args to procs rathr than global variables? Perhaps we should retire
> "script"?
>
> On Jul 29, 2011 12:45 PM, "Jie Zhang" <jzhang...@gmail.com> wrote:
>> 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
>> Openocd-development@lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/openocd-development
>
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to