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


Call stack and tracing

Posted by Nobody/Anonymous on September 3, 2005
I'm working on the '1611 IAR port - I tried getting the trace utility to work - but I was hoping you could give a quick glance at this and reply. I was wondering if this is a 'normal' looking call stack to have while FreeRTOS is running & then issuing a break:

xQueueReceive(0xFFFF,0x1456, 0)

RE: Call stack and tracing

Posted by Richard on September 3, 2005

This would not be an unexpected call stack, although the address 0xCCCC look suspicious.

Here are some tips on using the trace utility with IAR.

+ Ensure configUSE_TRACE_FACILITY is #defined to 1.

+ Define a buffer into which the trace will be placed. Eg char

cBuf[ 4096 ];

+ At some point in the code, maybe on some event, insert a call to vTaskStartTrace() to start the trace.

+ The trace will automatically end when the buffer is full.

+ Pause the debugger, then open up a ‘memory’ window (select Memory from the View menu).

+ Right click in the Memory pain and select “Memory Upload” from the pop up menu.

+ You will be prompted for the start address (the address of the first byte within the trace buffer, in this example cBuf) and length of the buffer. In the Zone drop down box I have always just select ‘Memory’.

+ When you click OK you will be prompted for a file name into which the memory dump should be stored. Choose “trace.hex” as the file name (the name is important as the trace conversion utility is somewhat crude and does not give you the opportunity to select a file name).

+ A hex file called trace.hex will be stored to your hard disk (unsurprisingly). The trace utility requires a binary file, so convert the hex into a binary file. I use ‘hex2bin.exe’ for this purpose. See http://gnuwin32.sourceforge.net/packages/hex2bin.htm. You should now have a file called trace.bin.

+ Copy tracecon (little endian?) into the directory in which trace.bin is stored and execute it. This will produce a file called trace.txt.

+ Open trace.txt in Excel (or equivalent). The binary will pack a load of 0’s at the start of the file up to the address at which your buffer was stored. Delete all the leading zero rows, up to the first valid row which has non zero numbers. [you can delete the padding from a binary editor if there are too many lines for Excel to play with. Alternatively you can provide an offset to the hex2bin utility to prevent it packing with zeros].

+ If you now draw a scatter graph of the first two columns you should get a graph as depicted on the FreeRTOS WEB site.

Hope this helps.


RE: Call stack and tracing

Posted by btoland on June 19, 2007

Many thanks for the very useful post! Got me sorted with the trace.


[ 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