Red State Machine: Sotware State Machine -> Generate Code Bug -> initialState

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Red State Machine: Sotware State Machine -> Generate Code Bug -> initialState

224 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jmcruz on Mon Jun 09 13:30:22 MST 2014
I started working with the RSM Software State Machine.

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.

The error occurs in the generated code file (made by RSM), on line:

Error: initializer element is not constant =>  static state currentState = initialState;/* Initialize the current state. */

I think the error is because initialState is a variable in flash and not a constant defined as such.

Is it a bug or should I change something in the existing code to avoid the error?

Many thanks in advance, best regards.

Juan
0 Kudos
1 Reply

184 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JoeHale on Mon Jun 09 14:59:00 MST 2014
Hi Juan,

This is a bug in our code generator - sorry! See this Stack Overflow question for details:

http://stackoverflow.com/questions/21592494/initializer-element-is-not-constant-error-for-no-reason-...

To fix the code please replace the following line (line 13 in your screenshot):
static state currentState = initialState; /* Initialize the current state. */


with

static state currentState = S_STATE_1; /* Initialize the current state. */


Where S_STATE_1 is the value assigned as the initial state in line 12.

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.

This bug will be fixed in the next release of LPCXpresso.

All the best,

Joe Hale
0 Kudos