How to Properly Implement printf?2019 Community Moderator ElectionFreeRTOS queues for IO before scheduler starts (or after it stops)Looking for a pure c-version of math.h functions (no co-processor support)Porting newlib to a custom ARM setupnewlib printf function bugNewlib printf delaySTM32 hard faults when trying to printf numbers >= 10Newlib's Malloc is “ignoring” a whole bunch of free memoryHow to make printf work on STM32F103?printf in newlib is not working in baremetal ARM environmentUsing LTO with arm-none-eabi and newlib-nano

Magento 2: Override XML file from vendor folder to app folder doesn't work/update

How can I handle a player who pre-plans arguments about my rulings on RAW?

Skis versus snow shoes - when to choose which for travelling the backcountry?

How can I be pwned if I'm not registered on that site?

Second-rate spelling

Is the set of paths between any two points moving only in units on the plane countable or uncountable?

How to count occurrences of Friday 13th

Are small insurances worth it

Borrowing Characters

Series pass transistor, LM7812

Pure Functions: Does "No Side Effects" Imply "Always Same Output, Given Same Input"?

If nine coins are tossed, what is the probability that the number of heads is even?

Did 5.25" floppies undergo a change in magnetic coating?

Has the Isbell–Freyd criterion ever been used to check that a category is concretisable?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

What is the wife of a henpecked husband called?

Canadian citizen, on US no-fly list. What can I do in order to be allowed on flights which go through US airspace?

What to do when being responsible for data protection in your lab, yet advice is ignored?

Where is this triangular-shaped space station from?

Avoiding unpacking an array when altering its dimension

Can we carry rice to Japan?

Sometimes a banana is just a banana

What type of postprocessing gives the effect of people standing out

How do you say "powers of ten"?



How to Properly Implement printf?



2019 Community Moderator ElectionFreeRTOS queues for IO before scheduler starts (or after it stops)Looking for a pure c-version of math.h functions (no co-processor support)Porting newlib to a custom ARM setupnewlib printf function bugNewlib printf delaySTM32 hard faults when trying to printf numbers >= 10Newlib's Malloc is “ignoring” a whole bunch of free memoryHow to make printf work on STM32F103?printf in newlib is not working in baremetal ARM environmentUsing LTO with arm-none-eabi and newlib-nano










0















I've spent the good portion of the last 10 hours trying to wrap my head around printf and how it's supposed to be properly implemented and I need some assistance.



First off I would like to inform you that I am using printf from newlib. Whether there is another library out there that provides a variant of printf, I do not know, but just in case, this is where I am getting printf from.



I want to understand how printf is supposed to work in an embedded environment. For example, I now know that printf will print a string of characters to the STDOUT. Here is my first question:



  1. What is considered STDOUT in an embedded system (MCU)?


  2. Will printf do nothing until I tell printf where to send the string of characters? According to different articles and forums, I am apparently supposed to use the function _write to redirect the formatted output from printf.


  3. If I am supposed to use _write to redirect printf, then why doesn't the newlib documentation explain how to properly use printf? Because I cannot find anywhere in the newlib documentation where it says that printf will not do anything until you implement _write.










share|improve this question


























    0















    I've spent the good portion of the last 10 hours trying to wrap my head around printf and how it's supposed to be properly implemented and I need some assistance.



    First off I would like to inform you that I am using printf from newlib. Whether there is another library out there that provides a variant of printf, I do not know, but just in case, this is where I am getting printf from.



    I want to understand how printf is supposed to work in an embedded environment. For example, I now know that printf will print a string of characters to the STDOUT. Here is my first question:



    1. What is considered STDOUT in an embedded system (MCU)?


    2. Will printf do nothing until I tell printf where to send the string of characters? According to different articles and forums, I am apparently supposed to use the function _write to redirect the formatted output from printf.


    3. If I am supposed to use _write to redirect printf, then why doesn't the newlib documentation explain how to properly use printf? Because I cannot find anywhere in the newlib documentation where it says that printf will not do anything until you implement _write.










    share|improve this question
























      0












      0








      0








      I've spent the good portion of the last 10 hours trying to wrap my head around printf and how it's supposed to be properly implemented and I need some assistance.



      First off I would like to inform you that I am using printf from newlib. Whether there is another library out there that provides a variant of printf, I do not know, but just in case, this is where I am getting printf from.



      I want to understand how printf is supposed to work in an embedded environment. For example, I now know that printf will print a string of characters to the STDOUT. Here is my first question:



      1. What is considered STDOUT in an embedded system (MCU)?


      2. Will printf do nothing until I tell printf where to send the string of characters? According to different articles and forums, I am apparently supposed to use the function _write to redirect the formatted output from printf.


      3. If I am supposed to use _write to redirect printf, then why doesn't the newlib documentation explain how to properly use printf? Because I cannot find anywhere in the newlib documentation where it says that printf will not do anything until you implement _write.










      share|improve this question














      I've spent the good portion of the last 10 hours trying to wrap my head around printf and how it's supposed to be properly implemented and I need some assistance.



      First off I would like to inform you that I am using printf from newlib. Whether there is another library out there that provides a variant of printf, I do not know, but just in case, this is where I am getting printf from.



      I want to understand how printf is supposed to work in an embedded environment. For example, I now know that printf will print a string of characters to the STDOUT. Here is my first question:



      1. What is considered STDOUT in an embedded system (MCU)?


      2. Will printf do nothing until I tell printf where to send the string of characters? According to different articles and forums, I am apparently supposed to use the function _write to redirect the formatted output from printf.


      3. If I am supposed to use _write to redirect printf, then why doesn't the newlib documentation explain how to properly use printf? Because I cannot find anywhere in the newlib documentation where it says that printf will not do anything until you implement _write.







      newlib






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 23 mins ago









      cDreamercDreamer

      759




      759






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55001971%2fhow-to-properly-implement-printf%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55001971%2fhow-to-properly-implement-printf%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Runtime problems in TestNG asserts2019 Community Moderator ElectionHow do you assert that a certain exception is thrown in JUnit 4 tests?differences between 2 JUnit Assert classesHow do I use Assert to verify that an exception has been thrown?Best practice for Python assertWhat is the “assert” function?What does the Java assert keyword do, and when should it be used?What is the use of “assert” in Python?PHPUnit assert that an exception was thrown?What is “assert” in JavaScript?Asserting in testng using containing

          (unchecked) unchecked cast required: OnSuccessListener found: Uri2019 Community Moderator ElectionHow do I address unchecked cast warnings?Android AlarmManager for periodical sensor readingWhy don't Java's +=, -=, *=, /= compound assignment operators require casting?I am trying to set alarm on specific time using alarm manager but alarm initiated instantly?setText on button from another activity androidget around of error 'can not resolve symbol'Saving ToggleButton state in ListView by using SharedPreferencesAdding Social Media Share Logic From Firebase in Androidjava.lang.NullPointerException when invoking onLoadFinished()Search Firestore query don't show data in RecycleView

          1