Smartphone Flash Tool -runtime Trace Mode- Apr 2026
Patch offsets: SPFlashTool.exe @ 0x2A3F4 – enable hidden menu, then Ctrl+Shift+T for trace console.
RTM default recommendation: Fallback UART + USB bulk when available. | Mode | Data Generated | Bandwidth Requirement | Use Case | |-------|----------------|------------------------|------------| | PC-Only | 4 bytes per instruction | ~200 KB/s (at 100 MHz, 1:1000 sampling) | Locating infinite loops | | PC + Load/Store Address | 12–16 bytes per memory op | ~5 MB/s | Detecting wild pointers | | Register Delta | 2–8 bytes per taken branch | ~1 MB/s | Tracking boot state machine | | Full Execution Trace | All of above | ~50 MB/s (impractical for UART) | Post-mortem analysis with USB | smartphone flash tool -runtime trace mode-
class RuntimeTraceMode HANDLE hTracePipe; // separate thread void OnTracePacket(BYTE* data, DWORD len) if(data[0] == TRACE_PC_PKT) uint32_t pc = *(uint32_t*)(data+1); auto sym = symtab.Find(pc); Log("PC: 0x%08X (%s)", pc, sym.name); ; Send CMD_SET_TRACE_CONFIG(addr_range_start, addr_range_end, mode_flags) before CMD_DOWNLOAD . 6. Use Cases & Results 6.1 Diagnosing Preloader Boot Loop Symptom: Device vibrates every 3 seconds, not detected by flash tool. RTM capture (PC-Only mode): Patch offsets: SPFlashTool
[PC: 0x0012F4A0] pl_check_battery() -> return 0 (battery low) [PC: 0x0012F4B8] pl_shutdown_thermal() [PC: 0x0012F2C0] reset_system() -> infinite loop. Faulty ADC reading on battery thermistor. Fix: Bypass battery check in DA script. 6.2 Secure Boot Chain Verification Using Full Execution Trace over USB (48 MB/s) while flashing a custom U-Boot: Faulty ADC reading on battery thermistor
void trace_thread() uint32_t last_pc = 0; while (1) uint32_t pc = read_cp15_register(PROGRAM_COUNTER); if (pc != last_pc) uint8_t packet[8]; packet[0] = TRACE_PC_PKT; // 0xE1 *(uint32_t*)(packet+1) = pc; send_usb_trace_packet(packet, 5); last_pc = pc; for(int i=0;i<1000;i++) asm("nop"); // sampling rate ~100 kHz