MICROCHIP 50003215A Compiler Advisor in MPLAB X IDE User Guide

June 10, 2024
MICROCHIP

Compiler Advisor in MPLAB X IDE
User’s Guide

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.
Figure 1-1. Compiler Advisor ExampleMICROCHIP 50003215A Compiler
Advisor in MPLAB X IDE - Compiler Advisor Example 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.
1.1 Perform Project Analysis
To use the Compiler Advisor to analyze your project for different combinations of optimizations, follow the procedures in the following sections.
1.1.1 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.
1.1.2 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.
Figure 1-2. Compiler Advisor with Project InformationMICROCHIP
50003215A Compiler Advisor in MPLAB X IDE - Compiler Advisor Example
1 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.
Figure 1-3. Note on Unsupported Compiler VersionMICROCHIP 50003215A
Compiler Advisor in MPLAB X IDE - Compiler Advisor Example
2 If you make other changes to the project, such as changing the configuration, you will also need to Reload.
1.1.3 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.
Figure 1-4. Free License ExampleMICROCHIP 50003215A Compiler Advisor in
MPLAB X IDE - Compiler Advisor Example 3 Figure 1-5. PRO License ExampleMICROCHIP
50003215A Compiler Advisor in MPLAB X IDE - Compiler Advisor Example
4 1.2 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

Figure 1-6. Annotated Chart FeaturesMICROCHIP 50003215A Compiler
Advisor in MPLAB X IDE - Compiler Advisor Example 5 1.2.1 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.
Figure 1-7. Build Failed Link 1.2.2 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.
Figure 1-8. Click to See Optimization DescriptionMICROCHIP 50003215A
Compiler Advisor in MPLAB X IDE - Compiler Advisor Example
7 1.2.3 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.
Figure 1-9. MCU Mouseover for Tooltip 1.2.4 Use Context Menu Functions
Right click on the chart to pop up the context menu with items listed in the table below.
Table 1-1. 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 continued| Zoom in or zoom out on the selected chart axes.
Auto Range| Automatically adjust the range of the selected axes for the data in the chart.

1.2.5 View Initial Configuration
To view the initial project configuration used, click on “Properties” to open the Project Properties window. 1.2.6 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.
Figure 1-10. Save Configuration to ProjectMICROCHIP 50003215A Compiler
Advisor in MPLAB X IDE - Compiler Advisor Example 10 To open the Project Properties to see the added configuration, click the link in the Output window.
Figure 1-11. Open Project Properties from Output WindowMICROCHIP
50003215A Compiler Advisor in MPLAB X IDE - Compiler Advisor Example
11 The configuration is now added to the project. If the configuration was made active, it will also appear in the toolbar drop-down list.
Figure 1-12. Configuration Saved to ProjectMICROCHIP 50003215A Compiler
Advisor in MPLAB X IDE - Compiler Advisor Example 12 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.
1.3 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.

Figure 1-13. MPU Chart from AnalysisMICROCHIP 50003215A Compiler
Advisor in MPLAB X IDE - Compiler Advisor Example 13 1.4 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, Any Rate, AVR, AVR logo, AVR Freaks, BesTime, Bit Cloud, Crypto Memory, 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

AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE

Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
www.microchip.com/support
Web Address:
www.microchip.com
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Austin, TX
Tel: 512-257-3370
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Novi, MI
Tel: 248-848-4000
Houston, TX
Tel: 281-894-5983
Indianapolis
Noblesville, IN
Tel: 317-773-8323
Fax: 317-773-5453
Tel: 317-536-2380
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Tel: 951-273-7800
Raleigh, NC
Tel: 919-844-7510
New York, NY
Tel: 631-435-6000
San Jose, CA
Tel: 408-735-9110
Tel: 408-436-4270
Canada – Toronto
Tel: 905-695-1980
Fax: 905-695-2078| Australia – Sydney
Tel: 61-2-9868-6733
China – Beijing
Tel: 86-10-8569-7000
China – Chengdu
Tel: 86-28-8665-5511
China – Chongqing
Tel: 86-23-8980-9588
China – Dongguan
Tel: 86-769-8702-9880
China – Guangzhou
Tel: 86-20-8755-8029
China – Hangzhou
Tel: 86-571-8792-8115
China – Hong Kong SAR
Tel: 852-2943-5100
China – Nanjing
Tel: 86-25-8473-2460
China – Qingdao
Tel: 86-532-8502-7355
China – Shanghai
Tel: 86-21-3326-8000
China – Shenyang
Tel: 86-24-2334-2829
China – Shenzhen
Tel: 86-755-8864-2200
China – Suzhou
Tel: 86-186-6233-1526
China – Wuhan
Tel: 86-27-5980-5300
China – Xian
Tel: 86-29-8833-7252
China – Xiamen
Tel: 86-592-2388138
China – Zhuhai
Tel: 86-756-3210040| India – Bangalore
Tel: 91-80-3090-4444
India – New Delhi
Tel: 91-11-4160-8631
India – Pune
Tel: 91-20-4121-0141
Japan – Osaka
Tel: 81-6-6152-7160
Japan – Tokyo
Tel: 81-3-6880- 3770
Korea – Daegu
Tel: 82-53-744-4301
Korea – Seoul
Tel: 82-2-554-7200
Malaysia – Kuala Lumpur
Tel: 60-3-7651-7906
Malaysia – Penang
Tel: 60-4-227-8870
Philippines – Manila
Tel: 63-2-634-9065
Singapore
Tel: 65-6334-8870
Taiwan – Hsin Chu
Tel: 886-3-577-8366
Taiwan – Kaohsiung
Tel: 886-7-213-7830
Taiwan – Taipei
Tel: 886-2-2508-8600
Thailand – Bangkok
Tel: 66-2-694-1351
Vietnam – Ho Chi Minh
Tel: 84-28-5448-2100| Austria – Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark – Copenhagen
Tel: 45-4485-5910
Fax: 45-4485-2829
Finland – Espoo
Tel: 358-9-4520-820
France – Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Germany – Garching
Tel: 49-8931-9700
Germany – Haan
Tel: 49-2129-3766400
Germany – Heilbronn
Tel: 49-7131-72400
Germany – Karlsruhe
Tel: 49-721-625370
Germany – Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Germany – Rosenheim
Tel: 49-8031-354-560
Israel – Ra’anana
Tel: 972-9-744-7705
Italy – Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Italy – Padova
Tel: 39-049-7625286
Netherlands – Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Norway – Trondheim
Tel: 47-72884388
Poland – Warsaw
Tel: 48-22-3325737
Romania – Bucharest
Tel: 40-21-407-87-50
Spain – Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
Sweden – Gothenberg
Tel: 46-31-704-60-40
Sweden – Stockholm
Tel: 46-8-5090-4654
UK – Wokingham
Tel: 44-118-921-5800
Fax: 44-118-921-5820

© 2021 Microchip Technology Inc.
and its subsidiaries
DS-50003215A

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals