Skip to main content
Paolo Andreuzza
Associate III
August 28, 2019
Question

Prebuild and post build step deleted when the project is regenerated from CubeMx

  • August 28, 2019
  • 10 replies
  • 5416 views

I've created a project in the STM32CubeIDE environment, using the STM32CubeMX integrated configurator (STM32CubeIDE Version: 1.0.2, STM32CubeMX Version: 5.3.0).

I have added in project configuration a prebuild step that calls bat file that collect some information from the source control management tool, and put them in some #define in an include file, and a post build step that calls an other bat file to rework the just created binary file.

At this point, if I change something in the CubeMX (just an IO config is enought, for example) and I regenerate the code, the pre build and post build settings are deleted.

This is a very annoying beheviour, because it doesn't allow to automate the workflow. Are there any workarounds to bypass this beheviour?

thank you

Paolo

P.S. I've realized just now that exist an other post for the same issue for stand alone version of CubeMX and ATOLLIC TrueStudio here: https://community.st.com/s/question/0D50X0000A4mi6iSQA/stm32cube-v50-overwrites-postbuild-steps-when-generating-truestudio-project-files

This topic has been closed for replies.

10 replies

Markus GIRDLAND
ST Employee
August 29, 2019

I can't seem to reproduce this issue so I might need more details.

Here's what I did:

  1. Created a new project for F4 Discovery board.
  2. Added "myBat.bat" in Debug folder which had "mspaint" as its only content as a pre-build step.
  3. Added "echo "End of test"" as a Post-build step.
  4. Build the project, everything is working as expected. Paint is opened, when I close it the build continues and ended with an "End of test" at the end of the build.
  5. Toggled a few settings in the .ioc editor and regenerated the code
  6. Build the project and result was the same as in step 4.

If you do the same steps I do, what result do you get?

If you get the same result I did...

Is there a specific MCU this happens on? A specific command? If you only have an echo "Hello world" as a pre-build step in your current project does that get deleted as well?

Any additional details would be helpful!

Paolo Andreuzza
Associate III
August 29, 2019

Thanks for your answer, Markus.

Doing some tests, suddenly all starts to work correctly, even in my workstation.

After a moment of bewilderment, I restart the test from the beginning and I get point.

If you keep open the tab with the ioc file in the STM32CubeIDE, all works correctly trought the code rigeneration.

Please, try the following steps:

  • After the project creation, be sure that the ioc tab in the IDE is close.
  • Change the pre build step
  • Open again the ioc editor clicking twice in the ioc file in the project explorer pane (it should appear a window with a progressbar that say someting like "Initilizing Device configuration tool..." for a second or less).
  • Now change somenthing in the configuration, push the generate button in the toolbar (the button with the gear icon)
  • Close the ioc tab and now check the project settings. The pre build step should be gone.

If you check, not only the Build steps are deleted but even other settings, such as Environment variables definition.

I hope you can reproduce the issue, because it is very annoyng. It doesn't allow to automate the workflow, that, instead, is a very important thing in professional.

Please, let me know if you can reproduce the issue, it's very important to me to find a way to make this work.

Thank you.

Paolo

Paolo Andreuzza
Associate III
August 29, 2019

Markus, let me add an other information.

If you try to:

  • add a build configuration (when the IOC editor is closed),
  • open the configurator clicking twice on the ioc file,
  • change something
  • rigenerate the code

the build configuration that you have just added disappear!:astonished_face:

EDIT: Same behaviour using the configurator in the stand alone version

Markus GIRDLAND
ST Employee
August 29, 2019

There we have it, I was able to reproduce! The secret behind it is that you need to have had the ioc editor closed, then open it (with the "Initializing Device configuration tool") and then it will regenerate in a wrong way, even deleting my "myBat.bat" in the Debug folder!

I'll write a ticket for this immediately. Thank you for the report, Paolo!

Paolo Andreuzza
Associate III
August 29, 2019

This is a good news.

Thank you for support, Markus.

I hope in a quick fixing and release of the new version.

Is it already scheduled the next release? Is it public the roadmap of STMcubeIDE?

DJohn.13
Associate
September 4, 2019

This problem also affects Include files added to the properties editor (properties>C /C++ General>Path and Symbols>Includes) and to the Environmental Variables ( properties>C /C++ Build>Environment). Most likely anything changed in the properties>… editor will be lost once the .ioc file is closed and then later opened with changes made.

NPato
Associate III
September 13, 2019

Also linker script gets reset, silently loosing any custom changes. What a fun afternoon it was finding some of this out :(

Paolo Andreuzza
Associate III
September 16, 2019

Yes. this is a very big issue!

It seems that all the project settings are reset to default (and so linker scripts), and this make the tool almost unusable, even more if you have a high level of project's customization.

I hope ST releases quickly a fixed version .

Markus GIRDLAND
ST Employee
September 16, 2019

I think I wrote in another thread that this is fixed in our current unreleased weekly build already. However, the other features bundled with it is not ready for release just yet. It will be released soon.

Paolo Andreuzza
Associate III
October 23, 2019

Version 1.1.0 of STM32CubeIDE seems to work correctly.

Thank you

Markus GIRDLAND
ST Employee
October 23, 2019

I'm glad to hear it. It was listed as a fixed issue in the release note as:

"71371 - Pre- and post-build steps, build configuration, and non-STM32CubeMX generated files inside project and others get deleted when project is regenerated."

So hopefully it stays fixed as well. The MX team, like I suspected, prioritized this very highly to get the fix in ASAP.

If you run into anything like this in 1.1.0 then please @ me on the forum.

Paolo Andreuzza
Associate III
October 23, 2019

Ok. Thank you again!

MChri
Visitor II
May 16, 2020

Has this issue been fixed yet? I have been using SW4STM32 to avoid this problem, but I would really rather use STM32CubeIDE if it worked properly...

Paolo Andreuzza
Associate III
May 18, 2020

yes, this issue been fixed. It works from STM32CubeIDE version 1.1.0.

Paolo

roger239955_stm1
Associate III
September 29, 2021

Still not fixed.

It just happened to me.

All the include paths were remove.

I didn't check whether it also deleted / cleared the protected user code blocks

Graduate
September 19, 2023

Nice that the same bug still exists since 2019. Free tool that costs more on lost working time than a license for whatever. :\ I am fixing my include paths and libraries the second time now.