2020-08-02 01:50 AM
When generating code on an existing Makefile project any existing C_DEFS are corrupted
C_DEFS = \
-DUSE_HAL_DRIVER \
-DSTM32F301x8
becomes
-DC_DEFS = USE_HAL_DRIVER \
-DSTM32F301x8
so the definition of C_DEFS is lost and random errors result from the dangling defines.
This is on version 5.6.1 but is has been an issue for a long time (at least a year).
I've also seen other strange behaviour on Makefile - like "# compile gcc flags" gets repeated every time the code is generated - one makefile now has the string 15 times on one line!!
Another is -isystem for system include file path, CubemX insists on prefixing it with -I so it fails with -Iisystem ....
I'll save all the other bugs I've found for another day! - the above are the most annoying!
Solved! Go to Solution.
2020-08-02 03:31 PM
On further investigation it appears to be older IOC files that confuse CubeMX. Starting a project from scratch I have no issues but some projects originally generated 2 years ago have all these problems.
2020-08-02 07:15 AM
I don't think STM32CubeMX is meant to generate code over existing project Makefiles. It's meant to only work with its own generated code. The generated makefile has the following header:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
There are places within the IDE to add things like include paths and other definitions.
2020-08-02 03:31 PM
On further investigation it appears to be older IOC files that confuse CubeMX. Starting a project from scratch I have no issues but some projects originally generated 2 years ago have all these problems.