Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

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:

vListRemove(0x0068)
xTaskResumeAll()
xQueueReceive(0xFFFF,0x1456, 0)
vPolledQueueConsumer(0xCCCC)
[PC=Memory:0x156E]

RE: Call stack and tracing

Posted by Richard on September 3, 2005
Hi,

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.

Regards.

RE: Call stack and tracing

Posted by btoland on June 19, 2007
Richard,

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

-Ben.


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


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner