Re: SW4STM32 or CubeMX to init STM32 device
Hi Elliott,
I just had time to look at the way CubeMX generates System Workbench projects; we are discussing the way to improve this, but, in the meantime, it is possible to import the code generated by CubeMX under System Workbench, although some features of System Workbench (like the integration with source code control) will not work as seemlessly as usual. We will provide a migration tool later if needed.
There is in fact two possibilities, that all imply that Eclipse will work directly on the files generated by CubeMX, in the folder where there were generated (so do not delete them once integrated in System Workbench):
- Import the project in an existing workspace; in this cas you should follow the standard procedure, but ensure you do not check “Copy projects into workspace”
- Use the folder where CubeMX generated its code (the folder that contains Application, Drivers, Xxxx Configuration...) as your workspace and Import... the project from this folder (the “Browse” button in the Import... dialog should automatically open the proper folder)
In both cases you should then be able to compile your project as usual, but be careful:
- You may have to tailor the include search path for your project:
- If you create new source files (e.g. usermain.c and usermain.h in the Application/User folder), these will be created in the project itself, and will not be side-by-side with the CubeMX-generated files
- If you modify a CubeMX-generated file (e.g. main.c, to add an ‘#include usermain.h”’ line), it will be modified in its original location.
- Then your project will no more compile, as usermain.h, although it looks like it is, is not in the same folder than main.c; to correct that you must add Application/User to the list of include file directories (project >> Properties >> C/C++ General >> Paths and Symbols)
- Source code management
- You can use GIT for source code management directly from Eclipse, however
- When creating your local directopry you must not click the “Use or create repository in parent folder of project” but rather place it in the folder generated by CubeMX (the one that contains teh Application and Drivers subfolders)
- Several folders in the project view will remain marked as “non-versionned” (with a blue question mark) as long as you do not create a local file in them (git do not version directories, just files).
- You cannot directly use SVN for source code management of your project
- You should first manually import the whole CubeMX-generated folder in your SVN repository (for example by using TortoiseSVN)
- Then you may share your project from Eclipse, specifying as repository the root of your SVN repository (assuming you initially import everything in the trunk subfolder)
- You can use GIT for source code management directly from Eclipse, however
We apologize for the inconvenience; we are working with ST on a workaround to avoid these problems and smoothen your experience.