<?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>topic Re: Semihosting problem with IMXRT1050-EVKB on MCUXpresso IDE in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Semihosting-problem-with-IMXRT1050-EVKB-on-MCUXpresso-IDE/m-p/784187#M613</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chalupka&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since SWO is not connected by IMXRT 1050 - EVKB by default, semihosting by SWO or SWO&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;"&gt;trace &lt;/SPAN&gt; can not be used as it is.&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;As an alternative interface, Windows recognizes the COM port (LPUART 1).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;If you want to Change the Standard IO to LPUART, please see "utilities\io\swo\fsl_io.c" in FSL SDK.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;T.Kashiwagi&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Oct 2018 04:34:05 GMT</pubDate>
    <dc:creator>Takashi_Kashiwagi</dc:creator>
    <dc:date>2018-10-17T04:34:05Z</dc:date>
    <item>
      <title>Semihosting problem with IMXRT1050-EVKB on MCUXpresso IDE</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Semihosting-problem-with-IMXRT1050-EVKB-on-MCUXpresso-IDE/m-p/784186#M612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot seem to read from a file when using semihosting in the MCUXpresso IDE v10.2.1 with the IMXRT1050-EVKB.&lt;/P&gt;&lt;P&gt;I followed the step-by-step guide and successfully ran the "Hello world" example on the board. The board is connected via USB to my Windows 7 PC.&lt;/P&gt;&lt;P&gt;I've set the library/header type to "Newlib (semihost)" via the the quick settings. And added some fopen(), fprintf() and fscanf() routines to the example (the whole project including the changed hello_world.c is attached).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The thing the main program now should do is to open a file, write "Hello World!" to it, read the contents of the file again to strings and print it out on stdout. But, I get only garbage when reading from the file. When I examined the file, I found that the writing had worked correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program's output is:&lt;/P&gt;&lt;PRE&gt;[[MCUXpresso Semihosting Telnet console for 'evkbimxrt1050_hello_world_file LinkServer Debug' started on port 56900 @ 127.0.0.1]

+b&amp;nbsp; ðÿÿÿÿÿÿÿÿ&amp;nbsp; .


[Closed Telnet Session]&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The string is supposed to be the string "Hello World!", as read from the file. Is this a known problem with the semihosting? Is there an update or at least a workaround? Reading from files is essential for our demo applications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: With the redlib (semihost) library, even file opening does not work at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, I cannot attach the project fie because the site won't let me ("An unexpected error has occurred. Please make sure that your session did not expire while viewing this page."). So I added only the relevant content of hello_world.c at the end of this post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;/*!
&amp;nbsp;* @brief Main function
&amp;nbsp;*/
int main(void)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; char ch;
&amp;nbsp;&amp;nbsp;&amp;nbsp; FILE *myfile;
&amp;nbsp;&amp;nbsp;&amp;nbsp; char mystrings[2][10];

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Init board hardware. */
&amp;nbsp;&amp;nbsp;&amp;nbsp; BOARD_ConfigMPU();
&amp;nbsp;&amp;nbsp;&amp;nbsp; BOARD_InitPins();
&amp;nbsp;&amp;nbsp;&amp;nbsp; BOARD_BootClockRUN();
&amp;nbsp;&amp;nbsp;&amp;nbsp; BOARD_InitDebugConsole();

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Write to file */
&amp;nbsp;&amp;nbsp;&amp;nbsp; myfile = fopen("tmp.txt", "w");
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (myfile == NULL) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fprintf(stderr, "Could not open file for writing\n");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; fprintf(myfile, "hello world.\n");
&amp;nbsp;&amp;nbsp;&amp;nbsp; fclose (myfile);

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Read from file */
&amp;nbsp;&amp;nbsp;&amp;nbsp; myfile = fopen("tmp.txt", "r");
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (myfile == NULL) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fprintf(stderr, "Could not open file for reading\n");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; fscanf(myfile, "%s %s", mystrings[0], mystrings[1]);
&amp;nbsp;&amp;nbsp;&amp;nbsp; fclose (myfile);

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Print file's contents */
&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("%s %s.\n\n", mystrings[0], mystrings[1]);

&amp;nbsp;&amp;nbsp;&amp;nbsp; while (1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ch = GETCHAR();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUTCHAR(ch);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Oct 2018 10:32:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Semihosting-problem-with-IMXRT1050-EVKB-on-MCUXpresso-IDE/m-p/784186#M612</guid>
      <dc:creator>tobias_chalupka</dc:creator>
      <dc:date>2018-10-12T10:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Semihosting problem with IMXRT1050-EVKB on MCUXpresso IDE</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Semihosting-problem-with-IMXRT1050-EVKB-on-MCUXpresso-IDE/m-p/784187#M613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chalupka&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since SWO is not connected by IMXRT 1050 - EVKB by default, semihosting by SWO or SWO&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;"&gt;trace &lt;/SPAN&gt; can not be used as it is.&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;As an alternative interface, Windows recognizes the COM port (LPUART 1).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;If you want to Change the Standard IO to LPUART, please see "utilities\io\swo\fsl_io.c" in FSL SDK.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;T.Kashiwagi&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2018 04:34:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Semihosting-problem-with-IMXRT1050-EVKB-on-MCUXpresso-IDE/m-p/784187#M613</guid>
      <dc:creator>Takashi_Kashiwagi</dc:creator>
      <dc:date>2018-10-17T04:34:05Z</dc:date>
    </item>
  </channel>
</rss>

