Dear SEGGER Team
When I integrated the SEGGER RTT + SystemView sources into my FreeRTOS project, I found something I couldn't understand at first sight.
My application runs on a Renesas RX target, compiled with the CCRX Compiler package.
My application has some very strict real-time requirements, hence there are a few interrupts that shall not block under any circumstance. The SEGGER_RTT_LOCK blocks all interrupts by clearing the global interrupt enable in the PSW (Processor Status Word, see SEGGER_RTT_Conf.h).
Therefore I had to re-implement the SEGGER_RTT_LOCK in the following way:
What this does is pretty simple. Only interrupts that access the FreeRTOS API are masked. This is very similar to how it is done for some ARM-based devices.
However, this leads to bad behavior in the following code:
Display All
To identify the current interrupt, SystemView needs to know the interrupt level.
Example:
The workaround I implemented is to place the line
Did I miss anything or was my correction the right choice?
As a follow-up question:
Is there another way to identify interrupts? I have several interrupts that run on the same priority. Thus they cannot be differentiated.
Any answer would be highly appreciated.
Kind regards,
Matthias Schär
When I integrated the SEGGER RTT + SystemView sources into my FreeRTOS project, I found something I couldn't understand at first sight.
My application runs on a Renesas RX target, compiled with the CCRX Compiler package.
My application has some very strict real-time requirements, hence there are a few interrupts that shall not block under any circumstance. The SEGGER_RTT_LOCK blocks all interrupts by clearing the global interrupt enable in the PSW (Processor Status Word, see SEGGER_RTT_Conf.h).
Therefore I had to re-implement the SEGGER_RTT_LOCK in the following way:
What this does is pretty simple. Only interrupts that access the FreeRTOS API are masked. This is very similar to how it is done for some ARM-based devices.
However, this leads to bad behavior in the following code:
Source Code: SEGGER_SYSVIEW.c
- void SEGGER_SYSVIEW_RecordEnterISR(void) {
- unsigned v;
- U8* pPayload;
- U8* pPayloadStart;
- RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
- //
- pPayload = pPayloadStart;
- v = SEGGER_SYSVIEW_GET_INTERRUPT_ID();
- ENCODE_U32(pPayload, v);
- _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_ISR_ENTER);
- RECORD_END();
- }
RECORD_START
calls SEGGER_RTT_LOCK
. Unfortunately, this call leverages the interrupt level (in my example up until "configMAX_SYSCALL_INTERRUPT_PRIORITY"). It is only after this call that the *current* interrupt level gets stored in the variable "v".Example:
- Interrupt X has priority 1
- X gets traced => priority gets leveraged to 4
- v = 4
- SystemView receives this trace with the wrong interrupt level.
The workaround I implemented is to place the line
v = SEGGER_SYSVIEW_GET_INTERRUPT_ID();
just above RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
.Did I miss anything or was my correction the right choice?
As a follow-up question:
Is there another way to identify interrupts? I have several interrupts that run on the same priority. Thus they cannot be differentiated.
Any answer would be highly appreciated.
Kind regards,
Matthias Schär