EEVblog Electronics Community Forum

Products => Computers => Programming => Topic started by: Simon on August 11, 2021, 12:33:36 pm

Title: MPLAB.X and GCC plus WT?
Post by: Simon on August 11, 2021, 12:33:36 pm
I've started writing in MPLAB as it saves IT spending 8 hours working out how to grant Microchip (atmel)(microsoft) (visual) studio admin rights without giving them to me.

Microchip have a download on their website for the GCC compiler but I could never get it to work, it kept complaining about not finding a path to GCC I think even though it was all set up.

I I ended up using XC8. Happily the same header files are available an from the few lines I have written so far all seems fine.

I just (convolutenly) went to create a new header file and got:

Code: [Select]
/* Microchip Technology Inc. and its subsidiaries.  You may use this software 
 * and any derivatives exclusively with Microchip products.
 *
 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS".  NO WARRANTIES, WHETHER
 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
 * PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
 * WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
 *
 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE
 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS
 * IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF
 * ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
 *
 * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
 * TERMS.
 */

/*
 * File:   
 * Author:
 * Comments:
 * Revision history:
 */

// This is a guard condition so that contents of this file are not included
// more than once. 
#ifndef XC_HEADER_TEMPLATE_H
#define XC_HEADER_TEMPLATE_H

#include <xc.h> // include processor files - each processor file is guarded. 

// TODO Insert appropriate #include <>

// TODO Insert C++ class definitions if appropriate

// TODO Insert declarations

// Comment a function and leverage automatic documentation with slash star star
/**
    <p><b>Function prototype:</b></p>
 
    <p><b>Summary:</b></p>

    <p><b>Description:</b></p>

    <p><b>Precondition:</b></p>

    <p><b>Parameters:</b></p>

    <p><b>Returns:</b></p>

    <p><b>Example:</b></p>
    <code>
 
    </code>

    <p><b>Remarks:</b></p>
 */
// TODO Insert declarations or function prototypes (right here) to leverage
// live documentation

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

    // TODO If C++ is being used, regular C code needs function names to have C
    // linkage so the functions can be used by the c code.

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* XC_HEADER_TEMPLATE_H */



Criky MC, steady on there with the copyright crap that I will delete anyway. What's all the other crap for? before I just punch the delete key anyway?
Title: Re: MPLAB.X and GCC plus WT?
Post by: westfw on August 12, 2021, 01:39:32 am

Quote
I just (convolutenly) went to create a new header file
Perhaps you need to figure out how to remove the convolutions...
I get (using right-click on "projects/Source Files" "New/C Header File"):
Code: [Select]
/*  * File:   defs.h
 * Author: BillW
 *
 * Created on August 11, 2021, 6:13 PM
 */

#ifndef DEFS_H
#define    DEFS_H

#ifdef    __cplusplus
extern "C" {
#endif




#ifdef    __cplusplus
}
#endif

#endif    /* DEFS_H */


Title: Re: MPLAB.X and GCC plus WT?
Post by: DavidAlfa on August 14, 2021, 04:27:58 pm
Usually the way to avoid admin rights is to correctly set the program folder permissions.
Anything under c:\program files require admins rights by default to make any changes.
I go to the program folder, ex "c:\program files\microchip", right click, properties, security, permissions, edit, add... "authenticated users", and give them full control.
No more admins issues, I've done that a lot of times.
The system is still safe, the worst thing it could happen is to screw up the microchip folder.

Yep, instead creating a new xc8 header, go to more... C... header file and you'll be fine.
No idea why that stupid xc8 header crap.
Title: Re: MPLAB.X and GCC plus WT?
Post by: Simon on August 14, 2021, 05:49:59 pm
I wish I could get GCC to work but the only time it works is on my own computers that have A/M Studio installed that includes it.