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

Retrieving task names from TCB

Posted by Alex Lennon on May 28, 2010
Hi there,

I'm using FreeRTOS with an ATMega1280 based project. I'm trying to optimise heap and stack usage as the device is fairly memory constrained.

So I'm making use of uxTaskGetStackHighWaterMark(xTaskHandle). I don't really want to use more RAM to store the task names, but it would be helpful to log the names rather than the handle IDs. The names are in the TCB of course but I can't see a function to retrieve them.

Could somebody point me to a function, if it exists, or is there an architectural reason that one couldn't/shouldn't be added?

Thanks,

Alex

RE: Retrieving task names from TCB

Posted by Dave on May 28, 2010
The handle ID is a pointer to the task control block, in which the name is stored. You could add a function to tasks.c like

char *pcGetTaskName(void *handle)
{
return ((tskTCB*)handle)->pcTaskName;
}


I have not actually tested this code, but you see the idea.

RE: Retrieving task names from TCB

Posted by Alex Lennon on May 28, 2010
Hi Dave,

Thanks for the response.

I had put something similar in place, but using (const char *) for the return.

My question was more to do with why the there are no accessor functions in place already in FreeRTOS as this seems a sensible idea. I wondered if there is an architectural reason not to expose fields of the TCBs in this way...

Alex

RE: Retrieving task names from TCB

Posted by Richard on May 28, 2010
All the kernel data structures use data hiding in this way. Inside the files that define the structures the structure members are fully visible. Outside the files the structures are defined as void* to keep their members hidden - and access can only be obtained through access functions.

There is no particular reason why a function to return the name has never been included. I have added it to the todo list so it will be there in the next release.

Regards.

RE: Retrieving task names from TCB

Posted by Alex Lennon on May 29, 2010


Thanks!


[ 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