<?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 Red State Machine: Sotware State Machine -&amp;gt; Generate Code Bug -&amp;gt; initialState in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Red-State-Machine-Sotware-State-Machine-gt-Generate-Code-Bug-gt/m-p/592447#M30002</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by jmcruz on Mon Jun 09 13:30:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I started working with the RSM Software State Machine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;First I edited my first state machine RSM program, then I generated the code, then I integrated the generated code with existing code, but the compiler accuses an error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error occurs in the generated code file (made by RSM), on line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Error: initializer element is not constant =&amp;gt;&amp;nbsp; static state currentState = initialState;/* Initialize the current state. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the error is because initialState is a variable in flash and not a constant defined as such.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it a bug or should I change something in the existing code to avoid the error?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks in advance, best regards.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Juan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:48:39 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:48:39Z</dc:date>
    <item>
      <title>Red State Machine: Sotware State Machine -&gt; Generate Code Bug -&gt; initialState</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Red-State-Machine-Sotware-State-Machine-gt-Generate-Code-Bug-gt/m-p/592447#M30002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by jmcruz on Mon Jun 09 13:30:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I started working with the RSM Software State Machine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;First I edited my first state machine RSM program, then I generated the code, then I integrated the generated code with existing code, but the compiler accuses an error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error occurs in the generated code file (made by RSM), on line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Error: initializer element is not constant =&amp;gt;&amp;nbsp; static state currentState = initialState;/* Initialize the current state. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the error is because initialState is a variable in flash and not a constant defined as such.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it a bug or should I change something in the existing code to avoid the error?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks in advance, best regards.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Juan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:48:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Red-State-Machine-Sotware-State-Machine-gt-Generate-Code-Bug-gt/m-p/592447#M30002</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Red State Machine: Sotware State Machine -&gt; Generate Code Bug -&gt; initialState</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Red-State-Machine-Sotware-State-Machine-gt-Generate-Code-Bug-gt/m-p/592448#M30003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by JoeHale on Mon Jun 09 14:59:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Juan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a bug in our code generator - sorry! See this Stack Overflow question for details: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F21592494%2Finitializer-element-is-not-constant-error-for-no-reason-in-linux-gcc-compilin" rel="nofollow noopener noreferrer" target="_blank"&gt;http://stackoverflow.com/questions/21592494/initializer-element-is-not-constant-error-for-no-reason-in-linux-gcc-compilin&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To fix the code please replace the following line (line 13 in your screenshot):&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;static state currentState = initialState; /* Initialize the current state. */&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;static state currentState = S_STATE_1; /* Initialize the current state. */&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where &lt;/SPAN&gt;&lt;STRONG&gt;S_STATE_1&lt;/STRONG&gt;&lt;SPAN&gt; is the value assigned as the initial state in line 12.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately this fix will get overwritten everytime you regenerate your code from the state machine, so you'll need to fix it after each regeneration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This bug will be fixed in the next release of LPCXpresso.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All the best,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Joe Hale&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:48:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Red-State-Machine-Sotware-State-Machine-gt-Generate-Code-Bug-gt/m-p/592448#M30003</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:48:40Z</dc:date>
    </item>
  </channel>
</rss>

