How can I make sure the trace buffer always contains a SYNC point?
In general you cant. However if your target has a periodic timer interrupt which fires often enough this will generate a sync point in the trace buffer. The BDM trace buffer is 1MB long with one byte being captured every CPU clock. So even at 66MHz the trace buffer captures a time interval of 15ms. In this case if your target program generates a timer interrupt every 5 ms (say) you will always have at least 2/3 of the trace buffer following a sync point. If real time execution is not important to you one option is to set the trace buffer to break each time it gets full. Since flex knows where execution started from it can generate a pseudo sync point at the start of the trace buffer. This means that the complete trace buffer is always analysable. You can then keep executing your target in real time ‘chunks’ until the event you are interested in has occured. The complete trace buffer will then be available to you for inspection.