cancel
Showing results for 
Search instead for 
Did you mean: 

How can I duplicate a project in STM32CubeIDE?

msch
Associate III

I have a project in a workspace in STM32CubeIDE, generated with STM32CubeMX. I would like to duplicate the entire project, including the .ioc information, to use as the starting point for a new project. How can I do this? I am amazed that this topic does not seem to be covered in the STM32CubeIDE User Guide.

If I copy and past the project in the STM32CubeIDE Project Explorer window, it does create a new project, but many names are still those of the old project, and various files are still referencing the old project.

This is such a common task to want to accomplish. How can there not be a straightforward way to do it?

25 REPLIES 25
NEdom.1
Associate III

There is a way to copy an existing STM32CubeIDE project into another one with a new name and completely independent of the existing project. This is very useful when you want to use an existing project as a template for another application development. Just show how I do it.

Step 1, copy the existing project work folder, for example "freeRTOS_F429_SDRAM", and paste using a new name, for example "freeRTOS_F429_SDRAM_LwIP" in your STM32CubeIDE workspace.

Step 2, rename the "freeRTOS_F429_SDRAM.ioc" file inside the new folder "freeRTOS_F429_SDRAM_LwIP" into “freeRTOS_F429_SDRAM_LwIP.ioc�?.

Step 3, open file ​".cproject" in the new folder "freeRTOS_F429_SDRAM_LwIP" with a text editor tool, such as Notepad++ or Editplus. Find and replace all old project name occurrences "freeRTOS_F429_SDRAM" with your new project name "freeRTOS_F429_SDRAM_LwIP".

Step 4, open file ".project" in the new folder "freeRTOS_F429_SDRAM_LwIP", and replace "freeRTOS_F429_SDRAM" occurrence with new name "freeRTOS_F429_SDRAM_LwIP".

Step 5 (optional???), open file ".mxproject" in the new folder "freeRTOS_F429_SDRAM_LwIP" and replace all old project name occurrences "freeRTOS_F429_SDRAM" with your new project name "freeRTOS_F429_SDRAM_LwIP". This step is not necessary as I think, because in some duplications of my projects I forgot to do it and it does not matter.

Last step, open the workspace the new project folder is located in, and import the new copied project. You may check the source files' properties to make sure they are pointed to your new project folder.

It's very interesting, thank you!

It seems easy to automate, and therefore interest ST so that they integrate it into CubeIDE.

Pecre.1
Associate

ok, I have an easy solution in 5 steps that I write down here to be sure to retrieve it and follow progresses.

1/ Clean your original project (not 100% needed but things will be faster)

2/ Duplicate the full project directory with a different name

3/ From STM32IDE delete your original project from the STM32IDE project explorer (NOT DELETING FROM DISK!!!!)

4/ In STM32IDE: File/Import/General/Existing projects into Workspace. Select the copied directory, tick the box of your copied project and click finish

5/ Right click on your new project in IDE Project Explorer and rename according to your taste (this IS the trick)

If you want to work back on your original project you can now re-import the original project by opening the original directory in the step 4 above.

Enjoy!

SWent.1
Associate II

A STM32 project can be copied using manual steps:

1) right click on project name "copy"

2) Paste "in default location" and give your project a new name

3) edit the .ioc file using "text editor" and change 2 references: eg: (using RTC as an example name)

ProjectManager.ProjectFileName=RTC.ioc

ProjectManager.ProjectName=RTC

4) save file and rename to RTC.ioc

Now you should be able to open RTC.ioc with the normal ioc editor.

SWent.1, your method worked for me. What I also discovered is that your method can be executed in File Explorer. That is: (1) go to and open the workspace folder, (2) locate the project folder you wish to duplicate. copy it, paste it, and rename it (to ***, for instance), (3) open the *** project folder, locate old_project.ioc file, rename it to ***.ioc, and open it with a text editor, (4) locate and edit ProjectManager.ProjectFileName=***.ioc and ProjectManager.ProjectName=***. (5) To run the project, open STM32CubeIDE, File -> Import... -> Existing Projects into Workspace -> Select root directory -> Browse... and select the new project folder -> Projects: click the new project -> Finish. This of course is just SWent.1's work from a Windows file explorer perspective. The reason I am rehashing it is because: since this work can be done within the Windows file system, a script could execute it. That would make it nearly painless. If one of you with scripting skills would like do do this, I'm sure the community would be grateful.

Adding to the steps by FMadi.1 (Community Member)

(1) go to and open the workspace folder

(2) locate the project folder you wish to duplicate.

Do a Project->Clean

copy it, paste it, and rename it (to ***, for instance)

(3) open the *** project folder, locate old_project.ioc file, rename it to ***.ioc, and open it with a text editor. Locate and edit ProjectManager.ProjectFileName=***.ioc and ProjectManager.ProjectName=***

(4) locate old_project Debug.launch file, rename it to *** Debug.launch, and open it with a text editor. Replace text "old_project" with new project name "***"

(5) To run the project, open STM32CubeIDE, File -> Import... -> Existing Projects into Workspace -> Select root directory -> Browse... and select the new project folder -> Projects: click the new project -> Finish.

(6) Build the new project and verify the correct naming of the executable files.

(7) Verify that in the STM32CubeIDE, Debug Configurations the new project is correctly referenced in all the fields. Select the *** Debug Configuration to debug the project.