@@ -316,26 +316,28 @@ def appcpu_early_hw_bps(self):
316
316
self .gdb .target_reset ()
317
317
rsn = self .gdb .wait_target_state (dbg .TARGET_STATE_STOPPED , 10 )
318
318
self .add_bp ('call_start_cpu1' , hw = True )
319
+ for target in self .oocd .targets ():
320
+ self .oocd .cmd_exec (f"{ target } configure -rtos hwthread" )
319
321
self .resume_exec ()
320
322
self .gdb .wait_target_state (dbg .TARGET_STATE_STOPPED , 10 )
321
- # We stopped when FreRTOS is not running yet, so GDB is connected to
322
- # one core only (most probably core 0) and shows only one thread representing that core.
323
- # Prepare to switch GDB to core 1.
324
- self .gdb .monitor_run ("esp32 smp_gdb 1" , 5 )
325
- try :
326
- # Switch GDB to core 1.
327
- self .gdb .monitor_run ("resume" , 5 )
328
- # Invalidate register cache to re-read them and get proper backtrace
329
- self .gdb .console_cmd_run ("maint flush register-cache" , 5 )
330
- # In this scenario we can not check stop reason for core 1,
331
- # because GDB could be initially connected to core 0.
332
- # So just check the function name we stopped in on core 1.
323
+ _ ,threads_info = self .gdb .get_thread_info ()
324
+
325
+ def check_bp_hit_on_cpu (cpu_num ):
326
+ for ti in threads_info :
327
+ if ti ['name' ].endswith (f".cpu{ cpu_num } " ):
328
+ self .gdb .console_cmd_run (f"thread { ti ['id' ]} " )
329
+ break
333
330
frame = self .gdb .read_current_frame ()
334
331
self .assertEqual (frame ['func' ], 'call_start_cpu1' )
335
- finally :
336
- # restore default GDB SMP handling to avoid other tests failures
337
- self .gdb .monitor_run ("esp32 smp_gdb -1" , 5 )
338
- self .gdb .monitor_run ("resume" , 5 )
332
+
333
+ try :
334
+ check_bp_hit_on_cpu (1 )
335
+ except :
336
+ # The breakpoint can trigger on cpu0 first, before the bootloader code is loaded
337
+ check_bp_hit_on_cpu (0 )
338
+ self .resume_exec ()
339
+ self .gdb .wait_target_state (dbg .TARGET_STATE_STOPPED , 10 )
340
+ check_bp_hit_on_cpu (1 )
339
341
340
342
class DebuggerBreakpointTestsDual (DebuggerGenericTestAppTestsDual , BreakpointTestsImpl ):
341
343
""" Test cases for breakpoints in dual core mode
@@ -349,7 +351,6 @@ def setUp(self):
349
351
def test_2cores_concurrently_hit_bps (self ):
350
352
two_cores_concurrently_hit_bps (self )
351
353
352
- @skip_for_chip (['esp32' , 'esp32p4' ], "skipped - OCD-1088, OCD-1089" )
353
354
def test_appcpu_early_hw_bps (self ):
354
355
appcpu_early_hw_bps (self )
355
356
@@ -363,7 +364,6 @@ def setUp(self):
363
364
def test_2cores_concurrently_hit_bps (self ):
364
365
two_cores_concurrently_hit_bps (self )
365
366
366
- @skip_for_chip (['esp32' ], "skipped - OCD-1088" )
367
367
def test_appcpu_early_hw_bps (self ):
368
368
appcpu_early_hw_bps (self )
369
369
0 commit comments