Skip to main content
Associate
Aug 13, 2024 2:48 PM UTC
Solved

How to clone/copy an STMCube Example project

Hello,

I'm new to STM32Cube-IDE (and Eclipse). Normally I use the ARM-gcc toolchain and do assembly coding.

I managed to create a New STM Project by using the Example Selector tab in the Target Selection window.

In this case it was the BSP Example for the B-U585I-IOT02A Discovery Kit (with the STM32U585 chip).

 

After modifying the code in accordance with how-to-use-semihosting-with-stm32cubeide  the code runs OK.

 

Now I would like to COPY the Project and edit that.

 

From the multiple "how to clone a project" threads it appears that this is not trivial. (?) One of the threads I read was from 2022 and IDE version 1.8. It seemed that multiple otherwise experienced developers found it odd that this wasn't a straightforward task.

 

Manually copying and search/replace seems very odd and error-prone.

Has there been any progress on automating this?

 

 

In my case there aren't even any .ioc or .project files.

 

As expected, the following don't work:

Simply copying the Project's directory (in the Workspace directory)

Using File->Open Projects From File System...

 

 

For now, I have created a new workspace and reimported the STM32Cube Example. But now I have to redo the edits and modifications to get the semihosting working again...

 

 

As an aside, at the end of the Example import I get the following (not very informative) error (which I ignore).

 

Screenshot 2024-08-11 at 02.02.14.png

 

This topic has been closed for replies.
Pavel A.
Pavel A.Best answer
Aug 13, 2024 6:19 PM UTC

This is very fast and straighforward:

1. Copy the project directory (so that it is on same directory level, to avoid relative issues)

2. Delete all eclipse dotted sub directories. Keep only .project and .cproject dot files.

2 Edit the .project file and change only the project name there. 

Done. Now import the new project into Eclipse and do REFRESH.

 

3 replies

Pavel A.
Pavel A.Best answer
Aug 13, 2024 6:19 PM UTC

This is very fast and straighforward:

1. Copy the project directory (so that it is on same directory level, to avoid relative issues)

2. Delete all eclipse dotted sub directories. Keep only .project and .cproject dot files.

2 Edit the .project file and change only the project name there. 

Done. Now import the new project into Eclipse and do REFRESH.

 

cc2Author
Associate
Aug 14, 2024 3:51 PM UTC

Thank you Pavel!

That was indeed pretty easy :)

In <proj-name>/STM32CubeIDE subdirectory I only had .osx.project (empty) and .settings/ (some prefs and language settings) in addition to .cproject and .project. I didn't bother deleting those.

File->Import->General->Existing Projects into Workspace  seems to have done the trick.

 

Senior
Jun 21, 2025 10:41 PM UTC

This method looked like it was going to work until I made my changes and tried to compile. I used ADC_MultiChannelSingleConversion as the example project and created My_ADC_MultiChannelSingleConversion following the steps described. I then wanted to add LPTIM1, but could not open the IOC file until I renamed it to match my project. After adding LPTIM1, I tried to build and got

make: *** No rule to make target 'C:/ST/Another_ADC_MultiChannelSingleConversion/Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_tim.c', needed by 'Drivers/STM32G0xx_HAL_Driver/stm32g0xx_hal_tim.o'. Stop.
make: *** Waiting for unfinished jobs....