Multiple Embedded Targets as Platform

Sysprogs forums Forums VisualGDB Multiple Embedded Targets as Platform

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #28223
    codex653
    Participant

    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?

    #28224
    codex653
    Participant

    It 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.

    #28246
    support
    Keymaster

    Hi,

    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.

    #28249
    codex653
    Participant

    Hmm 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.

    #28259
    support
    Keymaster

    If 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:

    1. Create a shared items project using the regular VC++ project wizard.
    2. Move the Device-Specific files from the main project to the shared items project.
    3. Move the definition of MCUPropertyListFile from the main .vcxproj file to the shared items project.
    4. Manually edit the MSBuild files to define multiple VisualGDB-based platforms (see this tutorial)
    5. 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.
    6. Rename the .vgdbsettings files and explicitly update their names via VS Project Properties.
    7. 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:

     

    #28325
    codex653
    Participant

    That’s some fantastic resources! Thank you.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.