2021-10-07 10:06 AM
Hi all,
We are currently using STM32CubeIDE projects autogenerated from STM32CubeMX as part of our development. The issue with STM32CubeIDE projects is that automating and scripting builds with it is cumbersome even with the CLI interface.
I would like to explore using the auto-generated makefile option but there seems to be no clear documentation on:
As a start I have played around with adding some source files into the generated makefile and re-generating after adding a new peripheral. At the moment the new source/includes required by the newly added peripheral would just be appended after the SRC list in the makefile. This works as a start but I don't think this is maintainable since it's not known which parts of the makefile are free to edit or will be replaced when the project is regenerated.
If anyone could share some tips or experiences from their own workflow that would be greatly appreciated.
2021-10-07 10:30 AM
If you add files to the project, and they're marked as source files, they will get added in the automatically generated makefile. You shouldn't have to or need to edit the makefile directly.
2021-10-07 10:44 AM
Hi thanks for answering!
By 'project' do you mean the STM32CubeIDE project?
I'm sorry for not being clear enough, I meant that I wanted to use the Makefile generation option directly from STM32CubeMX. In CubeMX I don't see any options for adding source files.
2021-10-07 10:57 AM
2021-10-07 11:04 AM
STM32CubeMX can generate a makefile but indeed no option to add source files (and includes and everything else).
Makefiles (*.mk) generated by CubeIDE with "external builder" options are artifact of Eclipse CDT "managed builder".
They can be tweaked, see the Eclipse CDT documentation.
IMHO for complex projects these *.mk files are not any better than a manually written makefile and should be avoided
(for example by using "internal builder).
Eclipse CDT has command line options for headless build, just use that.
2021-10-07 11:29 AM
I see, but doesn't using the headless build option still required you to basically install the whole eclipse executable? I'm concerned about the overhead required with this method since it would make it slow if we were to say do this in a docker instance.
2021-10-07 12:37 PM
> doesn't using the headless build option still required you to basically install the whole eclipse executable?
This is the simplest. Just install it in container (copy-install often works) and be done with it.