AnsweredAssumed Answered

CubeMX makefile issue + makefile template

Question asked by ST Renegade on May 30, 2017
Latest reply on Apr 3, 2018 by Sirma Siang

Hi guys,


CubeMX supports makefile generation starting from 4.21.0 version. I've tested the makefile, however, there are some issues:


Major issues:

- missing header files dependency (make won't update the output in case a header file is updated)

Minor issues:

- the arm-none-eabi-xxx path is by default /arm-none-eabi-xxx destination (instead of arm-none-eabi-xxx, so the user has to define the path while calling make)


There might be other issues, however I haven't stumbled on them for now. I've opened this discussion to help update the makefile for future CubeMX release which would fit all!


For those who are interested as I was already working on my own makefile, I would like to share it. It inherits some ideas from here & there and includes dependency generation (described here: GNU Makefile Auto-Dependency Generation).


Makefile template description:

- the makefile has to reside in the root of your project folder

- c-files, h-files, asm-files and linker script file are searched automatically (no need to update the makefile once you add new sources under the project folder)

- the system builds *.o files out of the found files into folder defined by OBJDIR macro

- the system builds *.d (dependency) files as a side effect of the compilation and puts them into folder defined by DEPDIR macro

- the system builds $(TARGET).elf, $(TARGET).hex & $(TARGET).bin into OBJDIR folder


As I'm not an expert on all the GCC tools, there might be bugs in my makefile (missing compiler option/macro etc. wrong approach). So feel free to comment on my makefile so we can tune it up for future use and support ST in their work!


Thank you very much and have a nice day,

ST Renegade