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


Trace Hook Macros Issue

Posted by Tekkon on March 8, 2011
Hi all,

I read the tutorial for Trace Hook Macros and got a couple of questions.

In the example 2, how does the "reasonBLOCKING_ON_QUEUE_READ" defined? And how does the "log_event()" function logging the task execution? Is there any specific example in the Demo that logging task execution sequences, task timing, kernel events?

I ported it to CORTEX_LM3Sxxxx Rowley, and suspect one of my task stopped working and the RTOS is locking up for some reason. So I'm trying to figure it out by API call logging. Thank you in advance!

/* traceBLOCKING_ON_QUEUE_RECEIVE() is just one of the macros that can be used to record why
a context switch is about to occur. */
#define traceBLOCKING_ON_QUEUE_RECEIVE(pxQueue) \
ulSwitchReason = reasonBLOCKING_ON_QUEUE_READ;

/* log_event() is an application defined function that logs which tasks ran when, and why. */
#define traceTASK_SWITCHED_OUT() \
log_event( pxCurrentTCB, ulSwitchReason );

RE: Trace Hook Macros Issue

Posted by Richard on March 8, 2011
I think you are referring to the page about trace hook macros on the web site? Three of the five FreeRTOS tutorial books have already been updated to include a section on using the trace macros, with quite a comprehensive example included too (another book has also been updated, but the example not yet ported).

“how does the "reasonBLOCKING_ON_QUEUE_READ" defined”

reasonBLOCKING_ON_QUEUE_READ is supposed to be just a unique constant that indicates that the context switch that is about to occur is occurring because the current task blocked on a queue read. In a real application, it would just be a number, nothing else. It is a hypothetical example so the definition of reasonBLOCKING_ON_QUEUE_READ is not given.

“And how does the "log_event()" function logging the task execution?”

Again, its a hypothetical example, so log_event() is not doing anything. It is up to the application to decide how you want to log an event. It could be write to a RAM disk for example, but ideally it would be to communicate with a kernel aware debugger. The Cortex-M3 can output trace information in real time in a non intrusive manner, so if that was how the trace was output, log_event() would simply be a macro that wrote to the trace port.


[ 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