[SOLVED] Integrating SystemView Sources for Renesas RX controllers

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Integrating SystemView Sources for Renesas RX controllers

    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:

    Source Code: SEGGER_RTT_Conf.h

    1. #define SEGGER_RTT_LOCK() { \
    2. unsigned long _SEGGER_RTT__LockState; \
    3. _SEGGER_RTT__LockState = get_ipl(); \
    4. set_ipl(configMAX_SYSCALL_INTERRUPT_PRIORITY);
    5. #define SEGGER_RTT_UNLOCK() set_ipl(_SEGGER_RTT__LockState); \
    6. }

    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

    1. void SEGGER_SYSVIEW_RecordEnterISR(void) {
    2. unsigned v;
    3. U8* pPayload;
    4. U8* pPayloadStart;
    5. RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32);
    6. //
    7. pPayload = pPayloadStart;
    8. v = SEGGER_SYSVIEW_GET_INTERRUPT_ID();
    9. ENCODE_U32(pPayload, v);
    10. _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_ISR_ENTER);
    11. RECORD_END();
    12. }
    Display All
    To identify the current interrupt, SystemView needs to know the interrupt level.

    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
  • Hello Matthias,

    is this matter resolved? Because in your other thread you wrote that you were able to instrument your application as documented.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.