arm/debug:fix gdbstub clear fpb & dwt when already use jtag/swo bug

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-12-18 10:51:15 +08:00 committed by Mateusz Szafoni
parent b68aa89e56
commit 6c4b30736e
2 changed files with 14 additions and 0 deletions

View file

@ -633,6 +633,13 @@ int up_debugpoint_remove(int type, void *addr, size_t size)
int arm_enable_dbgmonitor(void)
{
if (getreg32(NVIC_DHCSR) & NVIC_DHCSR_C_DEBUGEN)
{
/* If already on debug mode(jtag/swo), just return */
return OK;
}
arm_fpb_init();
arm_dwt_init();
modifyreg32(NVIC_DEMCR, 0, NVIC_DEMCR_MONEN | NVIC_DEMCR_TRCENA);

View file

@ -659,6 +659,13 @@ int up_debugpoint_remove(int type, void *addr, size_t size)
int arm_enable_dbgmonitor(void)
{
if (getreg32(NVIC_DHCSR) & NVIC_DHCSR_C_DEBUGEN)
{
/* If already on debug mode(jtag/swo), just return */
return OK;
}
arm_fpb_init();
arm_dwt_init();
modifyreg32(NVIC_DEMCR, 0, NVIC_DEMCR_MONEN | NVIC_DEMCR_TRCENA);