File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1824,7 +1824,7 @@ static int xtensa_poll(struct target *target)
18241824 target -> state = TARGET_HALTED ;
18251825 esp32_fetch_all_regs (target , 0x3 );
18261826 //Examine why the target was halted
1827- target -> debug_reason = DBG_REASON_DBGRQ ;
1827+ target -> debug_reason = DBG_REASON_UNDEFINED ;
18281828 uint32_t halt_cause [ESP32_CPU_COUNT_MAX ] = {0 };
18291829 for (size_t i = 0 ; i < esp32 -> configured_cores_num ; i ++ )
18301830 {
@@ -1851,6 +1851,12 @@ static int xtensa_poll(struct target *target)
18511851 esp32 -> active_cpu = k - 1 ;
18521852 }
18531853 }
1854+ // Handle special case when halt is send to the stalled active core.
1855+ // We need to switch focus to another core in order to be able to run algorithms.
1856+ if (target -> debug_reason == DBG_REASON_DBGRQ && (dsr [esp32 -> active_cpu ] & OCDDSR_RUNSTALLSAMPLE )) {
1857+ LOG_DEBUG ("Received debug request on stalled active core %d. Switch active core." , (int )esp32 -> active_cpu );
1858+ esp32 -> active_cpu = esp32 -> active_cpu == ESP32_PRO_CPU_ID ? ESP32_APP_CPU_ID : ESP32_PRO_CPU_ID ;
1859+ }
18541860 for (size_t k = esp32 -> configured_cores_num ; k > 0 ; k -- ) {
18551861 if (halt_cause [k - 1 ] & DEBUGCAUSE_IC )
18561862 {
You can’t perform that action at this time.
0 commit comments