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

FreeRTOS 7.4.1 sometimes halts in printf after vTaskStartScheduler starts (beagleboard)

Posted by liujinsuiyue on October 11, 2013

Hi

I ported FreeRTOS 7.4.1 to beagleboard with simple uart support. My problem is that as long as the scheduler not starts the printf function works fine, but the system hangs sometimes after i implement a printf after the scheduler start. For example if printf("the test beginsn"); then only "the tes" will show on the console. But sometimes, let's say 1 out of 10 times restart the system works fine.

any ideas about this problem? Any suggestion would be appreciated.


FreeRTOS 7.4.1 sometimes halts in printf after vTaskStartScheduler starts (beagleboard)

Posted by richardbarry on October 11, 2013

On small systems printf() nearly always overflows the stack if you are using Newlib or equivalent. For that reason a really tiny third party version is provided with FreeRTOS. If you search FreeRTOS/Demo for a file called printf-stdarg.c you will find lots of copies.

Do you have stack overflow detection turned on?

However, on your hardware I'm guessing you have plenty of stack - so it is more likely to be a reentracy issue. Do you have any kind of mutual exclusion around the printf() function or the UART?

If you are using Newlib then there is some basic support for its impure_ptr implementation to try and make it reentrant, but you would need to update your FreeRTOS version to get access to it. It is a FreeRTOSConfig.h option.

Regards.


FreeRTOS 7.4.1 sometimes halts in printf after vTaskStartScheduler starts (beagleboard)

Posted by liujinsuiyue on October 11, 2013

Hi Richard,

Thank you for your reply. Forgot to mention: the system also tend to halt when i call vTaskDelay(). I think that means the problem is not related to printf function. FYI, i use a similar third party printf as printf-stdarg.c in this project. I will turn on the stack overflow detection to see if that is the problem. Any other opinions?

Best regards.


FreeRTOS 7.4.1 sometimes halts in printf after vTaskStartScheduler starts (beagleboard)

Posted by liujinsuiyue on October 11, 2013

Hi

When i put the code like the following: vPortEnterCrital(); printf("xxxx"); vPortExitCritical(); then the system will not hang because of printf but still stop when calling vTaskDelay().


[ 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