Skip to main content
scottSD
Senior III
March 20, 2020
Solved

What is the best way to duplicate a project in a workspace in Stm32CubeIDE?

  • March 20, 2020
  • 7 replies
  • 20668 views

Using Stm32CubeIDE 1.3.0...

When I Copy and Paste a project in the Project Explorer (and name differently), it does copy the project. I also renamed the CubeMX IOC file to match the new project name. Then I did a Clean and a new Build.

However, when I go to Debug, I get a number.

To verify that the new project is using the new project paths I do a "Close" on the first project, then rename the old project in Windows Explorer.

Builds fine, but when debugging it is complains that it can't find source files.

It is still looking for the source files in the original project.... I changed the source lookup path in the Debug Configurations > Source to look in this project, and it still cannot find the files.

And when checking if there are any files in the new project's Debug folders, they are indeed empty.

 Does anyone have an idea how to fix this?

Best answer by scottSD

I did get this to work following the following steps:

1) Edit > Copy.

2) Edit > Paste.

3) Rename the ioc files.

4) Delete the Debug.launch file.

5) Project > Clean.

6) Generate the CubeMX.

7) Project > Build Project.

8) Debug As Stm32 Application.

9) And debug the application.

7 replies

Pavel A.
Super User
March 20, 2020

IMHO the quickest, most reliable procedure to fix such errors is :

* close the project

* delete it in eclipse (this will only remove the project from workspace and purge the accumulated debris)

* import it again into the workspace

* Refresh, clean, rebuild index

* build

-- pa

scottSD
scottSDAuthorBest answer
Senior III
March 20, 2020

I did get this to work following the following steps:

1) Edit > Copy.

2) Edit > Paste.

3) Rename the ioc files.

4) Delete the Debug.launch file.

5) Project > Clean.

6) Generate the CubeMX.

7) Project > Build Project.

8) Debug As Stm32 Application.

9) And debug the application.

LMI2
Senior III
March 22, 2020

With Keil, I simply copy and paste project folder. I get something like old_project_copy folder, then I rename only the folder name. Files inside keep their names. When I changed file names too, I got errors.

scottSD
scottSDAuthor
Senior III
April 2, 2020

@LMI2​  I appreciate the input. I am using Stm32CubeIDE and this post is tagged for it as well.

inotec
Associate
March 14, 2021

Below cloning works, but I found that in my case it deletes src folder in the old project, so that file needs to be copied back to the old project! Do this by making 2 copies…

1) Copy and paste 2 copies

2) Rename new folder (Copy 2)

In new folder…

3) Rename the ioc files.

4) Delete the Debug.launch file

5) Open IDE project in MXIDE

6) Rename project

7) Project > Clean.

8)Build

9)Open .ioc

10) Generate the CubeMX. THIS will delete src folder in the original folder.

11) So delete the original folder and change name of –Copy folder  back to the original name

12 Project > Build Project.

13) Debug and test

AKall.2
Visitor II
September 13, 2022

Remember to have the project in debug configuration set active, otherwise for me it causes missing source files upon trying to debug.

inotec
Associate
September 13, 2022
Thanks for the help
Rajat
Visitor II
April 7, 2023

To copy an STM32CubeIDE project:

1. Make sure the new name does not exist in the workspace, if it does, then

delete it inside the IDE. Make sure old project is error free.

2. Copy the folder in explorer

3. Rename the folder in explorer

4. Edit .project using vi or other text editor and rename

  <name>OLD_PROJECT_NAME</name> to <name>NEW_PROJECT_NAME</name>

  in line 3

5. Edit .cproject

  Change all references from OLD_PROJECT_NAME to NEW_PROJECT_NAME

6. Start IDE by clicking on .project

7. Import should start automatically.

8. Use your new project and enjoy!

inotec
Associate
April 7, 2023

Thank you, Rajat!

Very helpful!

BMcKe.2
Associate II
June 29, 2024

Duplicating a Project in STMCubeIDE

  1. Go to ProjectClean and clean the project you want to duplicate.
  2. Go to  FileNewSTM32 Project from an Existing STMCubeMX Configuration File .ioc.
  3. Select the .ioc file from the project folder that you want to duplicate.
  4. Type in a name for the new project. Create the new project.
  5. Open the CoreSrcmain.c  in the new project.
  6. Select All and then delete the entire contents of the file.
  7. Open the CoreSrcmain.c  of the original project, Select All the contents and Copy.
  8. Return to the new empty main.c file and Paste the contents of the old file in it.
  9. Save All.

Check that everything works in the new project by doing a Build.

Explorer II
August 30, 2025

Been trying to do this for a while. You'd have thought just copying & pasting the project in the IDE would handle this (knowing it's dealing with an entire project!?) ... but ....errrr.... no.

This method worked great BMcKe.2.where previous suggestions posted in this thread failed for me.