xc8 compiler

Download Xc8 Compiler

Post on 24-Nov-2015

145 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

Xc8 Compiler guide

TRANSCRIPT

  • 2013 Microchip Technology Inc. DS50002184A

    MPLAB C18 to XC8 C CompilerMigration Guide

  • DS50002184A-page 2 2013 Microchip Technology Inc.

    Information contained in this publication regarding deviceapplications and the like is provided only for your convenienceand may be superseded by updates. It is your responsibility toensure that your application meets with your specifications.MICROCHIP MAKES NO REPRESENTATIONS ORWARRANTIES OF ANY KIND WHETHER EXPRESS ORIMPLIED, WRITTEN OR ORAL, STATUTORY OROTHERWISE, RELATED TO THE INFORMATION,INCLUDING BUT NOT LIMITED TO ITS CONDITION,QUALITY, PERFORMANCE, MERCHANTABILITY ORFITNESS FOR PURPOSE. Microchip disclaims all liabilityarising from this information and its use. Use of Microchipdevices in life support and/or safety applications is entirely atthe buyers risk, and the buyer agrees to defend, indemnify andhold harmless Microchip from any and all damages, claims,suits, or expenses resulting from such use. No licenses areconveyed, implicitly or otherwise, under any Microchipintellectual property rights.

    Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained in their particular Microchip Data Sheet.

    Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.

    There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchips Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.

    Microchip is willing to work with the customer who is concerned about the integrity of their code.

    Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as unbreakable.

    Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of ourproducts. Attempts to break Microchips code protection feature may be a violation of the Digital Millennium Copyright Act. If such actsallow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.

    Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Companys quality system processes and procedures are for its PIC MCUs and dsPIC DSCs, KEELOQ code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchips quality system for the design and manufacture of development systems is ISO 9001:2000 certified.

    QUALITY MANAGEMENT SYSTEM CERTIFIED BY DNV

    == ISO/TS 16949 ==

    Trademarks

    The Microchip name and logo, the Microchip logo, dsPIC, FlashFlex, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC32 logo, rfPIC, SST, SST Logo, SuperFlash and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

    FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MTP, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.

    Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.

    Analog-for-the-Digital Age, Application Maestro, BodyCom, chipKIT, chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, SQI, Serial Quad I/O, Total Endurance, TSHARC, UniWinDriver, WiperLock, ZENA and Z-Scale 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.

    GestIC and ULPP are registered trademarks 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.

    2013, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.

    Printed on recycled paper.

    ISBN: 978-1-62076-984-3

  • 3.20 Linking ........................................................................................................ 47Glossary ....................................................................................................................... 49Worldwide Sales and Service .................................................................................... 72MPLAB C18 TO XC8 C COMPILERMIGRATION GUIDE

    Table of Contents

    Preface ........................................................................................................................... 5Chapter 1. Migration Overview

    1.1 Introduction ................................................................................................... 101.2 Using C18 Compatibility Mode ..................................................................... 121.3 Migrating Projects to MPLAB XC8 ............................................................... 13

    Chapter 2. Invoking the Compiler2.1 Introduction ................................................................................................... 152.2 General Compiler Usage .............................................................................. 152.3 Driver Options .............................................................................................. 182.4 MPLINK Options ........................................................................................... 22

    Chapter 3. Language Features3.1 Introduction ................................................................................................... 233.2 Operating Modes .......................................................................................... 243.3 Memory Models ............................................................................................ 243.4 Integer Promotions ....................................................................................... 243.5 Device-Specific Information .......................................................................... 253.6 Data Types and Limits .................................................................................. 273.7 Size Limitations ............................................................................................ 283.8 Storage Classes ........................................................................................... 283.9 Storage Qualifiers ......................................................................................... 293.10 Pointer Storage Qualifiers .......................................................................... 303.11 Function Variants ....................................................................................... 313.12 Structures and Unions ................................................................................ 323.13 Interrupts .................................................................................................... 323.14 Locating Objects ......................................................................................... 343.15 Function Reentrancy and Calling Conventions .......................................... 363.16 The Runtime Startup Code ......................................................................... 403.17 Register Usage ........................................................................................... 413.18 Preprocessing ............................................................................................ 423.19 C and Assembly ......................................................................................... 44 2013 Microchip Technology Inc. DS50002184A-page 3

  • MPLAB C18 to XC8 C Compiler Migration GuideNOTES:DS50002184A-page 4 2013 Microchip Technology Inc.

  • MPLAB C18 TO XC8 C COMPILERMIGRATION GUIDE

    Preface

    INTRODUCTIONThis chapter contains general information that will be useful to know before using the MPLAB C18 to XC8 C Compiler Migration Guide. Items discussed in this chapter include: Document Layout Conventions Used in this Guide Recommended Reading The Microchip Web Site Development Systems Customer Change Notification Service Customer Support Document Revision History

    DOCUMENT LAYOUTThis document describes how to migrate C source code from the MPLAB C18 Compiler to the MPLAB XC8 C Compiler. This guide is organized as follows: Chapter 1. Migration Overview Chapter 2. Invoking the Compiler Chapter 3. Language Features Glossary

    NOTICE TO CUSTOMERS

    All documentation becomes dated, and this manual is no exception. Microchip 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 web site (www.microchip.com) to obtain the latest documentation available.

    Documents are identified with a DS number. This number is located on the bottom of each page, in front of the page number. The numbering convention for the DS number is DSXXXXXA, where XXXXX is the document number and A is the revision level of the document.

    For the most up-to-date information on development tools, see the MPLAB IDE online help. Select t

Recommended

View more >