<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software SolutionsのトピックHow can I get printf output and vprintf output to go the same place during debugging?</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-can-I-get-printf-output-and-vprintf-output-to-go-the-same/m-p/229545#M6231</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Environment:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tower kit using twrk60d100m processor board&lt;/P&gt;&lt;P&gt;&amp;nbsp; Using MQX 4.0.2 and CW 10.5.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Using J-Link or on-board (USB) JTAG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; The application has printf statements and also vprintf statements in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf output shows up on the debug console&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; vprintf output disappears&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My research results so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp; printf ends up using a routine that writes to the console (and uses SEMIHOSTING SWI) to send characters - these appear on the debug console under CW debug&lt;/P&gt;&lt;P&gt;&amp;nbsp; vprintf tries to use the kernel table-&amp;gt;active task-&amp;gt;stdout file pointer (which is NULL) and because of a test for NULL, throws away all the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question:&lt;/P&gt;&lt;P&gt;&amp;nbsp; How can I get the vprintf output to show up on the debug console?&lt;/P&gt;&lt;P&gt;&amp;nbsp; Failing that, how can I get the printf and vprintf output to show up in the same place?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Nov 2013 17:36:46 GMT</pubDate>
    <dc:creator>Symbolic</dc:creator>
    <dc:date>2013-11-26T17:36:46Z</dc:date>
    <item>
      <title>How can I get printf output and vprintf output to go the same place during debugging?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-can-I-get-printf-output-and-vprintf-output-to-go-the-same/m-p/229545#M6231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Environment:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tower kit using twrk60d100m processor board&lt;/P&gt;&lt;P&gt;&amp;nbsp; Using MQX 4.0.2 and CW 10.5.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Using J-Link or on-board (USB) JTAG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; The application has printf statements and also vprintf statements in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; printf output shows up on the debug console&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; vprintf output disappears&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My research results so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp; printf ends up using a routine that writes to the console (and uses SEMIHOSTING SWI) to send characters - these appear on the debug console under CW debug&lt;/P&gt;&lt;P&gt;&amp;nbsp; vprintf tries to use the kernel table-&amp;gt;active task-&amp;gt;stdout file pointer (which is NULL) and because of a test for NULL, throws away all the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question:&lt;/P&gt;&lt;P&gt;&amp;nbsp; How can I get the vprintf output to show up on the debug console?&lt;/P&gt;&lt;P&gt;&amp;nbsp; Failing that, how can I get the printf and vprintf output to show up in the same place?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2013 17:36:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-can-I-get-printf-output-and-vprintf-output-to-go-the-same/m-p/229545#M6231</guid>
      <dc:creator>Symbolic</dc:creator>
      <dc:date>2013-11-26T17:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get printf output and vprintf output to go the same place during debugging?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-can-I-get-printf-output-and-vprintf-output-to-go-the-same/m-p/229546#M6232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephen,&lt;/P&gt;&lt;P&gt;Please have a look at my attached "hello.c" file that can be placed into your MQX4.0/mqx/examples/hello2 folder.&lt;/P&gt;&lt;P&gt;Assumptions are RTOS user_config.h has&amp;nbsp; &lt;SPAN style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG&gt;#define&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; BSPCFG_ENABLE_IODEBUG 1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;The BSP tower header file modified with following (I tested this on my TWR-K20D72M using OSBDM interface):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Please look at comments "//DES" in source file.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#ifndef BSP_DEFAULT_IO_CHANNEL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #if BSPCFG_ENABLE_IODEBUG&amp;nbsp; //DES was BSPCFG_ENABLE_TTYB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define BSP_DEFAULT_IO_CHANNEL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "iodebug:"&amp;nbsp; //IDE debug console&amp;nbsp; //DES was "ttyb:"&amp;nbsp;&amp;nbsp;&amp;nbsp; /* OSJTAG-COM&amp;nbsp; polled mode&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define BSP_DEFAULT_IO_CHANNEL_DEFINED&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define BSP_DEFAULT_IO_CHANNEL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endif&lt;/P&gt;&lt;P&gt;#else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* undef is for backward compatibility with user_configh.h files which have already had it defined */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #undef&amp;nbsp; BSP_DEFAULT_IO_CHANNEL_DEFINED&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define BSP_DEFAULT_IO_CHANNEL_DEFINED&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;In summary from the hello.c file:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7f0055; font-size: 10pt;"&gt;&lt;STRONG&gt;#if&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; CUSTOMER_CODE2 &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES 1=test,0=default code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;errmsg( &lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"%s %d %s\n"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"Failed"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;, 100, &lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"times"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; ); &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;//DES Note: without the "\n" &lt;SPAN style="text-decoration: underline;"&gt;errmsg&lt;/SPAN&gt; doesn't display the message (unless another &lt;SPAN style="text-decoration: underline;"&gt;printf&lt;/SPAN&gt; used with "\n"). With the "\n" it displays OK.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;#endif&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My console window shows:&lt;/P&gt;&lt;P&gt; Hello&lt;/P&gt;&lt;P&gt; World &lt;/P&gt;&lt;P&gt;Error: Failed 100 times&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;David&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2013 19:07:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-can-I-get-printf-output-and-vprintf-output-to-go-the-same/m-p/229546#M6232</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-12-20T19:07:03Z</dc:date>
    </item>
  </channel>
</rss>

