Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

vTaskGetRunTimeStats on a Cortex M3 with IAR

Posted by Einar on July 27, 2010
Hi,

I am unable to make vTaskGetRunTimeStats() work on a Cortex M3 with IAR. First I followed the instructions in the FreeRTOS Reference Manual, but found that declaring the counting variable extern in FreeRTOSConfig.h gave a assembly error (in portasm.s) which I could not understand nor fix.

After declaring the variable in port.h (which I assume is not OK due to the license) I was able to get everything seemingly working. However, upon calling vTaskGetRunTimeStats(buffer) the buffer isn't filled. (I verified this by giving the first buffer bytes a known value before calling vTaskGetRunTimeStats()).

Does anybody know what I may be doing wrong?

RE: vTaskGetRunTimeStats on a Cortex M3 with IAR

Posted by James Stanley on July 29, 2010
The build error in portasm.s is due to the assembler trying to interpret the C keyword 'extern' which it can't do. The trick is to include the extra code only when FreeRTOSConfig.h is included from FreeRTOS.h.

For the CORTEX_LM3Sxxxx_IAR_Keil demo, the code you need to add to FreeRTOSConfig.h is:

#define configGENERATE_RUN_TIME_STATS1

#ifdef INC_FREERTOS_H
extern volatile unsigned long ulHighFrequencyTimerTicks;

/* ulHighFrequencyTimerTicks is already being incremented at 20KHz. Just
set its value back to 0. */
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() ( ulHighFrequencyTimerTicks = 0UL )
#define portGET_RUN_TIME_COUNTER_VALUE()ulHighFrequencyTimerTicks
#endif



You will also need to add the following definition to timertest.c:

/* Counts the total number of times that the high frequency timer has 'ticked'.
This value is used by the run time stats function to work out what percentage
of CPU time each task is taking. */
volatile unsigned portLONG ulHighFrequencyTimerTicks = 0UL;


and add the following lines to the end of the function Timer0IntHandler():

/* Keep a count of the total number of 20KHz ticks. This is used by the
run time stats functionality to calculate how much CPU time is used by
each task. */
ulHighFrequencyTimerTicks++;


You should now find that calling vTaskGetRunTimeStats() collects the required data.

RE: vTaskGetRunTimeStats on a Cortex M3 with IAR

Posted by Einar on July 30, 2010
Thank you for your advice jamesstanley. With that information it works like a charm.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists