cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating hierarchical state machines (C-code) in STM32CubeIDE projects?

Kmax18
Senior II

Does anyone have experience with integrating hierarchical state machines (C-code) with a STM32CubeIDE project?

For example, the QP/C software by Quantum Leaps generates state machine C-code based on a graphical modeling tool. If the state machine diagram changes the C-code is re-generated: https://www.state-machine.com/qpc/index.html

How can this capability be integrated with the STM32CubeIDE?

  • In particular, if the state machine code is updated, how is the project source updated?
  • Also, if the STM32CubeMX files (.ioc) is updated and the project source is re-generated, how can the state machine code be protected? (I assume the IDE's USER CODE section can be used for that...)

Any feedback will be appreciated. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Neil
Super User

As far as CubeIDE is concerned, it's all just source files - it neither knows nor cares how those files were created.

So it's no different to files that you create manually yourself.

 

Place the files in a folder away from the CubeMX stuff to be sure that CubeMX won't mess with it.

 

PS:

for example, see:

https://community.st.com/t5/stm32cubeide-mcus/project-organisation-in-cubeide-how-to-go-about-libraries/m-p/734773/highlight/true#M31820

and:

https://community.st.com/t5/stm32cubeide-mcus/project-organisation-in-cubeide-how-to-go-about-libraries/m-p/734778/highlight/true#M31821

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

View solution in original post

5 REPLIES 5
Andrew Neil
Super User

As far as CubeIDE is concerned, it's all just source files - it neither knows nor cares how those files were created.

So it's no different to files that you create manually yourself.

 

Place the files in a folder away from the CubeMX stuff to be sure that CubeMX won't mess with it.

 

PS:

for example, see:

https://community.st.com/t5/stm32cubeide-mcus/project-organisation-in-cubeide-how-to-go-about-libraries/m-p/734773/highlight/true#M31820

and:

https://community.st.com/t5/stm32cubeide-mcus/project-organisation-in-cubeide-how-to-go-about-libraries/m-p/734778/highlight/true#M31821

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Pavel A.
Super User

@Kmax18 IMHO your question basically is: how to integrate Cube-generated code with your own code and/or code generated by other tools.

As @Andrew Neil wrote, there are BKMs for that. Unfortunate glitches in the Cube re-regeneration may happen, so keep your valuable code protected by version control.

 

Thank you, @Andrew Neil ! Your articles are very helpful.

Thank you @Pavel A., much appreciated. ("BKM" is Best Known Method, right?) 

Correct!