Thursday, October 19th 2017, 7:12am UTC+2

You are not logged in.

  • Login
  • Register

TillmannK

Beginner

Date of registration: Aug 2nd 2017

Posts: 1

1

Friday, August 4th 2017, 3:32pm

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:
http://infocenter.arm.com/help/index.jsp…b/CIHFDJCA.html
4.3.3 Interrupt Control and State Register
The VECTACTIVE Part of the ICSR Register is marked as Reserved.

C/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/C++ Source code

1
2
SEGGER_SYSVIEW_RecordEnterISR();
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?
TillmannK has attached the following image:
  • SystemView_M0_IRQ_ID_Error.png

SEGGER - Johannes

Super Moderator

Date of registration: Aug 31st 2012

Posts: 360

2

Monday, October 9th 2017, 1:34pm

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/C++ Source code

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

  __asm volatile ("mrs %0, ipsr"
                  : "=r" (Id)
                  );
  Id &= 0x3F;

  return Id;
}


Regards
Johannes

Date of registration: Oct 9th 2017

Posts: 2

3

Tuesday, October 10th 2017, 2:19pm

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!

SEGGER - Johannes

Super Moderator

Date of registration: Aug 31st 2012

Posts: 360

4

Wednesday, October 11th 2017, 11:33am

Hi,

Keil does not support extended assembler syntax.

Instead you can use something like this:

C/C++ Source code

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


Regards
Johannes

Date of registration: Oct 9th 2017

Posts: 2

5

Wednesday, October 11th 2017, 12:11pm

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!

SEGGER - Johannes

Super Moderator

Date of registration: Aug 31st 2012

Posts: 360

6

Friday, October 13th 2017, 9:23am

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