<?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>8-bit MicrocontrollersのトピックRe: Importing Host File data into Codewarrior IDE</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Importing-Host-File-data-into-Codewarrior-IDE/m-p/171538#M11577</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response CompilerGuru.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your intepretation of the code is correct in that I was&amp;nbsp;targeting&amp;nbsp;windows with my code. At the time of my posting I was trying to see if my algorithm could be implemented using CodeWarrior but the target was windows because I didn't have a compiler for windows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I corrected the array addressing&amp;nbsp;as you described and I didn't include the fclose in my posting. Forgive me for my lack of attention to detail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Dec 2010 07:48:10 GMT</pubDate>
    <dc:creator>Kimo</dc:creator>
    <dc:date>2010-12-28T07:48:10Z</dc:date>
    <item>
      <title>Importing Host File data into Codewarrior IDE</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Importing-Host-File-data-into-Codewarrior-IDE/m-p/171536#M11575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to develop an algorithm within the CodeWarrior IDE that is shipped with the DEMOQE development board.&amp;nbsp;I'm using Windows XP Pro 2002 SP3 with CodeWarrior Development Studion for Microcontrollers V6.0 Release, build 7134-30May07.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to import the contents of a file into an array and this is what I have thus far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;hidef.h&amp;gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* for EnableInterrupts macro */&lt;BR /&gt;#include "derivative.h"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* include peripheral declarations */&lt;BR /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/P&gt;&lt;P&gt;void MCU_init(void);&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Device initialization function declaration */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void main(void){&lt;BR /&gt;&amp;nbsp; MCU_init();&lt;BR /&gt;}&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* call Device Initialization */&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; int i = 0, N = 128;&lt;BR /&gt;&amp;nbsp; FILE *fpin;&lt;BR /&gt;&amp;nbsp; unsigned int data, source[128];&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; if((fpin = fopen("lc_350x_450y_100w_775i.txt","r")) == NULL){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\nError...opening input file!\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit();&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; for(i=1; i&amp;lt;=N; i++){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(fscanf(fpin, "%X", &amp;amp;data) != EOF)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; source [i] = data;&lt;BR /&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; for(;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* __RESET_WATCHDOG(); by default, COP is disabled with device init. When enabling, also reset the watchdog. */&lt;BR /&gt;&amp;nbsp; } /* loop forever */&lt;BR /&gt;&amp;nbsp; /* please make sure that you never leave main */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I compile the code above I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error: C2450: expected: ~ (IDENT auto const extern register static typedef volatile __interrrupt&lt;/P&gt;&lt;P&gt;main.c&amp;nbsp; line 16&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone explain how I can correct this error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note that the closing brace after function MCU_init() was to eliminate a previous error the compiler flagged.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any insights that can be provided. All the best to everyone and happy holidays!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 04:28:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Importing-Host-File-data-into-Codewarrior-IDE/m-p/171536#M11575</guid>
      <dc:creator>Kimo</dc:creator>
      <dc:date>2010-12-22T04:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Host File data into Codewarrior IDE</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Importing-Host-File-data-into-Codewarrior-IDE/m-p/171537#M11576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Undo that fix, the brace ends the main function to early.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is that in C90 you cannot just declare variables anywhere in a function (that works in C++ or in C99 only), instead the variables have to be declared before all the statements. So move the int i;... block before the call to MCUInit, and it should compile better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if you are targeting a S08 or a CF, but the use of file IO to read from the host, or to use exit may work or not, not sure. The code seem to be more targeted for a host environment that for an embedded target.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW: Some issues in the code (there are more):&lt;/P&gt;&lt;P&gt;- The code does not close the file.&lt;/P&gt;&lt;P&gt;- The code writes beyond the end of the allocated array (writes to source[128] which does not exist).&lt;/P&gt;&lt;P&gt;- fscanf may also return 0, which is an unhandled error condition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 06:48:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Importing-Host-File-data-into-Codewarrior-IDE/m-p/171537#M11576</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2010-12-22T06:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Host File data into Codewarrior IDE</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Importing-Host-File-data-into-Codewarrior-IDE/m-p/171538#M11577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response CompilerGuru.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your intepretation of the code is correct in that I was&amp;nbsp;targeting&amp;nbsp;windows with my code. At the time of my posting I was trying to see if my algorithm could be implemented using CodeWarrior but the target was windows because I didn't have a compiler for windows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I corrected the array addressing&amp;nbsp;as you described and I didn't include the fclose in my posting. Forgive me for my lack of attention to detail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Dec 2010 07:48:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Importing-Host-File-data-into-Codewarrior-IDE/m-p/171538#M11577</guid>
      <dc:creator>Kimo</dc:creator>
      <dc:date>2010-12-28T07:48:10Z</dc:date>
    </item>
  </channel>
</rss>

