Single stepping does not work for arm1136 on the parport adapter.

Looking at ft2232 vs. bitbang, I see a big difference in how
these drivers exist the scan operation. (Hope I got this one right... :-)

The bitbang driver manually wiggles it's way to TAP_xRPAUSE,
then does a 7 clock transition to the end state.

The ft2232 driver does a 7 clock transition *directly* from
TAP_xRSHIFT. (I hope I figured this out correctly from the code,
I'm not terribly familiar with ft2232 code).

The ARM11 is finicky about the precise paths taken, so
this *could* explain why ft2232 happens to work(since
ARM11 support happened to be developed on that adapter).


#if 0 /* keeping old hex stuff for awhile, for reference */
        /* RESET                        IDLE                    DRSHIFT         
        DRPAUSE                 IRSHIFT                 IRPAUSE */
        {  0x7f,                        0x00,                   0x17,           
        0x0a,                   0x1b,                   0x16 }, /* RESET */
        {  0x7f,                        0x00,                   0x25,           
        0x05,                   0x2b,                   0x0b }, /* IDLE */
        {  0x7f,                        0x31,                   0x00,           
        0x01,                   0x0f,                   0x2f }, /* DRSHIFT  */
        {  0x7f,                        0x30,                   0x20,           
        0x17,                   0x1e,                   0x2f }, /* DRPAUSE  */
        {  0x7f,                        0x31,                   0x07,           
        0x17,                   0x00,                   0x01 }, /* IRSHIFT  */
        {  0x7f,                        0x30,                   0x1c,           
        0x17,                   0x20,                   0x2f }  /* IRPAUSE  */
#endif


The ft2232 will move


        if ( (  ir_scan && (tap_get_end_state() == TAP_IRSHIFT) )
          || ( !ir_scan && (tap_get_end_state() == TAP_DRSHIFT) ) )
        {
                if (type == SCAN_IO)
                {
                        /* Clock Data Bits In and Out LSB First */
                        BUFFER_ADD = 0x3b;
                        /* LOG_DEBUG("added TDI bits (io) %i", bits_left - 1); 
*/
                }
                else if (type == SCAN_OUT)
                {
                        /* Clock Data Bits Out on -ve Clock Edge LSB First (no 
Read) */
                        BUFFER_ADD = 0x1b;
                        /* LOG_DEBUG("added TDI bits (o)"); */
                }
                else if (type == SCAN_IN)
                {
                        /* Clock Data Bits In on +ve Clock Edge LSB First (no 
Write) */
                        BUFFER_ADD = 0x2a;
                        /* LOG_DEBUG("added TDI bits (i %i)", bits_left - 1); */
                }
                BUFFER_ADD = 0x0;
                BUFFER_ADD = last_bit;
        }
        else
        {
                /* move from Shift-IR/DR to end state */
                if (type != SCAN_OUT)
                {
                        /* Clock Data to TMS/CS Pin with Read */
                        BUFFER_ADD = 0x6b;
                        /* LOG_DEBUG("added TMS scan (read)"); */
                }
                else
                {
                        /* Clock Data to TMS/CS Pin (no Read) */
                        BUFFER_ADD = 0x4b;
                        /* LOG_DEBUG("added TMS scan (no read)"); */
                }
                BUFFER_ADD = 0x6;   /* scan 7 bits */

                BUFFER_ADD = tap_get_tms_path( tap_get_state(), 
tap_get_end_state()
) | (last_bit << 7);
                tap_set_state( tap_get_end_state() );
        }




static void bitbang_scan(int ir_scan, enum scan_type type, u8 *buffer,
int scan_size)
{
        tap_state_t saved_end_state = tap_get_end_state();
        int bit_cnt;

        if (!((!ir_scan && (tap_get_state() == TAP_DRSHIFT)) || (ir_scan &&
(tap_get_state() == TAP_IRSHIFT))))
        {
                if (ir_scan)
                        bitbang_end_state(TAP_IRSHIFT);
                else
                        bitbang_end_state(TAP_DRSHIFT);

                bitbang_state_move();
                bitbang_end_state(saved_end_state);
        }

        for (bit_cnt = 0; bit_cnt < scan_size; bit_cnt++)
        {
                int val=0;
                int tms=(bit_cnt==scan_size-1) ? 1 : 0;
                int tdi;
                int bytec=bit_cnt/8;
                int bcval=1<<(bit_cnt % 8);

                /* if we're just reading the scan, but don't care about the 
output
                 * default to outputting 'low', this also makes valgrind traces 
more readable,
                 * as it removes the dependency on an uninitialised value
                 */
                tdi=0;
                if ((type != SCAN_IN) && (buffer[bytec] & bcval))
                        tdi=1;

                bitbang_interface->write(0, tms, tdi);

                if (type!=SCAN_OUT)
                        val=bitbang_interface->read();

                bitbang_interface->write(1, tms, tdi);

                if (type != SCAN_OUT)
                {
                        if (val)
                                buffer[bytec] |= bcval;
                        else
                                buffer[bytec] &= ~bcval;
                }
        }

        /* TAP_DRSHIFT & TAP_IRSHIFT are illegal end states, so we always
transition to the pause
         * state which is a legal stable state from which statemove will work.
         *
         * Exit1 -> Pause
         */
        bitbang_interface->write(0, 0, 0);
        bitbang_interface->write(1, 0, 0);
        bitbang_interface->write(CLOCK_IDLE(), 0, 0);

        if (ir_scan)
                tap_set_state(TAP_IRPAUSE);
        else
                tap_set_state(TAP_DRPAUSE);

        if (tap_get_state() != tap_get_end_state())
                bitbang_state_move();
}


-- 
Øyvind Harboe
Embedded software and hardware consulting services
http://consulting.zylin.com
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to