|
From: Olivier S. <oli...@gm...> - 2015-01-20 13:26:10
|
Hi I'm working on getting support for the SAMA5Dxx processor range from Atmel pushed to the master branch of openocd. After a few iterations we have got it up and running, with a few dependencies. (The patches from Christopher Head regarding apb-ap reads and writes). There is one issue still when running 'mon reset halt'/'mon reset init' for which I do not have an *acceptable* patch. The outputs from gdb and openocd can be found below. To fix this issue I have currently implemented a hack. On the first read of the dscr in the cortex_a_poll after executing the cortex_a8_init_debug_access function (Which writes 0xC5ACCE55 to the debug lock access register to unlock debugging - the lock access fails on the first, but succeeds on the second try), it returns an error (CTRL/STAT error, 0x20), but if I insert a retry mechanism, to try and read the dscr again, everything functions as per normal, and 'mon reset halt' and 'mon reset init' works, and stepping also works. (Hardware breakpoints only, because there is still something fishy with software breakpoints). I have tried adjusting adapter_khz to try and solve the issue as well to no avail. Adapter kHz is currently 100, with processor running from internal RC oscillator at 12MHz. Any comments, or suggestions welcome so that we can get to an acceptable solution. Regards Olivier Schonken The GDB view: (gdb) mon reset halt JTAG tap: at91sama5d3x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4) Locking debug access failed on first, but succeeded on second try. in procedure 'reset' in procedure 'ocd_bouncer' in procedure 'reset' The openocd debug view with -d 3: Debug: 457 17132 gdb_server.c:2670 gdb_input_inner(): received packet: 'qRcmd,72657365742068616c74' Debug: 458 17132 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_reset halt Debug: 459 17132 command.c:145 script_debug(): command - reset ocd_reset halt Debug: 461 17133 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_target names Debug: 462 17133 command.c:145 script_debug(): command - ocd_target ocd_target names Debug: 463 17133 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu invoke-event reset-start Debug: 464 17133 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu invoke-event reset-start Debug: 465 17133 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_transport select Debug: 466 17133 command.c:145 script_debug(): command - ocd_transport ocd_transport select Debug: 467 17133 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag arp_init-reset Debug: 468 17133 command.c:145 script_debug(): command - ocd_jtag ocd_jtag arp_init-reset Debug: 469 17133 core.c:1529 jtag_init_reset(): Initializing with hard TRST+SRST reset Debug: 470 17133 jlink.c:709 jlink_reset(): trst: 1, srst: 1 Debug: 471 17134 core.c:720 jtag_add_reset(): SRST line asserted Debug: 472 17134 core.c:743 jtag_add_reset(): TRST line asserted Debug: 473 17134 jlink.c:709 jlink_reset(): trst: 0, srst: 1 Debug: 474 17134 core.c:748 jtag_add_reset(): TRST line released Debug: 475 17134 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset Debug: 477 17640 jlink.c:709 jlink_reset(): trst: 0, srst: 0 Debug: 478 17641 core.c:724 jtag_add_reset(): SRST line released Debug: 481 18651 core.c:1421 jtag_init_inner(): Init JTAG chain Debug: 482 18651 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset Debug: 483 18651 core.c:1053 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS Debug: 484 18651 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset Info : 485 18652 core.c:956 jtag_examine_chain_display(): JTAG tap: at91sama5d3x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4) Debug: 486 18652 core.c:1213 jtag_validate_ircapture(): IR capture validation scan Debug: 487 18653 core.c:1270 jtag_validate_ircapture(): at91sama5d3x.cpu: IR capture 0x01 Debug: 488 18653 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_transport select Debug: 489 18653 command.c:145 script_debug(): command - ocd_transport ocd_transport select Debug: 490 18653 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu cget -chain-position Debug: 491 18653 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu cget -chain-position Debug: 492 18653 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag tapisenabled at91sama5d3x.cpu Debug: 493 18653 command.c:145 script_debug(): command - ocd_jtag ocd_jtag tapisenabled at91sama5d3x.cpu Debug: 494 18653 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu invoke-event examine-start Debug: 495 18653 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu invoke-event examine-start Debug: 496 18653 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu arp_examine Debug: 497 18653 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu arp_examine Debug: 498 18653 cortex_a.c:206 cortex_a_init_debug_access(): Debug: 499 18653 cortex_a.c:176 cortex_a8_init_debug_access(): Debug: 500 18654 adi_v5_jtag.c:271 jtagdp_transaction_endcheck(): jtag-dp: CTRL/STAT error, 0x20 Debug: 501 18654 arm_adi_v5.c:647 ahbap_debugport_init(): Debug: 502 18654 arm_adi_v5.c:688 ahbap_debugport_init(): DAP: wait CDBGPWRUPACK Debug: 503 18654 arm_adi_v5.h:391 dap_dp_poll_register(): DAP: poll 4, mask 0x0820000000, value 0x20000000 Debug: 504 18655 arm_adi_v5.c:695 ahbap_debugport_init(): DAP: wait CSYSPWRUPACK Debug: 505 18655 arm_adi_v5.h:391 dap_dp_poll_register(): DAP: poll 4, mask 0x0880000000, value 0x80000000 Debug: 506 18656 arm_adi_v5.c:744 ahbap_debugport_init(): MEM_AP Packed Transfers: disabled Debug: 507 18656 arm_adi_v5.c:755 ahbap_debugport_init(): MEM_AP CFG: large data 0, long address 0, big-endian 0 User : 508 18657 cortex_a.c:188 cortex_a8_init_debug_access(): Locking debug access failed on first, but succeeded on second try. Debug: 509 18658 cortex_a.c:241 cortex_a_init_debug_access(): target->coreid 0 DBGPRSR 0x9 Debug: 510 18658 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu invoke-evDebug: 511 18658 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu invoke-event examine-end Debug: 512 18659 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu invoke-event reset-assert-pre Debug: 513 18659 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu invoke-event reset-assert-pre Debug: 514 18659 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_transport select Debug: 515 18659 command.c:145 script_debug(): command - ocd_transport ocd_transport select Debug: 516 18659 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu cget -chain-position Debug: 517 18659 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu cget -chain-position Debug: 518 18659 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag tapisenabled at91sama5d3x.cpu Debug: 519 18659 command.c:145 script_debug(): command - ocd_jtag ocd_jtag tapisenabled at91sama5d3x.cpu Debug: 520 18659 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu arp_reset assert 1 Debug: 521 18659 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu arp_reset assert 1 Debug: 522 18659 target.c:1726 target_free_all_working_areas_restore(): freeing all working areas Debug: 523 18659 cortex_a.c:1796 cortex_a_assert_reset(): Debug: 524 18659 jlink.c:709 jlink_reset(): trst: 0, srst: 1 Debug: 525 18659 core.c:720 jtag_add_reset(): SRST line asserted Debug: 526 18659 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu invoke-event reset-assert-post Debug: 527 18659 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu invoke-event reset-assert-post Debug: 528 18659 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu invoke-event reset-deassert-pre Debug: 529 18660 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu invoke-event reset-deassert-pre Debug: 530 18660 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_transport select Debug: 531 18660 command.c:145 script_debug(): command - ocd_transport ocd_transport select Debug: 532 18660 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu cget -chain-position Debug: 533 18660 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu cget -chain-position Debug: 534 18660 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_jtag tapisenabled at91sama5d3x.cpu Debug: 535 18660 command.c:145 script_debug(): command - ocd_jtag ocd_jtag tapisenabled at91sama5d3x.cpu Debug: 536 18660 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_at91sama5d3x.cpu arp_reset deassert 1 Debug: 537 18660 command.c:145 script_debug(): command - ocd_at91sama5d3x.cpu ocd_at91sama5d3x.cpu arp_reset deassert 1 Debug: 538 18660 target.c:1726 target_free_all_working_areas_restore(): freeing all working areas Debug: 539 18660 cortex_a.c:1825 cortex_a_deassert_reset(): Debug: 540 18660 jlink.c:709 jlink_reset(): trst: 0, srst: 0 Debug: 541 18660 core.c:724 jtag_add_reset(): SRST line released Debug: 544 19671 adi_v5_jtag.c:271 jtagdp_transaction_endcheck(): jtag-dp: CTRL/STAT error, 0x20 Debug: 545 19671 arm_adi_v5.c:647 ahbap_debugport_init(): Debug: 546 19671 arm_adi_v5.c:688 ahbap_debugport_init(): DAP: wait CDBGPWRUPACK Debug: 547 19671 arm_adi_v5.h:391 dap_dp_poll_register(): DAP: poll 4, mask 0x0820000000, value 0x20000000 Debug: 548 19672 arm_adi_v5.c:695 ahbap_debugport_init(): DAP: wait CSYSPWRUPACK Debug: 549 19672 arm_adi_v5.h:391 dap_dp_poll_register(): DAP: poll 4, mask 0x0880000000, value 0x80000000 Debug: 550 19673 arm_adi_v5.c:744 ahbap_debugport_init(): MEM_AP Packed Transfers: disabled Debug: 551 19673 arm_adi_v5.c:755 ahbap_debugport_init(): MEM_AP CFG: large data 0, long address 0, big-endian 0 User : 552 19673 command.c:546 command_print(): in procedure 'reset' in procedure 'ocd_bouncer' Debug: 553 19674 command.c:628 run_command(): Command failed with error code -4 User : 554 19674 command.c:666 command_run_line(): in procedure 'reset' |