System tick is not triggerred

brakova wrote on Friday, October 28, 2011:

Hi,

I am new to FreeRTOS so sorry if that is a stupid question but I really want to figure this out…

I have an IAR program originally written for Cortex M3 using Stellaris. I got it from the source code with the FreeRTOS book - A practical guide. As I don’t have the device I want to debug the program with the Simulator. I changed the progect options and everything compiles.

The BIG problem is that the xPortSysTickHandler located in startup_ewarm.c is never called… I think it should be called with every system tick. I have no idea why this happens…
The FreeRTOSConfig.h looks ok - it includes:

/* Use the system definition, if there is one */
#ifdef __NVIC_PRIO_BITS
#define configPRIO_BITS       __NVIC_PRIO_BITS
#else
#define configPRIO_BITS       5        /* 32 priority levels */
#endif

/* The lowest priority. */
#define configKERNEL_INTERRUPT_PRIORITY ( 31 << (8 - configPRIO_BITS) )
/* Priority 5, or 160 as only the top three bits are implemented. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( 5 << (8 - configPRIO_BITS) )

I suppose that there is some issue with the demo… running with the IAR simulator but I have no idea what should I change. Any advice will be much helpful :slight_smile:

Thanks very much!

woops_ wrote on Friday, October 28, 2011:

Look up ‘interrupt simulation’ in the debuug ewarm_debuggingguide.enu.pdf. You must use the menus in cspy to setup that up. Else it is just an instruction simulator.

brakova wrote on Friday, October 28, 2011:

Hi,

Thanks! This tutorial surely explains a lot.
Do you know which are the Interrupts that the FreeRTOS needs and what are their right configuration elements?

I think that I’ll need to add the SysTick and the PendSV interrupts but I’m not sure what should be the First activation and Repeat interval parameters?

brakova wrote on Friday, October 28, 2011:

But aren’t these interrupts from the core itself…. or should I configure them explicitly?

rtel wrote on Friday, October 28, 2011:

On a Cortex-M, FreeRTOS needs SVC, SysTick and PendSV.  I have no idea how you configure the IAR simulator to simulate these interrupts though as I have never done it.  I think IAR support will be able to tell you quickly if it can be done.

Regards.

brakova wrote on Monday, October 31, 2011:

Hi,

I finally got it and I think that it’s a good thing to share it with you so that if anyone else happen to have the same problem it would be easier to find a solution.

If you want to run the FreeRTOS examples with the IAR Simulator you have to first choose the Simulator as your Debugger Driver in the Project options and secondly - you need to set up the Simulator Interrupts you want to have.
You go to Simulator > Interrupts Setup. As you already know - The FreeRTOS needs SVC, SysTick and PendSV interrupts. However you need to set up the SysTick only and it will consiquently trigger the other two interrupts.
You need to add the SysTick interrupt. You have to set the required parameters. My example works fine with the following settings:

• First activation - 5000000 - Specify the value of the cycle counter after which the specified type of interrupt will be generated.
• Repeat Interval - 100000 - Specify the periodicity of the interrupt in cycles.
• Hold time - 100000 - Specify how long, in cycles, the interrupt remains pending until removed if it has not been processed. If you select Infinite, the corresponding pending bit will be set until the interrupt is acknowledged or removed.
• Variance - 0 - Selects a timing variation range, as a percentage of the repeat interval, in which the interrupt might occur for a period. For example, if the repeat interval is 100 and the variance 5%, the interrupt might occur anywhere between T=95 and T=105, to simulate a variation in the timing.
• Probability - 100 - Selects the probability, in percent, that the interrupt will actually occur within the specified period.

Regards :slight_smile: