Trouble implementing HSM #33
-
Hello, Kiishor! First, I'd like to congratulate and thank you for your UML State Machine project, it's a miracle for working with embedded systems. Second, I'm having some issues trying to implement the framework on a STM8S MCU system that I'm working on. I'm using ST Visual Develop IDE on Windows 10 and the thing is, the only C language version that the enviroment allows is C90 (ANSI C) so I keep on getting some errors. One of them is about where the constant expression declarations are made and the other one is about the variable array size that I need to use in the framework for my UML Statechart. I read that those two are limitations that this C version imposes and I wanted to know how I can deal with these problems. Maybe changing my development enviroment could fix these issues by letting me use a newer C, like C99 but I'm not certain. About ANSI C limitations: A possible workaround the varible array size problem: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
hi guys, |
Beta Was this translation helpful? Give feedback.
-
Hello felipefl142, Thanks for your feedback. If you are not able to use C99 or a newer standard, then
However, I could not understand the issue related to windows that you can't use the Posix thread library. I'm not sure how it is related to my state machine framework. Best regards, |
Beta Was this translation helpful? Give feedback.
-
Hello again, Image 1 Best Regards, |
Beta Was this translation helpful? Give feedback.
-
Hi, it seems like it works now. I just need one thing, to associate InfraRed Remote commands with the events. I already have a interrupt routine to receive the commands (4 bytes in total). Just need to know where/how do I make the IR interrupt to trigger my enumerated events. Can you help me? |
Beta Was this translation helpful? Give feedback.
Hello felipefl142,
Thanks for your feedback.
Yes, both the errors you mentioned will be fixed if you use C99 or a newer standard. I hope your development environment supports the newer C standard. I strongly advise you to switch to a newer C standard.
If you are not able to use C99 or a newer standard, then
Disable variable-length array
You can disable VLA by defining HSM_USE_VARIABLE_LENGTH_ARRAY to 0. then you need to also define MAX_HIERARCHICAL_LEVEL.
MAX_HIERARCHICAL_LEVEL should be the highest hierarchical nesting level among all the state machines in your project. This is explained in my readme file.
https://github.com/kiishor/UML-State-Machine-in-C#disable-variable-length-array
…