Sysprogs forums › Forums › VisualGDB › Multiple Embedded Targets as Platform
- This topic has 5 replies, 2 voices, and was last updated 4 years, 6 months ago by codex653.
-
AuthorPosts
-
May 28, 2020 at 04:52 #28223codex653Participant
Hey there. I’ve been trying to figure out how to configure the platform manager to allow targeting multiple embedded devices. I’ve got a project that can run on several different MCU’s and I followed https://visualgdb.com/tutorials/porting/multiplatform/ to try and set up a multi-platform build system. I have found that when I edit the “Embedded Project” MCU selection in one platform, I’m forced to use it across ALL the embedded platforms, which doesn’t make much sense.
For a more concrete example, my project can currently run on 3 target platforms: STM32L432KB, STM32L432KC, and STM32F446RE. I have set up a platform for each of them and can select them in the configuration manager. What I expect to have happen is that each platform will build for its specific MCU, but I find that if I configure the L432KB to build, suddenly the F446RE will try and build as the L432KB. Is this supposed to be happening?
May 28, 2020 at 05:06 #28224codex653ParticipantIt looks like a combination of the .vcxproj, stm32.xml, and stm32.props are what drive which MCU target gets built for a given configuration. Currently each platform configuration is referencing the exact same stm32.props/.xml file, which is what is changing when I update the “Embedded Project” settings. It would seem like there could be support for multiple embedded targets, but I don’t see how to do that outside of manually editing the files, which sounds like a bad idea.
May 28, 2020 at 18:19 #28246supportKeymasterHi,
Indeed, the VC++-based embedded projects only support one target per project. This happens because different targets would have different subsets of source files, and the Visual C++ project system doesn’t have a good way to deal with it (other than always including all files and setting the ‘exclude from build’ flag for each configuration).
That said, we have just added support for custom configurations and platforms to the Advanced CMake Project Subsystem (see the announcement) and will include support for creating CMake-based embedded projects (that will support multiple targets) in the final v5.5 release (around a month more), so you will be able to configure the multi-platform layout you described.
May 28, 2020 at 18:40 #28249codex653ParticipantHmm that’s a bummer. I don’t actually use CMake as my build system (I tend to prefer Boost.Build), so I guess I’ll have to figure something out. I currently use compiler flags to enable/disable various files in the build system to get around the Visual C++ file limitations and it works ok for me.
I might just try converting some of the stm32.xml/props files such that it will switch things out correctly behind the scenes. I have multiple solutions that build as static libraries and then link into a larger project, so it would be very helpful to have built in support for multiple processors at the click of a button.
As another thought, am I able to invoke my own command line builds using VGDB? That way I could use the platform configuration to invoke the correct build command within my projects.
May 30, 2020 at 18:37 #28259supportKeymasterIf you don’t mind patching the .vcxproj files manually and forgoing the VisualGDB GUI for configuring the device, you can reorganize your code as follows:
- Create a shared items project using the regular VC++ project wizard.
- Move the Device-Specific files from the main project to the shared items project.
- Move the definition of MCUPropertyListFile from the main .vcxproj file to the shared items project.
- Manually edit the MSBuild files to define multiple VisualGDB-based platforms (see this tutorial)
- Manually set a Condition tag on the Import statement in the main .vcxproj file that imports the shared project, so that it is imported for a specific platform only.
- Rename the .vgdbsettings files and explicitly update their names via VS Project Properties.
- Create a separate combination of the following items for each device you would like to target:
- A shared files project
- A renamed property list file
- Renamed debug + release .vgdbsettings files
This will allow having multiple platforms in the same .vcxproj file, however the VisualGDB GUI for configuring MCU parameters won’t work anymore (you can still use it on a separate project and then manually copy the updated property sheet file and references to the BSP-specific sources from it).
You can find more documentation on MSBuild property sheets and MSBuild-based project structure here:
- https://visualgdb.com/documentation/projects/msbuild/propertysheets/
- https://visualgdb.com/documentation/projects/msbuild/
- https://visualgdb.com/documentation/embedded/stm32/
June 3, 2020 at 21:09 #28325codex653ParticipantThat’s some fantastic resources! Thank you.
-
AuthorPosts
- You must be logged in to reply to this topic.