How to duplicate a ST32F4 Cube IDE project on another PC? - Page 1
Forum section: electronics / general

author: peter-h
author_rank: Super Contributor
timestamp: May 13, 2021, 08:38:03 am
content: I am posting this solved issue in case it helps somebody.Cube has many "Import" options, plus "Open file" options. However, while this should be absolutely totally bloody trivial, none of them worked. It would complain about Can't overwrite an existing project, or a button was greyed out without an explanation. Well, it was written in Java, and Java programmers are paid $10 per opcodeI have Cube v1.6.1 (the latest, I am not updating anymore) installed on two machines.The existing project is on one, under c:\projectname\project1.In it are these files and folders12/05/2021 18:53 169,656 .cproject05/10/2020 15:37 84,465 .cproject_org07/12/2020 19:00 1,744 .project05/10/2020 15:37 1,898 .project_org09/04/2021 20:51 <DIR> .settings09/04/2021 20:51 <DIR> CMSIS12/05/2021 18:53 <DIR> Debug09/04/2021 20:52 <DIR> HAL_Driver10/05/2021 16:24 <DIR> inc14/09/2020 15:55 447 Kxx-SWD.xml28/10/2019 12:41 440 Kxx.xml12/05/2021 18:58 6,673 LinkerScript.ld09/04/2021 20:52 <DIR> Middlewares10/05/2021 16:24 <DIR> src09/04/2021 20:52 <DIR> startup07/05/2021 11:39 8,916 TestCPPProject (1).launchand that seems to be standard.On the other machine I created c:\projectname\project1 and copied the above data there.Of course I googled all over the place, like everybody does, and this is a common issue, all over the place, but all the advice is old, from say 2017, when it was different software. Just different enough...Then I had an idea. Even when I copied the data into project2, hoping to import that into a project in project1 (project 1 dir did not exist at the time!) it complained that project1 already exists, so obviously there was some reference to "project1" in the project files... So, maybe Cube is storingproject configsomewhere elsealso, not within the above project directory (folder). Perhaps in the registry, which would be a bit messy to copy over. But it was simple. When I copied over the following rather usefully named directory (btw the original install was 1.4.0, then updated online to 1.6.1)C:\ST\STM32CubeIDE_1.4.0\STM32CubeIDE\configurationfrom the source machine to the target one (obviously with Cubenotrunning) and started up Cube on the target one, it just came up, whole project on-screenThe obvious implication, unless I am doing something wrong, is that to backup a Cube project you have to back up not just the project directory but also the above Configuration directory in c:\st.You might still have fun with the debugger not connecting, but again that one (esp. the cryptic "joined drives" error) is aaaallll oooover the internet tooOn the win10 machine it went away after some reboots, and ticking all the boxes for private and public networks for the debugger, when the win10 "do you want to give this thing access" window pops up.Win10 installs also don't show up the weird bug I get on win7-64, where you see a load of blank lines when the project is being built. Looks like a display driver issue.

author: DavidAlfa
author_rank: Super Contributor
timestamp: May 13, 2021, 09:41:40 am
content: Import...existing project.... Select your project folder.Then your project should show up, click on finish, done.Check the video for the T12 firmware, It shows exactly that:

author: peter-h
author_rank: Super Contributor
timestamp: May 13, 2021, 12:24:23 pm
content: Nope.That video is so fuzzy it is barely readable.Yes the project1 project did show up, but it would not import it. Maybe it has to first be Exported by the previous system?

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: May 13, 2021, 02:08:05 pm
content: Export mad import should probably work. Honestly though, you should look into git. I always make sure I can clone my projects to lay computer, and follow my README to get it up and running.I find it useful to document the setup while it is top of mind.Good luck!

author: tru
author_rank: Regular Contributor
timestamp: May 13, 2021, 03:15:56 pm
content: Quote from: peter-h on May 13, 2021, 12:24:23 pmIn the past I've encountered this very same problem. STM32CubeIDE will refuse to import when the project name is referenced in another project that already exists in your workspace, or referenced in another project that you're trying to import with the new one. This happens whenever I make a copy of an existing project and rename the project folder to say v2.The solution I've found that works is to manually edit (e.g. find and replace with NotePad++) the old project name references with the new project name within these files:.cproject.mxproject.project.iocAlso, the .ioc file needs renaming to the new project name.Then in STM32CubeIDE you can import using the "File/Open Projects from File System...", select the "Directory" button, browse to the root/parent folder of where your projects are stored in, then I prefer to "Deselect All" and tick only the projects I want to import.

author: peter-h
author_rank: Super Contributor
timestamp: May 14, 2021, 01:10:24 am
content: Yes that explains it completely.What a stupid system

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 14, 2021, 01:29:55 am
content: I do not care much for any particular IDE, and recently I wanted to experiment a bit with GRBLhal, and it also had a project file for some IDE that was unknown to me.I do not care much for makefiles either, but as long as the're short and simplistic they are sort of manageble, and they are also very portable. So I took a makefile I found somewhere and started tinkering a bit with it, and I got GRBLhal to compile (& flash & run) in a few hours time.Note that I'm a relative beginner with STM32. I have not tinkered with compiler flags in the attached makefile (yet). Currently they're just the same as what was already present in that "other" project.I'll share it here so you can do anything you wish with it.

author: peter-h
author_rank: Super Contributor
timestamp: May 14, 2021, 08:54:23 am
content: With today's fast PCs, an IDE is hardly needed and one could just compile and link with a batch file, or run a makefile which is how it was done since for ever. What you then don't get is the debugging environment which is really powerful nowadays.