• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » Stellaris® ARM® Microcontrollers » Stellaris® ARM® LM3S Microcontrollers Forum » safeRTOS "Task safe" console output?
Share
Stellaris® ARM® Microcontrollers
  • Forum
Options
  • Subscribe via RSS
Helpful Stellaris® LM4F Series Links
  • LM4F Series
  • Stellaris PinMux Utility
  • Stellaris® LM4F120 LaunchPad
  • LM4F MCU Applications
  • LM4F MCU Video
  • ARM Cortex-M4F Whitepaper
  • Stellaris MCU Brochure
  • LM4F232 Eval Kit
  • safeRTOS "Task safe" console output?

    safeRTOS "Task safe" console output?

    This question is not answered
    Andrew Eldredge
    Posted by Andrew Eldredge
    on May 04 2012 15:08 PM
    Prodigy190 points

    I often find myself relying on console output to debug code.  I am starting up in using safeRTOS for some multitask work, but I have discoverd that printf seems to be poisonous to safeRTOS and safeRTOS is poisonous to printf.  Shutting off the scheduler before a call to printf and then turning it back on again seems to prevent corruption of CIO, but It will also shut off the scheduler.  Is there a "task-safe" method of getting information to the console> 

    Would a critical section do the job, or would it suffer corruption on tasks with sufficient priority to interrupt it.

    What is the intent of the ustdlib.c?  is it supposed to be interrupt safe? 

    Thank you for the help

    SafeRTOS Console Output
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Michael S
      Posted by Michael S
      on May 10 2012 12:25 PM
      Genius9710 points

      Hello team,

      Is there an update available to this customer's inquiry?

      Regards,

      Michael

      Regards,

      Michael S.

      ACSC Digital Apps

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Matthew Staben
      Posted by Matthew Staben
      on Jun 11 2012 12:21 PM
      Prodigy100 points
      I found this question doing a google search for something else, but I once had the same problem - printf ( ) usage would cause CIO issues - thought I'd mention switching to the ustdlib (usprintf) libraries supplied by TI solved the problem for me - it's a pretty good library.  Later, I came to realize that printf ( ) would work but I continued to use the ustdlib library functions.  I don't recall what broke printf ( ) or got it working again, but just to get over the hump pick up the library functions and eventually you may find the combination that gets things to operate again.  I think it had something to do with the system stack size that's configured in the eclipse environment, but it could be a number of things.
      I'm using the LM3S9B96 
      Good luck.
      P.S.  You may want to start watching your stack usage.  What I do is on declaration fill my stack space with 55's and then in the console perform a scan of where the 55's have been overwritten.  Simpler than it sounds ...
      Do this just before declaring the task (xTaskCreate ( ) )

      i = 0;
      while ( i < sizeof ( g_pul_TaskStack ) / 4 ) {
         g_pul_TaskStack [ i ] = 0x55555555;
         i += 1;
      }

      then, in the console when you tell it to analyze the stack 

      lp = &g_pul_TaskStack [ 0 ];

      j = sizeof ( g_pul_TaskStack );

      k = 0;
      while ( k < ( j / 4 ) && *( lp + k ) == 0x55555555 ) {
         k += 1;
      }
      usprintf ( Buf, "Len=%4d, Used=%4d, Free=%4dr\n", j, j - ( k * 4 ), ( k * 4 )  );

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use