MICROCHIP Compiler Advisor in MPLAB X IDE Owner’s Manual

June 9, 2024
MICROCHIP

MICROCHIP Compiler Advisor in MPLAB X IDE

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-PRODUCT

Notice to Development Tools Customers

Important:
All documentation becomes dated, and Development Tools manuals are no exception. Our tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our website (www.microchip.com/) to obtain the latest version of the PDF document. Documents are identified with a DS number located on the bottom of each page. The DS format is DS, where

is an 8-digit number and is an uppercase letter. For the most up-to-date information, find help for your tool at [onlinedocs.microchip.com/](http://onlinedocs.microchip.com/).

Compiler Advisor

Note: This content is also in the “MPLAB X IDE User’s Guide” (DS-50002027). Compiler Advisor displays a graphical comparison of sets, with carefully selected available compiler optimizations using project code.

Compiler Advisor Example

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-1

This MPLAB X IDE plug-in can be useful in:

  • Providing information on available compiler optimizations for each compiler type (XC8, XC16, XC32).
  • Demonstrating the advantages each optimization provides for a project in an easy-to-read, graphical form for program and data memory size.
  • Saving desired configurations.
  • Providing links to optimization definitions for each configuration.

Compiler Support
Supported compiler versions:

  • MPLAB XC8 v2.30 and later
  • MPLAB XC16 v1.26 and later
  • MPLAB XC32 v3.01 and later

No license is required for use. However, the number of optimizations for a free compiler will be less than for a licensed compiler.

MPLAB X IDE and Device Support
All devices supported in MPLAB X IDE will be supported in Compiler Advisor. Updated Device Family Packs (DFPs) will add device support.

Perform Project Analysis
To use the Compiler Advisor to analyze your project for different combinations of optimizations, follow the procedures in the following sections.

Select Project for Analysis
In MPLAB X IDE, open a project and in the Projects window either click on the project name to make it active or right click on the project name and select “Set as Main Project.”
The project code, configuration, compiler and device will be used for the analysis. Therefore ensure that the compiler and device pack versions are supported as specified in 1. Compiler Advisor.

Note :  You will be warned in Compiler Advisor before analysis if the compiler and device pack versions are not correct.

Open Compiler Advisor
Open the Compiler Advisor. Select Analysis>Compiler Advisor either by right clicking on the project or by using the Tools menu. Information about the selected project will be loaded into the Compiler Advisor and displayed at the top of the window (see figure below). Additionally, there are links to learn more about the Compiler Advisor or view Frequently Asked Questions.

Compiler Advisor with Project Information

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-2

Verify that the project name, project configuration, compiler toolchain and device are correct for analysis. If you do not have a supported compiler or device pack version selected for your project, a note will be displayed. For example, a note about unsupported compiler versions will have links to help you (see figure below):

  • Click “install” to open the MPLAB XC C Compiler webpage where you can download or purchase an updated compiler version.
  • Click “Scan for Build Tools” to open the Tools>Options>Embedded>Build Tools tab where you can scan your system for existing compiler versions.
  • Click “switch” to open project properties for compiler version selection.

Once you have completed any needed update, the Compiler Advisor will detect the change and request that you click Reload. Clicking this button will update the project information.

Note on Unsupported Compiler Version

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-3

If you make other changes to the project, such as changing the configuration, you will also need to Reload.

Analyze the Project
Once any project modifications are complete and loaded into the Compiler Advisor, click Analyze. The Compiler Advisor will build the project code several times using different sets of optimizations.

Note:   Depending on code size, this may take some time.

When the analysis is complete, a graph will appear showing program and data memory used for each of the different configurations (see figures below). For a compiler in Free mode, the last column will show a PRO compiler comparison. To buy a PRO license, click the “Buy License” link to go to the MPLAB XC Compiler webpage to select the type of PRO license to buy. The analysis information is saved in the project folder. For details on the chart, see 1.2 Understand Analysis Results in Chart.

Free License Example

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-4

PRO License Example

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-5

Understand Analysis Results in Chart
The chart generated after analysis has several features explained in the following sections. Use these features to determine if another configuration is right for your application.

  1. 1.2.1 Find Build Failures
  2. 1.2.2 View Configuration Optimizations
  3. 1.2.3 View Configuration Data
  4. 1.2.4 Use Context Menu Functions
  5. 1.2.5 View Initial Configuration
  6. 1.2.6 Save Configuration to Project

Annotated Chart Features

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-6

Find Build Failures
When a build fails due to certain optimization selections, you can click on Build Failed to go to where the error(s) are in the Output window.

Build Failed Link

View Configuration Optimizations
Click the link of an optimization (e.g., -Os) used in a configuration to get more information. The link will take you to a description of the optimization in the compiler online documentation.

Compiler Advisor

Click to See Optimization Description

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-8

View Configuration Data
To see the percentage and bytes of program and data memory used for each build configuration, mouseover a program memory bar for MCUs (see figure) and a data memory point for MPUs.

MCU Mouseover for Tooltip

Use Context Menu Functions
Right click on the chart to pop up the context menu with items listed in the table below.

Compiler Analysis Context Menu

Menu Item Description
Properties Open the Chart Properties dialog. Add a title, format the plot or

select other drawing options.
Copy| Copy an image of the chart to the clipboard. You may need to alter the Properties.
Save As| Save the chart as an image. You may need to alter the Properties.
Print| Print an image of the chart. You may need to alter the Properties.
Zoom In/Zoom Out| Zoom in or zoom out on the selected chart axes.
Menu Item| Description
---|---
Auto Range| Automatically adjust the range of the selected axes for the data in the chart.

View Initial Configuration
To view the initial project configuration used, click on “Properties” to open the Project Properties window

Save Configuration to Project
Click on the “Save Config” link under a configuration (e.g., Config E) that you want to add to your project. This will open the Save Configuration to Project dialog (see figure below). If you want this to be the active configuration in the project, check the checkbox. Then click OK.

Save Configuration to Project

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-11

To open the Project Properties to see the added configuration, click the link in the Output window

Open Project Properties from Output Window
The configuration is now added to the project. If the configuration was made active, it will also appear in the toolbar drop-down list.

Configuration Saved to Project

Note : Because the configuration has been added to the project, the Compiler Advisor will notice a change to the project properties and change Analyze to Reload.

Understand MPU Charts
The procedure to perform project analysis and the features of the resulting analysis chart are similar to those mentioned previously for MCU devices. Differences for MPU charts are:

  • MPU devices will only display information as data due to a combined program/data memory compiler output file.
  • Data for each configuration may be seen by mousing over a data memory point.

MPU Chart from Analysis

MICROCHIP-Compiler-Advisor-in-MPLAB-X-IDE-FIG-13

Analyze Another Project
If you decide to analyze another project, select that project by making it active or main (see 1.1.1 Select Project for Analysis). Then reopen the Compiler Advisor (see 1.1.2 Open Compiler Advisor). A dialog will ask if you want to change from the existing project to the new project (see figure below). If you select Yes, then the Compiler Advisor window will be updated with the details of selected project

The Microchip Website

Microchip provides online support via our website at www.microchip.com/. This website is used to make files and information easily available to customers. Some of the content available includes:

  • Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software
  • General Technical Support – Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip design partner program member listing
  • Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives

Product Change Notification Service
Microchip’s product change notification service helps keep customers current on Microchip products. Subscribers will receive email notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. To register, go to www.microchip.com/pcn and follow the registration instructions

Customer Support
Users of Microchip products can receive assistance through several channels:

  • Distributor or Representative
  • Local Sales Office
  • Embedded Solutions Engineer (ESE)
  • Technical Support

Customers should contact their distributor, representative or ESE for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in this document. Technical support is available through the website at: www.microchip.com/support

Product Identification System

To order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office.

Device: PIC16F18313, PIC16LF18313, PIC16F18323, PIC16LF18323
Tape and Reel Option: Blank
T = Tape and Reel(1)
Temperature Range: I
E = -40°C to +125°C (Extended)
Package:(2) JQ
P = PDIP
ST = TSSOP
SL = SOIC-14
SN = SOIC-8
RF = UDFN
Pattern: QTP, SQTP, Code or Special Requirements (blank otherwise)

Examples:

  • PIC16LF18313- I/P Industrial temperature, PDIP package
  • PIC16F18313- E/SS Extended temperature, SSOP package

Notes:

  1. Tape and Reel identifier only appears in the catalog part number description. This identifier is used for ordering purposes and is not printed on the device package. Check with your Microchip Sales Office for package availability with the Tape and Reel option.
  2. Small form-factor packaging options may be available. Please check www.microchip.com/packaging for smallform factor package availability, or contact your local Sales Office.

Microchip Devices Code Protection Feature
Note the following details of the code protection feature on Microchip products:

  • Microchip products meet the specifications contained in their particular Microchip Data Sheet.
  • Microchip believes that its family of products is secure when used in the intended manner, within operating specifications, and under normal conditions.
  • Microchip values and aggressively protects its intellectual property rights. Attempts to breach the code protection features of Microchip product is strictly prohibited and may violate the Digital Millennium Copyright Act.
  • Neither Microchip nor any other semiconductor manufacturer can guarantee the security of its code. Code protection does not mean that we are guaranteeing the product is “unbreakable”. Code protection is constantly evolving. Microchip is committed to continuously improving the code protection features of our products

Legal Notice

This publication and the information herein may be used only with Microchip products, including to design, test, and integrate Microchip products with your application. Use of this information in any other manner violates these terms. Information regarding device applications is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. Contact your local Microchip sales office for additional support or, obtain additional support at www.microchip.com/en-us/support/ design-help/client-support- services. THIS INFORMATION IS PROVIDED BY MICROCHIP “AS IS”. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE, OR WARRANTIES RELATED TO ITS CONDITION, QUALITY, OR PERFORMANCE.

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 INFORMATION OR ITS USE, 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 THE INFORMATION OR ITS USE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THE INFORMATION. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights unless otherwise stated.

Trademarks

The Microchip name and logo, the Microchip logo, Adaptec, AnyRate, AVR, AVR logo, AVR Freaks, BesTime, BitCloud, CryptoMemory, CryptoRF, dsPIC, flexPWR, HELDO, IGLOO, JukeBlox, KeeLoq, Kleer, LANCheck, LinkMD, maXStylus, maXTouch, MediaLB, megaAVR, Microsemi, Microsemi logo, MOST, MOST logo, MPLAB, OptoLyzer, PIC, picoPower, PICSTART, PIC32 logo, PolarFire, Prochip Designer, QTouch, SAM-BA, SenGenuity, SpyNIC, SST, SST Logo, SuperFlash, Symmetricom, SyncServer, Tachyon, TimeSource, tinyAVR, UNI/O, Vectron, and XMEGA are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. AgileSwitch, APT, ClockWorks, The Embedded Control Solutions Company, EtherSynch, Flashtec, Hyper Speed Control, HyperLight Load, IntelliMOS, Libero, motorBench, mTouch, Powermite 3, Precision Edge, ProASIC, ProASIC Plus, ProASIC Plus logo, Quiet- Wire, SmartFusion, SyncWorld, Temux, TimeCesium, TimeHub, TimePictra, TimeProvider, TrueTime, WinPath, and ZL are registered trademarks of Microchip Technology Incorporated in the U.S.A. Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, Augmented Switching, BlueSky, BodyCom, CodeGuard, CryptoAuthentication, CryptoAutomotive, CryptoCompanion, CryptoController, dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, Espresso

T1S, EtherGREEN, GridTime, IdealBridge, In-Circuit Serial Programming, ICSP, INICnet, Intelligent Paralleling, Inter-Chip Connectivity, JitterBlocker, Knob-on-Display, maxCrypto, maxView, memBrain, Mindi, MiWi, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, NVM Express, NVMe, Omniscient Code Generation, PICDEM, PICDEM.net, PICkit, PICtail, PowerSmart, PureSilicon, QMatrix, REAL ICE, Ripple Blocker, RTAX, RTG4, SAMICE, Serial Quad I/O, simpleMAP, SimpliPHY, SmartBuffer, SmartHLS, SMART-I.S., storClad, SQI, SuperSwitcher, SuperSwitcher II, Switchtec, SynchroPHY, Total Endurance, TSHARC, USBCheck, VariSense, VectorBlox, VeriPHY, ViewSpan, WiperLock, XpressConnect, and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.

The Adaptec logo, Frequency on Demand, Silicon Storage Technology, Symmcom, and Trusted Time are registered trademarks of Microchip Technology Inc. in other countries. GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries. All other trademarks mentioned herein are property of their respective companies. © 2021, Microchip Technology Incorporated and its subsidiaries. All Rights Reserved. ISBN: 978-1-5224-9186-6 AMBA, Arm, Arm7, Arm7TDMI, Arm9, Arm11, Artisan, big.LITTLE, Cordio, CoreLink, CoreSight, Cortex, DesignStart, DynamIQ, Jazelle, Keil, Mali, Mbed, Mbed Enabled, NEON, POP, RealView, SecurCore, Socrates, Thumb, TrustZone, ULINK, ULINK2, ULINK-ME, ULINK-PLUS, ULINKpro, μVision, Versatile are trademarks or registered trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere.

Quality Management System
For information regarding Microchip’s Quality Management Systems, please visit www.microchip.com/quality.

Worldwide Sales and Service

Corporate Office
2355 West Chandler Blvd. Chandler, AZ 85224-6199

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals