Hot!"main" file generation criteria : MCC keeps creating a new main.c file at each generation

Author
edesarrieu
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2018/09/26 02:50:37
  • Location: 0
  • Status: offline
2018/10/01 05:15:18 (permalink)
0

"main" file generation criteria : MCC keeps creating a new main.c file at each generation

Hello,
 
I have a project with a PIC24FJ64GA106-I/PT microcontroller, I used MCC to configure it.
I organize my source file into two folders : src/ and include/, located at the root of the project tree.
So my main.c is in PROJECT_ROOT/src/main.c
 
My src/main.c contains :
#include "../mcc_generated_files/mcc.h"

and in an init() function, the instruction :
SYSTEM_Initialize();

 
Project works fine, makefile are generated, it compiles and I have my binaries everything is fine.
But when each time I regenerate the MCC files, it creates a new main.c file, at project's root.
 
Why ? Which are the criteria for MCC to detect any existing main.c ?
 
Doc says :
The main.c file is generated only when the MCC detects that there is nomain.c file present in the project. If there is any previous main.c in the projectregardless of its creator (the user or MCC), it will not generate or overwrite theexisting one. When using a main.c not generated by MCC the lines: “#include“mcc_generated_files/mcc.h”, and SYSTEM_Initializer() need to be addedto the main.c file.
 
I thought I was OK...? I have another project with the same tree folder, but without that problem, I cannot understand why.
 
Context :
Linux Debian Stretch, PickIt 3, MPLAB 5.05, MCC 3.65.1, XC16 V1.35
 
Thank you for any help !
 
Etienne
post edited by edesarrieu - 2018/10/01 05:16:23
#1

12 Replies Related Threads

    hkumar
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2012/10/03 01:12:16
    • Location: 0
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/05 22:47:10 (permalink)
    0
    Thanks for reporting the issue.
    Issue will be fixed in the next release.
    #2
    edesarrieu
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2018/09/26 02:50:37
    • Location: 0
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/08 00:17:41 (permalink)
    0
    OK, nice !
    So I will wait for it, thank you !
    #3
    hkumar
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2012/10/03 01:12:16
    • Location: 0
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/10 01:46:53 (permalink)
    #4
    edesarrieu
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2018/09/26 02:50:37
    • Location: 0
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/10 02:31:49 (permalink)
    0
    I could, but where should I put the jar file ?
    I tried to find by myself what it could replace, but did not find...
    #5
    hkumar
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2012/10/03 01:12:16
    • Location: 0
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/10 03:15:51 (permalink)
    0
    In MPLAB IDE click on Tools->Options->Plugins then click on the "Open Library Folder" button , copy the jar in this location , then switch the library version to this version using "Versions" tab in MCC
     
     
    #6
    edesarrieu
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2018/09/26 02:50:37
    • Location: 0
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/12 02:29:52 (permalink)
    0
    Thank you hkumar. No change for me, it still generates main.c :
     
    11:25:01.874 INFO: Saved configuration to file /home/edesarrieu/GitLab/GPS/gps_mcc_config_file.mc3
    11:25:02.934 INFO: *****************************************************
    11:25:02.942 INFO: Generation Results
    11:25:02.942 INFO: *****************************************************
    11:25:02.943 INFO: main.c Success. New file.
    11:25:02.943 INFO: mcc_generated_files/adc1.c Success.

     
    I added a screenshot where you can see my file tree, my main content, and the correct loading of 1.75 library that you sent me.
     
    Thank you for your help !
     
     
     

    Attached Image(s)

    #7
    davekw7x
    Entropy++
    • Total Posts : 1534
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/12 08:22:58 (permalink)
    5 (1)
    edesarrieu
    ...No change...
     



    Until the Microchip guys can respond to your support ticket with a "real fix" or suggestion, how about trying the following and seeing if it will work:
     
    Move your main.c file to the place where MCC wants to put it: In the project root directory (project .X).
     
    Here is how I would do it:
    • In the MPLABX Projects window, right-click on main.c and select  "Remove from Project."
    • Then, outside of MPLABX, move the file to the .X directory (Use command line or whatever).
    • Then, back in the MPLABX Projects window right-click on  Source Files  and select "Add Existing Item."  Navigate to the .X directory and click main.c
     
    You will have to change the include directive in your newly relocated main.c to
    #include "mcc_generated_files/mcc.h"

    Note that it doesn't matter whether the file in the Project window appears under the Source Files "virtual" directory or under your src "virtual" directory.  It matters where the file is located in the physical directory tree.
     
    Tell us if it works.
     
    Bottom line: IWFMYMMV (It Works For Me; Your Mileage May Vary)  I used the mcc-generated SYSTEM_Initialize() function.  If you have additional initialization requirements, I suggest that you put that extra stuff into another function that you call explicitly in addition to the MCC-generated one.  My approach is to let MCC do its stuff with no modifications from me (as much as practical), and to do other stuff above and beyond MCC in my own functions.  That way, generation of new MCC features tends to be less annoying.
     
    MPLABX version 5.05, MCC Plugin version 3.65.1, XC16 version 1.35
    32-bit Centos 6.10 Linux
     
    Regards,

    Dave
    Footnote:
    The MCC team may or may not consider it worthy of changing.  Not my call or my concern, but maybe you can get on with your development without the continuing annoyance.
     
    post edited by davekw7x - 2018/10/12 09:09:41

    Sometimes I just can't help myself...
    #8
    hkumar
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2012/10/03 01:12:16
    • Location: 0
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/14 23:32:57 (permalink)
    0
    edesarrieu,
     I could not reproduce the issue i.e changes in main.c is retained each time i generate the files , as shown in the figure(img1).
     
    Could you please do "Force Update" (right click on the project resources window) and then generate the files , you should get the merge window for main.c if you have any edits/changes in the main.c.(refer img2)
     
    Also if possible could you please share your mcc config file?
     
    Regards,
    HKumar

    Attached Image(s)

    #9
    edesarrieu
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2018/09/26 02:50:37
    • Location: 0
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/17 07:48:56 (permalink)
    0
    Thank you for your help Dave, but I know that getting the main.c in the root folder of my project works.
     
    As it was not mentioned as a limitation of MCC (in its documentation) to generate the main.c only at root folder, I thought it was possible, moreover I considered my other Microchip project where main.c is correctly detected by MCC whereas it is located in "src" folder (tidying up files is a good practice) !
     
    So I was suprised to see that it does not behaved the same in my other project...
     
    Edit : I was wrong in first version of that post, problem is not fixed. I tried several ways and tips, it never works, MCC even creates several main.c in logical tree if there is already one at project root, behavior seems weird I can not understand the logic.
     
    I have to tell that in this project, my main.c had not been created by MCC at the beginning, it was imported first (from the other projects that already works).
     
    Hope that could help you HKumar. I joined my MCC config file (gps_mcc_config_file.zip), and the working project with almost same tree folder (AnotherProjectWithoutTheBug.zip)
    .
    post edited by edesarrieu - 2018/10/18 00:34:48
    #10
    Jim Nickerson
    User 452
    • Total Posts : 5280
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/18 10:15:07 (permalink)
    0
    Missing post ? ( my browser never reports this thread ahs been read )
    #11
    davekw7x
    Entropy++
    • Total Posts : 1534
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: "main" file generation criteria : MCC keeps creating a new main.c file at each generat 2018/10/18 10:20:50 (permalink)
    0
    edesarrieu
    Thank you for your help Dave, but...



    How about this as a workaround?
     
    You have your main.c in your src directory, right?
     
    Then...
     
    Let MCC create its version of main.c in the project root directory
     
    Right-clock that unwanted main.c in the Projects window and select "Exclude file(s) from current configuration"
     
    That way, whether MCC generates or re-generates its main.c in the root directory, it won't interfere with your build.
     
    Bottom line: I agree that the documentation indicates that main.c can be anywhere in the project.  Since that, apparently, doesn't work, just let MCC do its thing, and use the "Exclude..." feature of the IDE to let you put main.c in your preferred place.
     
    Regards,

    Dave
     Footnote: I originally thought that manually editing the .mc3 file might be enlightening, but the results were inconsistent (probably due to my limited experience and zero knowledge of the inner workings of MCC).
    post edited by davekw7x - 2018/10/18 12:17:49

    Sometimes I just can't help myself...
    #12
    Jump to:
    © 2018 APG vNext Commercial Version 4.5