Skip to main content
Harvey White
Senior III
February 6, 2022
Question

CubeMXIDE multiple definition bug still here

  • February 6, 2022
  • 12 replies
  • 3962 views

FreeRTOS project:

code generated includes code in Drivers/CMSIS/Device/ST/STM32F4x/Source/templates

File is of definitions, likely stm32F4xx.h

This conflicts with the file included at Drivers/CMSIS/Device/ST/STM32F4x/Include.

This seems to only happen when using FreeRTOS and CMSIS V2 interface.

Did you mean to include something like stm32F4xx.C in the templates location?

The information is redundant, giving me about 8 multiple definitions. Deleting the template file produces working code.

This has been around for a long while.

This topic has been closed for replies.

12 replies

ST Employee
February 11, 2022

Hello @Harvey White​ ,

Thanks for your feedback,

Could you please share your ioc file and specify the CubeMX version?

Thanks,

Sara.

Harvey White
Senior III
February 11, 2022

copied existing project into another directory and renamed it to avoid messing up existing project.

Project compiled properly.

opened IOC perspective and changed main memory heap assignment in FreeRTOS from 128000 to 120000.

Saved to generate code.

Duplicate file appears.

system_stm32f4xx.c

multiple definitions since a .c file is not protected.

did you mean to add system_stm32f4xx.h?

Note that this is a bit of a complicated project.

ST Employee
February 16, 2022

Hello @Harvey White​ ,

Does this issue still exists?

I couldn't reproduce it from my side.

Sara.

Harvey White
Senior III
February 16, 2022

The issue exists and can be reproduced here.

I can create a project that does not have this fault. At some point in project development, changing the IOC file, changing parameters in FreeRTOS, something gets triggered and CubeMXIDE decides that it needs to put that file in. It's only one file, it's only in one place, but after that is triggered, it's consistent.

If it were simple to reproduce, I might have figured it out and could have told you how to reproduce this problem.

All I can do is make some suggestions on how to find the problem.

1) What was the idea behind putting that system_stmf4xx.c file under the template folder? It seems to have no purpose (and if you wanted to put the .h file in, it might make more sense). The file does duplicate an existing file, so one of them (likely the template file) is just simply wrong.

2) if it is right, then what triggers the inclusion of that file? And what (also) triggers the existing file? Since the default must have that file included, and it isn't in the template folder by default, why is it there?

There has to be a set of conditions that cause that file to be included. The structure is there, the template folder is there, but the folder is empty. What code causes that to be put in?

3) what calls that code? Under what circumstances? Since when it gets included, it seems to stay included, that points to either a set of conditions that gets tripped, or perhaps a global in your code that is never initialized.

I can't answer these questions, someone needs to look at the code to find out what's going on. This is in the current version (1.8.0), and it's been in previous versions for the two to three years at least.

If your update completely installs the version, and does not leave older files behind, then this has persisted from version to version. If you leave older files behind, then it's possible that a completely new install would work.

Since you can't reproduce it with the IOC file, it has nothing to do with the IOC file itself, but much to with how the CubeMXIDE program treats the IOC data.

ST Employee
February 16, 2022

Hello @Harvey White​ ,

Did you try the CubeMX standalone version and got the same result ?

@mattias norlander​  could you please check this issue ?

Sara.

mattias norlander
ST Employee
February 25, 2022

I tried reproducing inside CubeIDE without success.

I also had a look at the ioc-file attached.

  • I cannot see any significant diff vs the ioc-file in my own test project.
  • It is not a general fault inside MX 6.4.0.
  • A re-install of the tools does not help.
  • We have not seen (to my knowledge) any similiar complaints from other users.

What else can we try?

Maybe the metadata stored on Harverys machine is "broken" leading to this issue?

You could try to delete the metadata stored by the tool this will force CubeMX/IDE to re-create new metadata. Should not effect your project. But still, make a back-up copy of the two folders below! Then close CubeIDE/CubeMX.

Then delete this folder:

  • C:\Users\MY_USERNAME\.stm32cubemx

Did not work? Delete this one too:

  • C:\Users\MY_USERNAME\.stm32cubeide

Does that make CubeMX behave as it should?

Harvey White
Senior III
February 25, 2022

I'll try backing up and deleting the folders in a while.

It may be important to note:

Generating the project under cubeMXIDE puts the copy of the file under templates. CubeMX, using the same IOC file, deletes the excess file, which can be seen when refreshing the project with F5. I do not remember CubeMX ever doing that particular behavior.

I do not expect to see a problem with CubeMX. The problem is within CubeMXIDE. I suggest looking (in IDE) for the code that builds the project tree, and specifically the system_stm<processor name> xx.c. There has to be a reason why the software is called to insert that file. It has to do with the FreeRTOS inclusion, I suspect. I do not think that the problem is in the IOC file at all, but rather specifically in CubeMXIDE. That bug has been there for a long while.

1) why is a file put under template? (I'm asking the program logic). Why is it needed? It's a duplicate of the files under core.

2) if the logic is being called twice, then what's calling it? Why?

3) is it program logic that has to do with FreeRTOS?

Harvey White
Senior III
February 16, 2022

CubeMX standalone *may* not generate the same error, but the code generation process gives me an error,

!SESSION 2022-02-16 11:32:29.245 -----------------------------------------------
eclipse.buildId=unknown
java.version=11.0.10
java.vendor=AdoptOpenJDK
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -application com.st.stm32cube.ide.common.services.mx.rcpApp -rmiServerPort 64063 -projectUpdate -buildType exec -src cube -cubeScratchFile C:\Users\madyn\OneDrive\Documents\Projects\ARM projects\PROJECT 20\PROJECTS\F469I_disco\F469I\mx.scratch
Command-line arguments: -os win32 -ws win32 -arch x86_64 -application com.st.stm32cube.ide.common.services.mx.rcpApp -data C:\Users\madyn\.stm32cubeide\.workspace_207863113403245355 -rmiServerPort 64063 -projectUpdate -buildType exec -src cube -cubeScratchFile C:\Users\madyn\OneDrive\Documents\Projects\ARM projects\PROJECT 20\PROJECTS\F469I_disco\F469I\mx.scratch
 
!ENTRY org.eclipse.osgi 4 0 2022-02-16 11:32:32.625
!MESSAGE Application error
!STACK 1
java.lang.NullPointerException
	at com.st.stm32cube.common.projectcreation.core.ProjectUtilities$ProjectRessourceVisitor.visit(ProjectUtilities.java:835)
	at org.eclipse.core.internal.resources.Resource.lambda$1(Resource.java:117)
	at org.eclipse.core.internal.resources.Resource.lambda$0(Resource.java:85)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:85)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90)
	at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:127)
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:94)
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:55)
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:117)
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:105)
	at com.st.stm32cube.common.projectcreation.core.ProjectUtilities$ProjectRessourceVisitor.getResources(ProjectUtilities.java:842)
	at com.st.stm32cube.common.projectcreation.core.ProjectUtilities.removeProjectOrphanLinkResources(ProjectUtilities.java:816)
	at com.st.stm32cube.ide.common.services.project.ProjectUpdateService.doProjectUpdate(ProjectUpdateService.java:53)
	at com.st.stm32cube.ide.common.services.project.HierarchicalProjectTreeSetupService.HierarchicalProjectTreeSetup(HierarchicalProjectTreeSetupService.java:138)
	at com.st.stm32cube.ide.common.services.project.HierarchicalProjectTreeUpdateService.doProjectUpdate(HierarchicalProjectTreeUpdateService.java:41)
	at com.st.stm32cube.ide.common.services.adapted.core.project.ProjectUpdateRcpServiceProcess.doProjectUpdate(ProjectUpdateRcpServiceProcess.java:245)
	at com.st.stm32cube.ide.common.services.adapted.core.project.ProjectUpdateRcpServiceProcess.doProjectUpdate(ProjectUpdateRcpServiceProcess.java:239)
	at com.st.stm32cube.ide.common.services.adapted.core.project.ProjectUpdateRcpServiceProcess.doProjectUpdate(ProjectUpdateRcpServiceProcess.java:170)
	at com.st.stm32cube.ide.common.services.adapted.core.project.ProjectUpdateRcpServiceProcess.run(ProjectUpdateRcpServiceProcess.java:121)
	at com.st.stm32cube.ide.common.services.mx.core.project.ProjectUpdateRcpService.doProjectUpdate(ProjectUpdateRcpService.java:171)
	at com.st.stm32cube.ide.common.services.mx.core.project.ProjectUpdateRcpService.run(ProjectUpdateRcpService.java:166)
	at com.st.stm32cube.ide.common.services.mx.update.MxUpdateProjectRcpService.run(MxUpdateProjectRcpService.java:111)
	at com.st.stm32cube.ide.common.services.mx.update.MxUpdateProjectRcpService.run(MxUpdateProjectRcpService.java:104)
	at com.st.stm32cube.ide.common.services.mx.rcp.CubeIdeServices.start(CubeIdeServices.java:93)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
 
!ENTRY org.eclipse.core.resources 2 10035 2022-02-16 11:32:32.655
!MESSAGE The workspace will exit with unsaved changes in this session.

the error log is above.

So I'm not sure that it's generating code or not.

This is the latest version of CubeMX.

ST Employee
February 17, 2022

Hello @Harvey White​ ,

Could you please share with us the CubeMX standalone log file (STM32CubeMX.log) located in C:\Users\<Your_User_Name>\.stm32cubemx and the CubeMX plugin log file (.ide.log) located in C:\Users\<Your_User_Name>\STM32CubeIDE\workspace_1.8.0\.metadata.

The one you shared is related to eclipse.

Please make sure to delete the .stm32cubemx before generating the code when using CubeMX standalone.

Thanks,

Sara.

Harvey White
Senior III
February 17, 2022

STM32CubeIDE\workspace_1.8.0 does not exist

STM32CubeIDE\workspace_1.3.0 does, but has an updated data of 8/11/2021

Can't find the plugin log file

CubeMX standalone does not generate the extra file.

Running the standalone version after running the IDE version, and then refreshing (F5) causes the extra file to vanish.

I've been updating the IDE as needed, but I'm not sure where the 1.8 workspace is now.

Could that be a problem?

ST Employee
February 17, 2022

Hello @Harvey White​ ,

The workspace is where the project is saved, when you create a new project using CubeIDE, either you use the default location or you can change it (please refer to the attachment).

0693W00000KZZO8QAP.pngThe workspace can be changed by selecting [File]>[Switch Workspace], So it is not an issue when the workspace_1.8.0 does not exist, please check where your projects are saved and you will find the .metadata folder.

Did the project compiled correctly when you used the CubeMX standalone and after refreshing the project ?

Please make sure that the workspace and the project names must contain only ascii characters. This is also valid for the path to the workspace.

Could you please try to re-install CubeIDE and reproduce the issue ?

Sara.

Harvey White
Senior III
February 17, 2022

I looked where you told me to look.

CubeMX standalone worked properly and did not put in the extra file.

CubeMX standalone warns of errors "but the code was generated successfully".

Please note that my file structure does not match yours because of backup concerns.

I have many different projects and workspaces I go between, which reference one common set of code.

attached, please find the .ide.log from that metadata file.

I shall try reinstalling CubeIDE