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

Bug in FreeRTOS??

Posted by Konoppo on March 23, 2009
Hi!!

I noticed a strange thing! When 3 tasks have been started without enough free stack system crashed! I didn't return from last xTaskCreate! System crashed in prvAllocateTCBAndStack function - it didn't come out from:
memset( pxNewTCB->pxStack, tskSTACK_FILL_BYTE, usStackDepth * sizeof( portSTACK_TYPE ) );

When I simply comment this line (it is useful only when debuging) system start working correctly! It means it returned an error code from xTaskCreate function insted of hang up in this function!!

Is it a kind of bug?? Or maybe I made something wrong??

I use FreeRTOS on LPC2364 ARM7 microcontroller.

Regards
Konoppo

RE: Bug in FreeRTOS??

Posted by Dave on March 23, 2009
Most likely your linker script is wrong, or the startup code is not correctly initializing variables.

RE: Bug in FreeRTOS??

Posted by Konoppo on March 23, 2009
For what should I pay attention in linker script or in startup code?? In my opinion both are correct but maybe I missed something ;)...

RE: Bug in FreeRTOS??

Posted by Richard on March 23, 2009
If there is not enough heap space to create a task then pvPortMalloc() will return NULL and xTaskCreate() will never call memset(). Do you mean without enough stack, or do you mean without enough heap? (you say stack).

Which heap implementation are you using, heap_1, heap_2 or heap_3?

Which compiler are you using?

Regards.

RE: Bug in FreeRTOS??

Posted by Konoppo on March 23, 2009
OK, thanks for suggestion!! The USER_MODE stack size was only 2kB, when the total cheap size for freeRTOS was 4kB ;)... When I changed it everything is OK now :)...

RE: Bug in FreeRTOS??

Posted by Konoppo on March 23, 2009
I use heap_2, and I should say "heap" instead of stack ;)... But problem Was in stack size, I think... When I increased it - everything is OK now. But I think it's not good idea, that xTaskCreate() call memset in this situation and crash system (my uC went to address like 0xa5000000 and NOPs instruction)...

Regards
Konoppo

RE: Bug in FreeRTOS??

Posted by Richard on March 23, 2009
Are you suggesting each line if FreeRTOS should check the user has not overflowed the stack before executing - even before the scheduler has been started?

Regards.

RE: Bug in FreeRTOS??

Posted by Konoppo on March 23, 2009
OK, you are right, my suggestion was a bit stupid ;)... For me it wasn't obvious that freeRTOS uses a Supervisor Stack Size...

RE: Bug in FreeRTOS??

Posted by Konoppo on March 23, 2009
OK, please, tell me - which memory is used by freeRTOS for "heap"?? It's a free RAM (bss_section) or it's stored in the stac region?? I thought that heap uses the stack region but now I think that it's stored in BSS section (like any other variable)... I use GCC...


[ 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