I redirected CC to mailing list, maybe somebody knows more.
On 04.11.2017 22:49, Åke Rehnman wrote:
I have been staring at this piece of code in stm8_reset_assert which
is stolen form hla_target:
if (target->reset_halt) {
target->state = TARGET_RESET;
target->debug_reason = DBG_REASON_DBGRQ;
} else {
target->state = TARGET_HALTED;
}
Why is it setting target->state to TARGET_RESET if halt was requested?
And the other way around when halt was not requested target->state is
set to TARGET_HALTED...?
It does not make any sense...
If I understand correctly it is a hack to adjust STLink action after reset.
STLink in SWD mode probably stops the target after halt on its own
(don't forget it is HIGH level, unfortunately).
The most important part is in the following reset_deassert: it runs the
target if halt was not requested
return target->reset_halt ? ERROR_OK : target_resume(target, 1, 0,
0, 0);
(awful coding style, isn't it?)
Probably target_resume() would fail without state TARGET_HALTED.
When halt is requested, the state is set correctly to TARGET_RESET. The
next poll examines debug
state registers and detects CPU is halted.
Tom
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel