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 increases flash use

Posted by michal on July 14, 2012
Hello,

I have an issue with Run Time Stats. Adding vTaskGetRunTimeStats function to my code increases flash use by more than 20kB!
Stats seems to be working fine, but increased flash use doesn't look like a normal behaviour.
Did someone have a similar problem?

Here is the memory use before and after adding vTaskGetRunTimeStats function

text data bss dec
42124 1444 19148 62716
19648 1320 19096 40064

My code is running on STM32 CM3 and use ARM Sourcery GCC Toolchain

Regards,
Michal


RE: vTaskGetRunTimeStats increases flash use

Posted by Richard on July 14, 2012
The run time stats code itself is very small, but it makes use of C library functions that are not used anywhere else in the code. As soon as you include run time stats you will be pulling in a lot of extra library functions that can bloat your code, depending on your GCC supplier. Companies such as Rowley and Code Red have their own libraries build specifically for embedded systems. Other suppliers use things like NewLib which is a disaster on a small micro.

There are a couple of things you can do. First, avoid using the libraries that come with your compiler. Normally, this can be done by simply including the printf-stdarg.c source file in your project. Search for it in the FreeRTOS/Demo directory, it is included in a lot of projects. The file implements, in a basic and very stack friendly way, the functions needed by the run time stack. If these functions are defined in your project they will not be pulled in from the compilers libraries.

The second thing you can do is ensure the compiler is configured to remove unused code. Most compilers do that by default, but the GCC default is not to do it so you have to tell it explicitly using the -ffunction-sections and -fdata-sections command line options to the compiler, and the --no-gc-sections linker option.

Regards.

RE: vTaskGetRunTimeStats increases flash use

Posted by michal on July 14, 2012
I added printf-stdarg.c as you suggested and it helped very well! Now only 600bytes more of flash used.
Thank you a lot for your help.

Regards,
Michal


[ 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