Configurations when using Git and external diff tool with SES 3

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

  • Configurations when using Git and external diff tool with SES 3

    Hi, I use

    - STM32F4, STM32L4 Discovery boards (ST-Link is converted to J-Link)

    - SES 3.26 (with 64-bit Windows 10 machine & MacBook Pro Sierra 10.12)

    - J-Link Plus

    - J-Link 6.16 driver

    - Git 2.13.3

    - SourceTree 2 as Git GUI client


    In the SES documents, it says;
    SEGGER Embedded Studio has no facility to create repositories from scratch, nor to clone, pull, or checkout repositories to a working copy: it is your responsibility to create a working copy outside of SEGGER Embedded Studio using your selected command-line client or Windows Explorer extension.
    So I will use SourceTree to version the SES projects. I have some questions when using Git.

    1. What should be listed in the gitignore file for ignoring SES specific files which don't need versioning, such as emSession file, jlink file?



    I'm not asking about the ignoring ELF, HEX, MAP, object (.o, .d) files which are commonly ignored .


    2. Do SES files, such as emProject or more, use different line endings (LF) which depend on what OS is used?

    Or all of these files use the same LF regardless of the OS?

    I use both 64-bit Windows 10 machine and MAC Sierra machine.


    In case of Keil MDK-ARM 5 , the UVPROJX, UVOPTX project files use Unix style LF.

    Since Windows uses CRLF , I typed this command

    Source Code

    1. $git config --local core.autocrlf false



    when using Keil MDK.

    Similarly, do I need to configure autocrlf as false when using SES?



    3. Can Meld or P4Merge be configured as an external diff tool of SES?




    In other words, if I specify the directory of P4Merge.exe in the "Diff Command Line - Value" without parameters ($localfile, $remotefile, etc),

    can I diff my C source files?

    -Best Regards, Matthew
    -Best Regards, Matthew
  • Hello Matthew,

    Sorry for the delay in response.

    1. What should be listed in the gitignore file for ignoring SES specific files which don't need versioning, such as emSession file, jlink file?

    As you suspected the .emSession and .jlink file can be completely ignored an deleted even should you want to zip the project at some future point.
    They get generated anew each time you start ES and a debug session respectively.

    2. Do SES files, such as emProject or more, use different line endings (LF) which depend on what OS is used?

    Or all of these files use the same LF regardless of the OS?


    ES uses OS specific line endings for the .emProject file generation which would lead to different line endings once you edit the project under a different OS.

    3. Can Meld or P4Merge be configured as an external diff tool of SES?


    Yes this is possible. You will get a "VCS" option when configured correctly in the right click menu or under Project > VCS in the drop down menu.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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.
  • SEGGER - Nino wrote:

    Hello Matthew,

    Sorry for the delay in response.

    2. Do SES files, such as emProject or more, use different line endings (LF) which depend on what OS is used?

    Or all of these files use the same LF regardless of the OS?


    ES uses OS specific line endings for the .emProject file generation which would lead to different line endings once you edit the project under a different OS.

    Best regards,
    Nino


    Hi, Nino. I'm totally fine with the delay, so take your time. :)

    Let's consider this situation;

    /**********************/


    Init Git repository for SES project on a 64-bit Windows 10 machine ->

    Push commits to remote repositories (such as GitHub or Bitbucket) from the Windows 10 machine ->

    a MacBook, which runs Sierra 10.12, pulls commits from the remote repository and open the SES project (emProject) file


    /**********************/

    1. I don't see specific errors or problem when I open the project file with my MacBook.

    Is this just a coincidence or were there any expected errors after opening it?

    2. Since SES uses OS specific line endings for the .emProject file generation,


    Source Code

    1. git config --local core.autocrlf true



    I should use this setting on both computers (Windows 10 and Sierra 10.12), right?

    Let's end this thread after your reply!

    -Best Regards

    -Best Regards, Matthew

    The post was edited 1 time, last by MatthewKyeo ().

  • Hello Matthew,

    1. I don't see specific errors or problem when I open the project file with my MacBook.

    Is this just a coincidence or were there any expected errors after opening it?


    No errors are expected as the projects should be 100% portable between different OS.

    2. Since SES uses OS specific line endings for the .emProject file generation,



    Source code

    1



    git config --local core.autocrlf true




    I should use this setting on both computers (Windows 10 and Sierra 10.12), right?


    Correct, after setting that option on both OS you should have no troubles with line endings when diffing your source.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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. Thanks for the reply! Before closing this, I wish to ask once more, please.

    SEGGER - Nino wrote:



    3. Can Meld or P4Merge be configured as an external diff tool of SES?


    Yes this is possible. You will get a "VCS" option when configured correctly in the right click menu or under Project > VCS in the drop down menu.




    Compared to configuring Git, SES automatically used the double backslash when typing the Diff command.





    I have committed the "main.c" file twice so that I can diff the file using P4Merge.

    However, I don't see "diff" menu from the "VCS" option.

    1. Do I have to configure parameters in the Diff command line, such as \$LOCAL \$REMOTE?, or did I missed certain steps?

    For instance, I haven't logged in (Project - VCS - Options - Login, Configure Git..., I didn't add a remote repo like GitHub, so this login term was quite confusing).

    Ref. Setup p4merge as difftool and mergetool on Windows

    Ref. Setup p4merge as a visual diff and merge tool for git


    Source Code

    1. $ git config --local core.autocrlf true
    2. $ git add Hello.emProject
    3. warning: LF will be replaced by CRLF in Hello.emProject.
    4. The file will have its original line endings in your working directory.





    Using HxD, I noticed that the project file uses only the line feed even though I'm working on Windows 10. Well, this warning can be negligible, I guess.


    I have one last question about ignoring files.

    I noticed that in the

    Source Code

    1. \SEGGER Embedded Studio Projects\Hello\Output\Hello Debug\Obj


    directory,

    - Hello.ld

    - Hello.ind

    files exist.

    I have used Keil MDK-ARM 5 for a while so these type of files seem new to me.

    I couldn't find explanations about these files from the SES documents.

    - IND


    This file looks like a file that tells what objects are used.


    - LD


    Looks like this file is related to memory (RAM / Flash) section.


    2. In this case, should I ignore those 2 files as well? Or can all the files in the Output directory be ignored?

    -Best Regards
    -Best Regards, Matthew
  • Hello Matthew,


    1. Do I have to configure parameters in the Diff command line, such as \$LOCAL \$REMOTE?, or did I missed certain steps?


    The diff option is not handled in the VCS options tab. It will show up when you rightclick your main.c for example. There in this context menu you will find a diff option.

    2. In this case, should I ignore those 2 files as well? Or can all the files in the Output directory be ignored?


    You can basically delete the whole output folder when commiting your projects, provided your checked in projects does build.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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.
  • SEGGER - Nino wrote:

    It will show up when you rightclick your main.c for example. There in this context menu you will find a diff option.


    Hi, Nino.




    Hmm, I don't see any menu, related to diff, after right clicking a source file.

    That main.c file was commited multiple times.


    Can you help me out with this?

    -Best Regards
    -Best Regards, Matthew

    The post was edited 1 time, last by MatthewKyeo ().

  • Hello Matthew,

    Sorry for the delay in response.
    I have created a Wiki article that describes a step by step setup of how to set up a source control system and how to enable external diff tools.
    All your questions should be answered in this article.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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'm totally fine with the delay. :D




    I use P4Merge 2017.2 for my diff/merge tool. After reading the wiki - Set up external diff tool page, I added parameters.

    Source Code

    1. C:\Program Files\Perforce\p4merge.exe
    2. $(localfile)
    3. $(remotefile)



    1. The problem is that I still cannot use the "Compare" option after right clicking.




    I still cannot choose the "Compare" option when the diff option is "None".


    Note that, the main.c file is committed several times using Git 2.12.


    Can you help me with this issue?


    2. This is a minor question; There is a green check mark at the main.c file. Whereas there are red marks on RTT files.


    What do the green check, red check, and the red mark mean? I think the check is meaning that the file is versioned and there is no change.


    -Best Regards
    -Best Regards, Matthew
  • Hello Matthew,

    I use P4Merge 2017.2 for my diff/merge tool. After reading the wiki - Set up external diff tool page, I added parameters.

    The setup looks correct. Is the path correct?
    Try forward slashes instead of backward slashes.
    Does the p4merge.exe accept command line parameters or is there another exe for that?
    Just for testing remove $(localfile) and $(remotefile) from the commandline and only leave the program path.
    If the path is correct Embedded Studio will now open the diff tool without any files, but then you know that the path and diff tool is being called correctly.

    2. This is a minor question; There is a green check mark at the main.c file. Whereas there are red marks on RTT files.

    Green means versioned and "up to date" (no changes) and red means versioned with changes.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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. Now I see what's going on!!!

    Take a look at my The setup looks correct. Is the path correct?
    Try forward slashes instead of backward slashes.
    As you see the video , it works with the backslash.

    SEGGER - Nino wrote:

    Does the p4merge.exe accept command line parameters or is there another exe for that?
    Just for testing remove $(localfile) and $(remotefile) from the commandline and only leave the program path.

    Those parameters are correct!

    SEGGER - Nino wrote:

    Green means versioned and "up to date" (no changes) and red means versioned with changes.

    This green/red check, hmm.

    After I commit the file and reload SES, the file shows the green check.

    - When it shows the green check, I cannot select the compare option. (This is my main concern!!!)

    - I cannot update the status (green / red check, right click - update menu was grayed out always) so I have to restart SES.

    - When I use the SES's commit option, instead of a commit message, a comment blank is shown. However, it doesn't really commit the file when I check it with the status command.

    Anyways the point is that I cannot compare the file when it shows the green check mark.

    Is this an expected behavior? I wanted to compare files even though it is up to date.

    After your inspection, let's end this one.

    -Best Regards
    Images
    • SESCommitHistory.png

      29.26 kB, 746×512, viewed 843 times
    -Best Regards, Matthew

    The post was edited 2 times, last by MatthewKyeo ().

  • Hello Matthew,

    Great to hear that the diff tool is working now when called out of Embedded Studio.

    After I commit the file and reload SES, the file shows the green check.

    - When it shows the green check, I cannot select the compare option. (This is my main concern!!!)


    I am a little bit confused with that question.
    You can only compare/diff files that are different from the currently committed file in the repository.
    If they are the same the diff tool will not open.
    I do not understand why do you want to diff two completely identical files?

    - When I use the SES's commit option, instead of a commit message, a comment blank is shown. However, it doesn't really commit the file when I check it with the status command.

    Did you enter a comment? Because that is only optional and remains blank if nothing is passed.
    I watched your video you linked (beautiful edit by the way ;) ) and it seems like git is not called/configured correctly.
    Instead you seem to be calling MinGW.exe. This is currently not supported by Embedded Studio. You need to use either git.exe, svn.exe or hg.exe as described in the Wiki article.

    When i change a file in the repo (we use svn.exe) and press commit i get the window you can see in the attached picture. There you can enter a commit message.
    After the Commit my "red" file turns green without needing to close and open Embedded Studio.

    Best regards,
    Nino
    Images
    • Capture.PNG

      15.57 kB, 586×417, viewed 793 times
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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.
  • SEGGER - Nino wrote:

    I am a little bit confused with that question.
    You can only compare/diff files that are different from the currently committed file in the repository.
    If they are the same the diff tool will not open.
    I do not understand why do you want to diff two completely identical files?
    Hi, Nino. So, if the file has no change, which shows a green check, the diff option is not available, right?

    I didn't want to diff two identical files. I was hoping to diff the latest file and the committed file right before the latest one.

    For instance,




    in this picture, the latest commit is 2ee94 and the commit before that is 47bf2d.

    So if I was hoping to diff the main.c, main in 2ee94 and main in 47bf2d, file when I click the diff option of the unchanged main.c file.

    However, it looks like that feature is not possible. Looks like the diff feature only works before committing files.

    I was hoping to diff files with SES after committing them to compare the latest version and the previous version, in order not to open SourceTree or P4Merge manually.

    Anyways, thanks for your help!!
    -Best Regards, Matthew
  • Hello Matthew,


    I didn't want to diff two identical files. I was hoping to diff the latest file and the committed file right before the latest one.


    In that case you have to use the diff tool externally. I will ask our dev team if such a feature will be implemented in the future, but no promises.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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.