Usage of project import for debugger settings

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Usage of project import for debugger settings

      Hi,

      Recently I found out it is possible to include partial project files into a Segger Embedded Studio project. I found out his allows me to include a file just specifying some debugger configurations.

      E.g:

      XML Source Code: debugger_config.xml

      1. <!DOCTYPE CrossStudio_Project_File>
      2. <!--
      3. Debugger configuration
      4. Note: only one configuration can be added. If multiple configurations exist only
      5. the last configuration will be used.
      6. Run git update-index <hyphen><hyphen>skip-worktree debugger_config.xml
      7. before changing this file to prevent changes from being committed.
      8. Refresh the project in Embedded Studio after changing this file to apply changes.
      9. Examples:
      10. -->
      11. <!-- Debug using JLink Server -->
      12. <!-- <configuration
      13. Name="Debugger"
      14. hidden="Yes"
      15. Connection="IP 127.0.0.1 19022"
      16. />-->
      17. <!-- Debug using Jlink connected over USB -->
      18. <configuration
      19. Name="Debugger"
      20. hidden="Yes"
      21. Connection="USB"
      22. />
      Display All

      XML Source Code: project.emProject

      1. <!DOCTYPE CrossStudio_Project_File>
      2. <solution Name="project" target="8" version="2">
      3. <project Name="project">
      4. ...
      5. </project>
      6. <configuration Name="Debug" inherited_configurations="Debugger" />
      7. <import file_name="debugger_config.xml"/>
      8. </solution>

      IMO this is a great feature allowing to configure custom debug configurations in different environments. As mentioned in the comments, changes to the debugger_config.xml can be ignored by version control systems, allowing custom configurations without constant changes to the project file.

      However, I also found that on some occasions Embedded Studio changes the import line to be:

      XML Source Code

      1. <configuration Name="Debug" inherited_configurations="Debugger" />
      2. <configuration
      3. Connection="USB"
      4. Name="Debugger"
      5. file_name="debugger_config.xml"
      6. hidden="Yes"
      7. version="2" />
      Is there a way to prevent this from happening? Would there be a better approach to achieve the same result?

      Even better would be an import feature that only imports a file if it exists, allowing the file to be ignored altogether. This is a lot easier than dealing with ignoring changes.

      I'm hoping to release a project that uses this approach. Are there any risks of this "feature" not working in future versions of Embedded Studio?

      It would also be great if Embedded Studio could support commenting and uncommenting code blocks in XML files. Currently the commenting feature of ES only uses C style line comments. This would allow quick switching between different debugger settings, e.g J-Links with different serial numbers.
    • Hello,

      Thank you for your inquiry.
      The import feature is only meant to be used with complete .emProject files and not xmls.
      The behaviour on .xmls that only specify partial configurations is undefined.

      Instead we recommend using the templates feature in your solution.
      You can specify it as:

      XML Source Code

      1. <solution Name="Nordic_nRF5340_TracePins" target="8" version="2" templates_file="your_project_template.xml">
      An example for this you can find in the Embedded Studio folder under Targets/project_templates.xml
      This is for example used to generate any of the projects when you use the project wizard.
      Documentation of templates can be found here:
      studio.segger.com/index.htm?ht…e_project_file_format.htm

      seppe wrote:

      t would also be great if Embedded Studio could support commenting and uncommenting code blocks in XML files. Currently the commenting feature of ES only uses C style line comments. This would allow quick switching between different debugger settings, e.g J-Links with different serial numbers.
      Currently not planned. But we can add it to the wishlist.

      Best regards,
      Nino
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi Nino

      I tried this, but I don't think it works the way I want it to.

      My goal is to have one project that has different debugger configurations on different systems. As far as I can see, the configuration in the template is copied when creating a new project, it is not "included".

      E.g I want to have the same project on 2 computers. On one computer debuggers are connected over USB, on the other they are connected over IP. I use the git version control system, and I sometimes have to make changes to the emProject file. I don't want the different debugger configurations to end up in the emProject file because.

      This project is also be shared with other people, that could have entirely different debugger setups. Having a build config for every use-case isn't a very clean solution.
    • Hello,

      To achieve this you can do one of the following two things.

      1. Either leave the host Connection field empty. This will default then to USB, so if only 1 J-Link is connected to the PC it will work out of the box. For IP setups the initial connection will fail and ask if the network should be searched for J-Links.

      2. You can write a solution file which configures the specific host connection settings. This solution then imports the actual project with all the other settings.
      That way you only have to maintain the "outer" solution variants with the different host connections while the project setup stays the same for all.

      Best regards,
      Nino
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • I'm aware of the automatic searching and USB selection you describe in option 1, but I have a setup with multiple devices connected to multiple computers.

      I often use a debugger on a remote computer in a lab. I have Jlink server running for each device using a specific port depending on the purpose or type of device. I don't want to select the correct device every time and I certainly don't want it to assume the device attached to my laptop is the device to debug on. By explicitly creating multiple debug profiles I can easily select what device I want to debug on.

      Option 2 seems like it would achieve what I'm trying to do. It's a bit opposite to how other IDEs deal with debugger configs, but can be documented. My main concern is that it could create confusion regarding the project files. AFAIK both should have the emProject extension, one would be the "outer" solution while the other would be the inner project, but in order to meet the file format spec I believe it would also need it's own solution... If the wrong project is opened, the debugger configuration will not be loaded.

      Is there any documentation on how to create an "outer" solution?, i.e a solution that only imports other projects??