Skip to main content
Richard Benson
Associate
November 19, 2017
Question

bug in stm32cubemx 4.23 makefile generator

  • November 19, 2017
  • 7 replies
  • 2261 views
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
This topic has been closed for replies.

7 replies

Evandro Teixeira
Associate
November 28, 2017
Posted on November 28, 2017 at 12:03

I am also experiencing this problem.

Technical Moderator
November 28, 2017
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"".ThanksImen"
Michael Conners
Visitor II
December 2, 2017
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
Explorer
January 19, 2018
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)))
Vasile Guta_Ciucur
Senior
January 20, 2018
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
Associate
February 12, 2018
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

Richard Benson
Associate
February 14, 2018
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

Houda GHABRI
ST Employee
June 1, 2018
Posted on June 01, 2018 at 12:51

Hi

richardbenson91477

,

This issue will be resolved in next CubeMX release: 4.0.

Regards,

Houda