Page 1 of 1

I get chSysHalt("SV#6") while running ChibiOS-Contrib-RT-STM32F407-DISCOVERY-RTT+SystemView Example

Posted: Fri Oct 02, 2020 9:37 pm
by Abusous2000
Hi guys

I decide to evaluate Segger J-Link, and tested the example in the ChibiOS-Contrib section

However, when I run it in the debugger; it is as if ChibiOS thinks it is running in a thread contexts although chSysHalt("SV#6")

Clearly I can see in the debuuger that I am in a DMA ISR , which invokes macro CH_CFG_IRQ_PROLOGUE_HOOK() that is delegated to SEGGER_SYSVIEW_RecordEnterISR() method

Therefore, I wonder if this is a bug, or my J-Link hardware is bad, or I did something wrong?

Many thanks in advance.

Re: I get chSysHalt("SV#6") while running ChibiOS-Contrib-RT-STM32F407-DISCOVERY-RTT+SystemView Example

Posted: Fri Oct 02, 2020 9:57 pm
by Giovanni
Hi,

It is contributed material so not a ChibiOS bug, this should go in support section, I suggest you contact the author about the problem.

Giovanni

Re: I get chSysHalt("SV#6") while running ChibiOS-Contrib-RT-STM32F407-DISCOVERY-RTT+SystemView Example

Posted: Sun Oct 04, 2020 2:16 am
by Abusous2000
Thanks Giovanni,

I did. However, it took me few hours & I found the bug. I had to reverse engineer ChibiOS. I applied the below fix, & Segger's System view worked right away. Let 's hope it help someone
I changed these macros in file SEGGER_SYSVIEW_ChibiOS.h to the following, it did work well with no exceptions. You will find in bold what I have changed.
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
_dbg_check_enter_isr(); \
SEGGER_SYSVIEW_RecordEnterISR(); \
_CH_CFG_IRQ_PROLOGUE_HOOK(); \
}

#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
_dbg_check_leave_isr(); \
_CH_CFG_IRQ_EPILOGUE_HOOK(); \
port_lock_from_isr(); \
_dbg_enter_lock(); \
if (_isr_is_tail() && chSchIsPreemptionRequired()) { \
SEGGER_SYSVIEW_RecordExitISRToScheduler(); \
} else { \
SEGGER_SYSVIEW_RecordExitISR(); \
} \
_dbg_leave_lock(); \
}