2021-10-01 05:35 AM
I have a multi target project.
My targets are STM32L152CB and STM32L152RC. I use Ubuntu 20.4 with STM32CubeMX 6.3.0.
Since STM32CubeMX does not natively support multiple targets I've decided to have two cube projects in the same folder. The generated files are the same since both targets use the same pins and peripherals and have the same core. The only difference is the processor type. Common application code will be in a seperate folder from the generated code and the project files.
The first problem I encountered was that you cannot rename the .cproject, .project and .mxproject files. They are nameless and I couldn't find an option in STM32CubeMX to add a name. Therefore they will overwrite the existing files from the other target, so you cannot have both project files in the same folder. My workaround was to place the ioc files in seperate target folders.
My second problem is that now each target folder has a copy of all the sources. I want all the sources in one place. The ioc file has several path options under ProjectManager. But changing them is of no use since the configuration is overwritten when I open it and click generate. I thought I would have more flexibility through the command line interface. However if I put in
this command I get an error:
generate code /home/user/git/myproject/projects
Error:
Exception in code generation java.lang.StringIndexOutOfBoundsException: begin 10, end 11, length 0
I tried putting the path in quotes, removing the final slash and changing the slashes. Nothing helps.
Am I stuck having two complete copies of the same project with only one parameter difference? Or is there a way to make it work natively with this tool? If not is there a workaround? One workaround I could think of is to write a script which would run cube MX and then modify the paths in the project files and move the generated folders. I do not prefer this workaround since it probably won't be cross platform and would require a lot of work.
Solved! Go to Solution.
2021-10-07 12:59 AM
My problem/annoyance is that I have to manually select the launch configuration when debugging. via the drop down menu instead of pressing F11. Even if I just build for build configuration A it can select launch configuration B if that one was used before. I wish I could select a target which would group the build and launch configuration together so that clicking build would build for that target and clicking debug would debug for that target.