cancel
Showing results for 
Search instead for 
Did you mean: 

bug in stm32cubemx 4.23 makefile generator

Richard Benson
Associate
Posted on November 19, 2017 at 21:26

(I'm sorry if this is the wrong place to report this)

STM32CubeMX 4.23 (tested with MacOS High Sierra, Arch Linux x86_64 with x32 binary emulation) is generating spurious entries during Makefile generation (such as Src/main.c and various other files listed twice) which causes link errors such as:

'.../Src/usb_device.c:63: multiple definition of `MX_USB_DEVICE_Init'

build/usb_device.o:.../Src/usb_device.c:63: first defined here'

The temporary fix is to remove any multiple entries from the Makefile, then all compiles and links (apparently) correctly.

Apologies If there's something wrong with my setup that is causing this, granted I've seen it reported elsewhere when searching for solutions to these errors

#stm32cubemx #bug #4.23
10 REPLIES 10
Evandro Teixeira
Associate II
Posted on November 28, 2017 at 12:03

I am also experiencing this problem.

Imen.D
ST Employee
Posted on November 28, 2017 at 12:23

Hello,

This issue is already raised internally to CubeMx team to fix it.

Thank you for your contribution.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Michael Conners
Associate
Posted on December 02, 2017 at 13:37

I also experienced this problem on linux STM32Cube version 4.23.0. Oddly I generated a makefile in the Windows version 4.22.1, and it generated a Makefile that worked fine on linux, I only had to change the BINPATH to point to my gcc tools.

Thanks,

Mike

Jyrki Koivisto
Associate
Posted on January 19, 2018 at 15:37

Running on Linux (Fedora 27) and I also have this duplicate source issue: Fixed it with this hack on /usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/db/plugins/projectmanager/templates/Makefile.tpl

It's not nice but the sort removes duplicates.

# list of objects

OBJECTS = $(sort $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))))

vpath %.c $(sort $(dir $(C_SOURCES)))

# list of ASM program objects

OBJECTS += $(sort $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))))

vpath %.s $(sort $(dir $(ASM_SOURCES)))
Posted on January 20, 2018 at 11:01

Yep, that was reported, including the fact that SOURCES_DIR may contain also .c files (at least, main.c and stm32l1xx_it.c)

Jeanne Joly
Senior III
Posted on February 12, 2018 at 15:18

hello

richardbenson91477

,

Evandro Teixeira,

Koivisto.Jyrki

and

Guta_Ciucur.Vasile

,

I confirm theissue of duplicated source files when CubeMX generates the code with makefile.

As you say, the workaround is to suppress every duplicated source files and it compiles and links successfully after.

Sorry for the inconvenience it may cause.

Our development teams are working on that point, I will keep you inform as soon as the correction is available in a CubeMX release.

BR. Jeanne

Posted on February 14, 2018 at 04:31

Excellent, thanks

On Mon, Feb 12, 2018 at 2:18 PM, Jeanne Joly <st-microelectronics@jiveon.com

Posted on February 14, 2018 at 15:11

OK thank you!

Posted on February 14, 2018 at 17:37

Finally! Thank you as well!

The real problem is, when

Koivisto.Jyrki

published this very handy hack, the reaction of the CubeMX developers was to hide the Makefile.tpl in the next (actual at the post date) version of the Cube. Fortunately, the software still looks for the file in it's designated folder and takes it into account if it finds it there, so you can place there the file from the previous version. I continued to work this way, thanks to

Koivisto.Jyrki

. and to the programmer that kept this option alive. Thank you to both of them, is the reason that I still continue using STM32, despite you know what...