Hi Strontium,

Strontium wrote:
> Ok,
> 
> I am trying to make the files described below.  And have gotten  along 
> fine, but have found the following problem.
> 
> The first time my script executes after a reset of the beagle:
> 
> dap apsel 1
> 
> openocd halts with an error, thus: (at -d 3)
> 
> Fails:
> 
> Debug: 166 1139 arm_adi_v5.c:242 swjdp_transaction_endcheck(): swjdp: 
> CTRL/STAT error 0x20
> Debug: 167 1139 arm_adi_v5.c:951 ahbap_debugport_init(): Debug: 168 1146 
> arm_adi_v5.c:996 ahbap_debugport_init(): AHB-AP ID Register 0x4770002, 
> Debug ROM Address 0x80000000
> User : 169 1146 command.c:383 command_print(): ap 1 selected, 
> identification register 0x00000000
> Debug: 170 1146 command.c:427 run_command(): Command failed with error 
> code -107
> 
> The second time I execute:
> 
> dap apsel 1
> 
> it works, thus (also at - d 3):
> 
> Works:
> 
> Debug: 163 1134 command.c:91 script_command(): script_command - apsel
> Debug: 164 1134 command.c:108 script_command(): script_command - apsel, 
> argv[0]=ocd_dap_apsel
> Debug: 165 1134 command.c:108 script_command(): script_command - apsel, 
> argv[1]=1
> User : 166 1139 command.c:383 command_print(): ap 1 selected, 
> identification register 0x04770002
> 
> I have tracked the fault to the processing that follows (lines 239 to 
> 247 of arm_adi_v5.c:
> 
>    /* Check for STICKYERR and STICKYORUN */
>    if (ctrlstat & (SSTICKYORUN | SSTICKYERR))
>    {
>        LOG_DEBUG("swjdp: CTRL/STAT error 0x%x", ctrlstat);
>        /* Check power to debug regions */
>        if ((ctrlstat & 0xf0000000) != 0xf0000000)
>        {
>             ahbap_debugport_init(swjdp);
> 
> That is the path it executes.  If I change this code by simply returning 
> the status of the ahbap_debugport_init(... command, openocd doesnt 
> halt.  but it prints the following (which is clearly still wrong):
> 
> Debug: 166 1134 arm_adi_v5.c:242 swjdp_transaction_endcheck(): swjdp: 
> CTRL/STAT error 0x20
> Debug: 167 1134 arm_adi_v5.c:951 ahbap_debugport_init(): Debug: 168 1143 
> arm_adi_v5.c:996 ahbap_debugport_init(): AHB-AP ID Register 0x4770002, 
> Debug ROM Address 0x80000000
> User : 169 1143 command.c:383 command_print(): ap 1 selected, 
> identification register 0x00000000
> 
> I then immediately execute dap apsel 1 again, which returns with the 
> expected result
> 
> Debug: 177 2143 command.c:91 script_command(): script_command - apsel
> Debug: 178 2143 command.c:108 script_command(): script_command - apsel, 
> argv[0]=ocd_dap_apsel
> Debug: 179 2143 command.c:108 script_command(): script_command - apsel, 
> argv[1]=1
> User : 180 2150 command.c:383 command_print(): ap 1 selected, 
> identification register 0x04770002
> 
> So it would appear that the ahbap_debugport_init function is working 
> correctly, its just that its results do not get out, so that dap apsel 1 
> reports a correct result, the first time it is called.
> 
> any ideas?

No ideas :(

But while doing all this stuff manually, I observed that the first 
'dap apsel 1' often (always?) fails, too. I then simply did it a 
second time and didn't care about it :( Hopefully with your good 
description one of the experts will have an idea ;)

> Attached are my config script and tcl script for reference

Great, thanks! I will test them if I have some minutes.

Best regards

Dirk

> Magnus Lundin wrote:
>> Dirk Behme wrote:
>>  
>>> Btw.: Is there an option or a possibility to run a script when I 
>>> connect e.g. by telnet?
>>>
>>> I'm a little tired to always type the commands
>>>
>>> jtag tapenable omap3.cpu
>>> target create omap3.cpu cortex_a8 -endian little -chain-position 
>>> omap3.cpu
>>> dap apsel 1
>>> omap3.cpu mww 0x54011FB0 0xC5ACCE55 4
>>> omap3.cpu mdw 0x54011314
>>> omap3.cpu mdw 0x54011314
>>>
>>> manually.
>>>
>>>     
>> Yes, we will put this in the target support but for now I suggest to 
>> use a Tcl script.
>> [ This is  true, but not tested ]
>> - create a file   omap.tcl
>> - put  "source [ <path.../>omap.tcl" in your cfg file
>>
>> Now define some handy procedures in the omap.tcl file:
>>
>> proc dbginit { } {
>>      dap apsel 1
>>      omap3.cpu mww 0x54011FB0 0xC5ACCE55 4
>>      omap3.cpu mdw 0x54011314
>>      omap3.cpu mdw 0x54011314
>> }
>>
>> Now just giving the command  dbginit should do the trick.
>> If you edit the script you can rerun the source command without 
>> restarting openocd
>>
>> Then we can collect Tcl procedures for different debug activities 
>> before we code into the C, we can actually test a large part of the A8 
>> and OMAP support just with tcl scripts.
>>  
>> Regards,
>> Magnus
>>
>> _______________________________________________
>> 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

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to