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

Debugging tasks with IAR EWARM

Posted by Christopher Coley on May 10, 2008
I am running into an issue where it looks like a stack is getting corrupted, however I have substantially increased all the stack size to much larger than necessary and still get strange execution.

Basically what is happening is that when I start a task and then break with IAR the call stack shows that a piece of code completely unrelated to the started task is being executed. As best I can tell it appears that it wasn't even started at the top of the function, hence my belief that the stack got corrupted.

I have two tasks running to start off with.

1. Is a debug tasks taking messages from a queue and putting them out a serial port, as such allowing any other task to put messages on that queue for output. It also has an ISR taking serial input and putting it in another queue

2. Is a command line interface that builds up and allows execution of commands using the queue mentioned for the debug task. One of the commands I have implemented is "ps" that uses vTaskList to output the current task list and status. Other commands allow initialization and starting of the other tasks mentioned above.

The output of ps before starting another task. As you can see there is a fair amount of stack available.
Task Stat Pri Free TCB#
CmdLine R 1 616 1
Debug R 1 26 0
IDLE R 0 107 2

When I start another task this strange execution path is taken and I can no longer interact.

Now I understand why the data structures for the queue's, task's etc... are private and from the API everything is void* however this makes debugging painful. Has anyone, or wouldn't it be a good idea, to have debug versions of the structures such that IAR would allow expansion so visability into the kernel would be available. Alternatively has anyone created a plug-in for the IAR tools to make them FreeRTOS aware?

TIA
Chris.

RE: Debugging tasks with IAR EWARM

Posted by Christopher Coley on May 10, 2008
Found my own solution to the problem by doing what I suggested before.

The issue was in the xPortStartScheduler function in port.c. It was assuming that the vector table was at address 0.

vPortStartFirstTask( *((unsigned portLONG *) 0 ) );

We are running from a bootloader and so there is a different stack and vector table so I changed it to.

vPortStartFirstTask( *((unsigned portLONG *) __sfb(".intvec") ) );

This way it gets the startup stack correctly from the active vector table. This would also work by getting the vector table from the Cortex-M3 SCB->ExceptionTableOffset.

Thanks
Chris.


[ 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