I admit that I have (a few? or not so few) bad habits: one of it is that usually I find a way to do things, and if that works, I stick with it. I know that there are other ways to do things, but hey, why bother? And sometimes a good friend asks an excellent question (are there any bad questions?), and this let me review the way I’m doing things. And here is such a thing: exporting and importing projects in Eclipse.
Archive Files with Drag & Drop
Here is how I usually move or copy a project to another machine:
- Find the project place on my hard disk. An easy way is to select the project folder and use the context menu with Show in Windows Explorer
- Zip that project into an archive file
- Delete from that archive file any derived resources (see Dissection of MCU10 Projects), as well remove all the version control information.
- Copy the archive file into the destination workspace and unzip it there
- Then drag&drop that folder into Eclipse: this will import that project into the workspace. Instead of the folder I simply can drag&drop as well the .project file
Note: Best if I drag&drop the project into the ‘CodeWarrior Projects’ View. This will not work if I drop it into the Processor Expert ‘Project Panel’ view.
Well, that works, and I really get used to that process. So why bother? Because there is actually a better way: to Export and Import.
The Export and Import Way
- I select one or more project and use the ‘Export’ context menu or File > Export. Here I select General > Archive File:
- In the ext dialog I can deselect files and folder. Additionally I need to specify the archive file. I could use Filter Types(e.g. to include *.c and *.h), but really what I wish is that this dialog would consider the ‘derived’ flags for files and folder, so I could deselect them easier.
- In the destination workspace, I use the menu File > Import:
And here is the stumbling point: I do not (!) select ‘Archive File’, but ‘Existing projects into Workspace‘. Yes, I have exported it as Archive File, but Importing an Archive File is importing an archive file inside a project, not (!) as a project. Yes, this is a usability quirk in Eclipse :-(.
- In the next dialog I can choose the archive file and make adjustments which project I want to import. I note that it will automatically copy the projects into my workspace.
- Pressing Finish, and my projects get imported.
Summary
I’m using combinations of both ways: the archive file produced by the Export is not different from an archive file I create with my WinZip archive utility (or any other tool like this one). For both export ways I need to manually remove what I do not want in the archive file. I wish there would be better support for this. But for importing projects the Import functionality is really good, as it avoids the copy/extract/drag&drop way: I can go through two dialogs, and that’s it.
Happy Export-Import 🙂
PS: Thanks to Mark Ruthenbeck having me considering more the Export/Import way!
I have a question for you that I could really use some help with. I have tried to use this procedure to import and export projects between two installations of Codewarrior for MCU V10.2 (Eclipse) on different computers (both windows). When I clean and rebuild the project on the pc I transfer the project to, it will only build the last configuration that was used (FLASH OR RAM). I develop by using RAM most of the time, then deploy by programming to the FLASH, so I really need these two configurations. When I try to build the nonworking of the two configs, I get the following error (for example):
E:\CW MCU v10.2\gnu\bin\mingw32-make -j16 all
mingw32-make: *** No rule to make target `../Project_Settings/Linker_Files/MCF52259_Internal_Flash.lcf’, needed by `PATH_PLAYER_6_20_12.elf’. Stop.
The one workaround I have is to build the other config on the other PC and copy to file “MCF52259_Internal_Flash.lcf” or “MCF52259_Internal_Ram.lcf” (depending upon which one it’s missing) to the “/Project_Settings/Linker_Files/” folder on the PC I’ve transferred the project to. Have you tried building the “other” configuration once you’ve moved the file?
Thank You,
Cory
LikeLike
I have not had this kind of problem, and my projects sometimes contain as well a ‘RAM’ and a ‘Flash’ configuration. The “no rule to make target” means that this .lcf file mentioned in the error messages does not exist (see https://mcuoneclipse.wordpress.com/2012/03/12/no-rule-to-make-target/).
Is this project a Processor Expert one? If yes, this means that usually the .lcf file is generated. Then your error message indicates that the .lcf file has not yet been generated, and is missing.
Other hints:
if you import a project, make sure you do a ‘clean’ (menu Project > Clean). You need to do this for every configuration (Ram, Flash).
I hope this helps.
Erich
LikeLike
Have you done any importing of classic projects? In 10.1, you could do this through the import menu. Now in 10.3, it seems that they have removed the option. Is there another way to do this, or have they just done away with this?
LikeLike
Yes, that option is gone in 10.3. And I think for good reasons. That importer only worked for very simple projects. As soon as you have a little bit more complex project, the result was not what I expected, or compilation failed. It is much easier to simply create a new project with the wizard for the desired architecture, and then adding the source files to the project. No wizard needed for something like this.
LikeLike
I’m trying the importing the Freedom_Shell.zip (internally dated 12/28/2012) with KDS 1.1.0 and its having problems. Then I try and bring up the component inspector and it has a java.lang.NullPointerException
Really appreciate you publishing the code though.
LikeLike
Hi neilh20,
that zip file is very, very old, and for CodeWarrior, not for KDS. Please use the up-to-date examples on GitHub for KDS, e.g. https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KL25Z/FRDM-KL25Z_NeoShield is featuring the Shell.
LikeLike
In step #2, how do you deal with the warning message:
“Some of the selected projects have build settings that have file dependencies outside of the project directory. Exporting those projects will cause those settings to become invalid.”
?
I know I have some absolute paths occurring in some of the .metadata files, but do I need to manually edit those files outside of Eclipse and replace each occurrence of such path?
Thanks
LikeLike
Hi Barak,
you don’t need to worry about the .metadata content: this is used internally to Eclipse only. But if your projects are using project relative path settings, then if you use these projects in a different workspace, you need to make sure that the settings and structure match what you have in the original project. There is no ‘silver bullet’: this always depends how you (or someone else) has architected the project structure and references.
LikeLike
The CW isn’t very friendly when it comes to projects and workspaces.
I had to port a project located in drive E on my PC, to a different PC which had no E.
I ended up mapping drive E on that other PC, which seemed to be faster than trying to figure out what I might have “mis-architected” in the project.
Thank you for your help!
LikeLike
Hello Erich,
Because of some reasons, I have to move my whole toolchain from CW to Eclipse.
Please tell me how to do it? I am using ARM Cortex M4 based MCU, gcc compiler and Multilink Universal P&E for debugging.
LikeLike
What Eclipse distribution are you going to use? There is KDS, but now there is the MCUXpresso IDE (https://mcuoneclipse.com/2017/03/28/mcuxpresso-ide-unified-eclipse-ide-for-nxps-arm-cortex-m-microcontrollers/). Of course you could build your DIY IDE too. I have ported many of my CodeWarrior projects, and what has worked the best for me is:
– create a new project for the device in then new IDE
– copy the source files over
Usually, after 10-15 minutes with updating search paths/etc everything is ported.
I hope this helps,
Erich
LikeLike
thanks for the reply!
What is DIY IDE??
I am using Eclipse Neon.3 distribution.
I am not sure, if I have to use “cross gcc” tool chain or GNU autotool chain or MinGW based tool chain while creating a project for NXP Kinetis MCU (ARM Cortex M4).
I thought, it must be MinGW (correct me if I am wrong). So, I am trying to integrate the MinGW with eclipse now.
Please let me know, if it is correct.
Also, will it be possible to debug the code over Eclipse using Multilink Universal P&E??
LikeLike
DIY == Do-It-Yourself, see for example https://mcuoneclipse.com/2013/07/20/dyi-free-toolchain-for-kinetis-part-1-gnu-arm-build-tools/
If using Eclipse Neon.3, then I recommend you have a look at MCUXpresso IDE.
And no, don’t use MinGW for this, this is a minimal GNU environment for Windows, but not intended for cross development. You need the GNU ARM Embedded (aka formerly launchpad) toolchain, as explained in above DIY series.
I wrote another one for MARS: https://mcuoneclipse.com/2015/09/04/going-to-mars-building-a-diy-eclipse-ide-for-arm-embedded-microcontrollers/
I did that for OXYGEN too, but have not written a tutorial for it. Maybe I should?
LikeLike
Thanks Erich,
Actually, MCUExpress seems to be paid. I am trying to shift the dev and debug process to open source like Eclipse that will come cheap/free.
I could not find the update/installation that could integrate the Universal Multilink P&E debugger with Eclipse neon.3. Any idea how to get interface the debugger with eclipse?
LikeLike
MCUXpresso IDE is free and code size unlimited. There is a paid option for advanced trace, but I don’t think you need it?
Installation of P&E debugger into Eclipse is described here: https://mcuoneclipse.com/2013/07/22/diy-free-toolchain-for-kinetis-part-3-debugger-gdb-server-with-pe-and-segger/
LikeLike