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

Message queues - how to determine size of queue task?

Posted by groger57 on October 26, 2015

Hello,

I posted a few days ago about using a message queue, someone posted a response and it helped solve the issue. I now have the message queue working just fine. It's getting messages as I can print out the value passed in in the task handler.

The task handler calls a function to update flash memory. It has a mutex around the call to write. In creating the task handler, I initially set the size to 120 bytes. However, it was causing a WDT reset when the queue handler called the memory update function. After setting the handler size to 180 bytes on the task creation, it is OK.

I would rather understand what the right approach is to setting the task size. Can someone explain how to establish this?

Thanks! Gary


Message queues - how to determine size of queue task?

Posted by rtel on October 26, 2015

Are you referring to the size of the stack?

The stack requirements are determined by your program (how many automatic variables you have, how deep the function call nesting is, etc.) and the compiler options (the higher the compiler optimisation the less stack it will use in most cases). You can calculate this in the same way you would calculate it for a non RTOS (bare metal) application.

However, a pragmatic approach is to use the stack overflow checking (http://www.freertos.org/Stacks-and-stack-overflow-checking.html) feature to know when the stack is too small, and the stack high water mark queries (http://www.freertos.org/uxTaskGetStackHighWaterMark.html) to know how much you have actually used - then you can just tune it accordingly.

Regards.


Message queues - how to determine size of queue task?

Posted by groger57 on October 28, 2015

Hi,

Yes, referring to stack size set in the individual tasks. Thank you, and I will do some reading and testing to understand this.


[ 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