When I do this for the Beagle i just use

# set the current target, should not be nexessary with only one target 
configured
targets  omap3.cpu
# call tcl functions without the extra target name
mem2array dataval 32 [expr "0x54011000 + $reg_num * 4"] 1

Regards
Magnus

Strontium wrote:
> Hmm,
>
> So i looked into the code and it would appear to be a bug.
>
> ocd_mem2array is implemented via jim_mem2array which eventually calls 
> target_mem2array.  When this happens, I am pretty confident if 
> ocd_mem2array works, that argc will be 5.
>
> BUT
>
> if I use omap3.cpu mem2array, this is implemented through a call to 
> tcl_target_func, which ends up calling target_mem2array as well.  But in 
> this case argc will be 4.  So there is a mismatch between what 
> jim_mem2array and tcl_target_func expect with regard to target_mem2array
>
> I just proved this by changing my call to:
>
> omap3.cpu mem2array junk dataval 32 [expr "0x54011000 + $reg_num * 4"] 1
>
> "junk" is just crap to make the argc=5 check work, and to align the 
> variables to the right places in argv[]
>
> What would the most appropriate fix be?
>
> Strontium
>
> Strontium wrote:
>   
>> Howdy,
>>
>> I have a script that goes:
>>
>> proc omap3_ReadDebugRegister { reg_num } {
>>  # read the value of the debug register reg_num at address reg_num << 2
>>  omap3.cpu mem2array dataval 32 [expr "0x54011000 + $reg_num * 4"] 1
>> }
>>
>> It errors and crashes openocd with the following message:
>>
>> Runtime error, file "script//omap3.tcl", line 11:
>>    wrong # args: should be "dataval varname width addr nelems"
>>
>> I cant see anything wrong with it, but obviously I have stuffed up 
>> somehow.  Any suggestions on fixing it would be mightily appreciated.
>>
>> I will add processing to dataval after this, but until i can read 
>> dataval its a bit pointless.
>>
>> Strontium
>>
>>     
>
> _______________________________________________
> 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