[SOLVED] Cortex M0+ NoOS Port Read Active Interrupt ID

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

  • [SOLVED] Cortex M0+ NoOS Port Read Active Interrupt ID

    Hello
    Im trying to port SystemView to the Coretex M0+ uC.

    I could send Task Info and Print to the SystemView Terminal but i have Problems to monitor the Interrupts.


    According to:
    infocenter.arm.com/help/index.…oc.dui0662b/CIHFDJCA.html
    4.3.3 Interrupt Control and State Register
    The VECTACTIVE Part of the ICSR Register is marked as Reserved.

    C Source Code

    1. SEGGER_SYSVIEW_GET_INTERRUPT_ID() ((*(U32 *)(0xE000ED04)) & 0x3F)

    Makro Returns 0 i think.

    If i try to use the SystemView Interupt Functions:

    C Source Code

    1. SEGGER_SYSVIEW_RecordEnterISR();
    2. SEGGER_SYSVIEW_RecordExitISR();


    I got al lot of ISR Enter and ISR Exit Events in the Segger Systemview PC Tool (see the Attachment).

    Do you have any suggestions how i could fix this?
    Images
    • SystemView_M0_IRQ_ID_Error.png

      111.58 kB, 1,920×1,160, viewed 1,179 times
  • Hi,

    You are right, Cortex-M0+ devices do not have the ICSR[VECTACTIVE] bits implemented.
    Instead you can read the active vector from the IPSR, best implemented in a user-provided function SEGGER_SYSVIEW_X_GetInterruptId():

    C Source Code

    1. /*********************************************************************
    2. *
    3. * SEGGER_SYSVIEW_X_GetInterruptId()
    4. *
    5. * Function description
    6. * Return the currently active interrupt Id,
    7. * which ist the active vector taken from IPSR[5:0].
    8. *
    9. * Return value
    10. * The current currently active interrupt Id.
    11. *
    12. * Additional information
    13. * This function is not used by default, as the active vector can be
    14. * read from ICSR instead on Cortex-M0.
    15. * For Cortex-M0+ devices, change SEGGER_SYSVIEW_GET_INTERRUPT_ID
    16. * in SEGGER_SYSVIEW_Conf.h to call this function instead.
    17. */
    18. U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
    19. U32 Id;
    20. __asm volatile ("mrs %0, ipsr"
    21. : "=r" (Id)
    22. );
    23. Id &= 0x3F;
    24. return Id;
    25. }
    Display All


    Regards
    Johannes
    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.
  • Hi,

    I get the same problem, I am using STM32F091RC nucleo board, and as interrupt ID is not detected so interrupt handler is recognized as an idle state.

    I tried the __asm volatile ("mrs %0, ipsr" : "=r" (Id) );


    solution mentioned above, but get a compilation error: missing ")" character. I am using Keil5 with default compilation settings.


    Could you please tell me how you solved this problem?


    Thanks!
  • Hi,

    Keil does not support extended assembler syntax.

    Instead you can use something like this:

    C Source Code

    1. U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
    2. register U32 IPSR __asm("ipsr");
    3. return(IPSR);
    4. }


    Regards
    Johannes
    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.
  • Hi,

    Thanks, it works! But it still has a problem: it cannot get how many ticks the interrupt runs, which means even if I ran the interrupt for several seconds, it shows only one cycle. I cannot find SEGGER_SYSVIEW_X_GetTimestamp() function called in SEGGER_SYSVIEW_RecordEnterISR(); and SEGGER_SYSVIEW_RecordExitISR();. Do I need to manually do something in the interrupt?


    Thanks for help!
  • Hi,

    SEGGER_SYSVIEW_X_GetTimestamp() will be called in the recording function called by SEGGER_SYSVIEW_Record*().
    You do not have to modify them.

    If the recording shows only one cycle, make sure that the implementation of SEGGER_SYSVIEW_X_GetTimestamp() does work.
    Refer to the sample configurations given for the various supported systems.

    Regards
    Johannes
    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.