This is an automated email from Gerrit.

James G. Smith ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/1661

-- gerrit

commit 4ad955a1cb70cf38a5e82d325472fa2acf2b96e5
Author: James G. Smith <[email protected]>
Date:   Thu Sep 26 13:01:20 2013 +0100

    stlink: Use callback to increase frequency of trace data sampling
    
    The ST-LINK/V2 has limited internal buffering, such that trace data
    can be missed if the target is generating data at a rate quicker than
    the OpenOCD trace sampling. The issue of lost data is compounded since
    individual TPIU packets may be split across individual STLINK_TRACE_EP
    reads, and misleading results can occur if mid-packet loss occurs.
    
    This patch increases the frequency of checking for pending trace data
    with the aim of minimising such losses. Note: With the limited (I/O
    and memory) bandwidth of the ST-LINK/V2 there cannot, however, be a
    guarantee against trace data loss.
    
    Change-Id: Ibde9794b77793d3068f88cb5c1a26f9ceadcbd8a
    Signed-off-by: James G. Smith <[email protected]>

diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index e94e6c8..070afa3 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -829,7 +829,7 @@ static int stlink_usb_write_debug_reg(void *handle, 
uint32_t addr, uint32_t val)
 }
 
 /** */
-static void stlink_usb_trace_read(void *handle)
+static int stlink_usb_trace_read(void *handle)
 {
        struct stlink_usb_handle_s *h;
 
@@ -864,6 +864,8 @@ static void stlink_usb_trace_read(void *handle)
                        }
                }
        }
+
+       return ERROR_OK;
 }
 
 static enum target_state stlink_usb_v2_get_status(void *handle)
@@ -880,7 +882,7 @@ static enum target_state stlink_usb_v2_get_status(void 
*handle)
        else if (status & S_RESET_ST)
                return TARGET_RESET;
 
-       stlink_usb_trace_read(handle);
+       (void)stlink_usb_trace_read(handle);
 
        return TARGET_RUNNING;
 }
@@ -1092,6 +1094,10 @@ static int stlink_usb_trace_enable(void *handle)
                if (res == ERROR_OK)  {
                        h->trace.enabled = true;
                        LOG_DEBUG("Tracing: recording at %uHz\n", trace_hz);
+                       /* We need the trace read function to be called at a
+                        * high-enough frequency to ensure reasonable
+                        * "timeliness" in processing ITM/DWT data. */
+                       target_register_timer_callback(stlink_usb_trace_read, 
1, 1, handle);
                }
        } else {
                LOG_ERROR("Tracing is not supported by this version.");

-- 

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to