Hot!Migrating an XC8 v1.xx project to an XC8 v2.xx project

Author
RISC
Super Member
  • Total Posts : 5220
  • Reward points : 0
  • Status: offline
2018/06/23 10:15:17 (permalink)
4.5 (2)

Migrating an XC8 v1.xx project to an XC8 v2.xx project

Hi,
 
I guess lots of users will go through this...
So for those who won't read the readme file Readme_XC8_for_PIC.htm for the XC8 v2.xx compiler let me give a quick tip how to do it ;=)
 
The key difference between XC8 v1.xx and v2.xx is the default standard used for C language :
XC8 v1.xx --> C90
XC8 v2.xx --> C99
Due to a major difference in float format support, compilation errors are generated when an XC8 v1.xx project is compiled with XC8 v2.xx. C90 standard "accept" the unusual 24 bits float format whereas C99 impose 32 bits float
To easily solve this when migrating an XC8 v1xx to v2.xx do the following in MPLAB X :
Project Properties > XC8 Global options > C90  (must use MPLAB X v4.20 or above)
After making this change your project should compile without errors.
 
Regards
post edited by RISC - 2018/07/01 03:22:58
#1

17 Replies Related Threads

    mad_c
    Super Member
    • Total Posts : 1081
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/24 15:23:38 (permalink)
    +4 (4)
    RISC
    So for those who won't read the readme file Readme_XC8_for_PIC.htm for the XC8 v2.xx compiler let me give a quick tip how to do it ;=)

     
    There is also an article which goes into a little more depth as to what is new in the compiler, plus another article that shows the options you have if you plan to migrate to it. Unfortunately, that latter article is still making its way through the system and is a few days away, but it should be found here once it is published.
     
    Jeff.
    #2
    Ivan Cenov
    Super Member
    • Total Posts : 267
    • Reward points : 0
    • Joined: 2003/11/07 12:36:51
    • Location: Bulgaria
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/25 00:28:25 (permalink)
    +1 (1)
    Where XC8 2.0 can be downloaded from?
    #3
    Jim Nickerson
    User 452 _
    • Total Posts : 4841
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/25 06:50:45 (permalink)
    +2 (2)
    Looks like the expected place.
    The web page text has not been updated to reflect version 2

    Attached Image(s)

    #4
    mad_c
    Super Member
    • Total Posts : 1081
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/25 14:06:36 (permalink)
    +2 (2)
    i_cenov
    Where XC8 2.0 can be downloaded from?

    The links on the webpage take a while to react to the new download, but if you check the linked file name, you will see what version is available. The links have finally been updated, in any case.
     
    Jeff.
     
    #5
    Jolibob
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2015/11/17 10:47:22
    • Location: France
    • Status: online
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/28 05:31:53 (permalink)
    0
    Hello,
     
    After migration to V2.0, I discovered that changing the warning level no longer existed and that "--ROM" option was no longer recognized. So I came back to V1.45.
     
    Robert
    #6
    qɥb
    Monolothic Member
    • Total Posts : 2955
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/28 06:08:34 (permalink)
    0
    Almost certainly the same options exist, but under new names.

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #7
    Ivan Cenov
    Super Member
    • Total Posts : 267
    • Reward points : 0
    • Joined: 2003/11/07 12:36:51
    • Location: Bulgaria
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/28 07:10:12 (permalink)
    0
    You may try adding the needed options to the linker in project's Properties.XC8 Global Options.XC8 Linker -> Additional options.
    'xc8-cc --help' will print all available options.
    #8
    Jolibob
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2015/11/17 10:47:22
    • Location: France
    • Status: online
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/28 07:58:29 (permalink)
    +1 (1)
    "--ROM..." keyword problem is solved : "-mrom…" keyword replace it is documented in XC8 user's guide (not legacy user's guide) DS50002737.
     
    Robert
    #9
    Jolibob
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2015/11/17 10:47:22
    • Location: France
    • Status: online
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/28 08:15:35 (permalink)
    0
    Warning level also solved : warning level must be set in "Additional options" of Xc8 compiler. Also documented in DS50002737 user's manual.
     
    I come back to V2.0 Smile!
     
    Robert
    #10
    mad_c
    Super Member
    • Total Posts : 1081
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/28 14:09:42 (permalink)
    0
    Jolibob
    "... it is documented in XC8 user's guide (not legacy user's guide) DS50002737.

    Reading the User's Guide is good. There are also the articles I posted links to in a previous post in this thread. Both are now active.
     
    Jeff.
    #11
    1and0
    Access is Denied
    • Total Posts : 8123
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/06/30 19:47:29 (permalink)
    +4 (4)
    RISC
    To easily solve this when migrating an XC8 v1xx to v2.xx do the following in MPLAB X :
    Project Properties > XC8 Global options > C90

    Notice this option is available on the latest MPLAB X v4.20, and not on v4.15 and earlier.
    #12
    Docmo
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/06/10 21:10:19
    • Location: 0
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/07/08 14:30:43 (permalink)
    0
    When I installed xc8 2.0 I could not get the xc.h file to be found and the standard location required me to point to a new sub directory in the tools/options/embedded page. 
     
    C:\Program Files (x86)\Microchip\xc8\v2.00\pic\bin
     
    instead of:
     
    C:\Program Files (x86)\Microchip\xc8\v2.00\bin
     
    What is going on here, is this a change or do I have some other issue and this is a bad work around?
     
    Paul
    #13
    mad_c
    Super Member
    • Total Posts : 1081
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/07/08 22:58:56 (permalink)
    +1 (1)
    Hi,
     
    Many of the directories have changed, but this should not affect your projects, provided you have not specified paths in include directives. Both the new drivers know where to find <xc.h>
     
    Both drivers are located in ...\xc8\v2.00\bin, but there are other binaries in xc8\v2.00\pic\bin, but you nor the IDE should not have to call those directly.
     
    Jeff.
     
    #14
    JPortici
    Super Member
    • Total Posts : 232
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: 0
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/07/12 05:33:19 (permalink)
    0
    mad_c
    RISC
    So for those who won't read the readme file Readme_XC8_for_PIC.htm for the XC8 v2.xx compiler let me give a quick tip how to do it ;=)

     
    There is also an article which goes into a little more depth as to what is new in the compiler, plus another article that shows the options you have if you plan to migrate to it. Unfortunately, that latter article is still making its way through the system and is a few days away, but it should be found here once it is published.
     
    Jeff.




    whi isn't that liked in the forum somehow? i don't follow MCHP Developer, my google searches almost never hit that website, i was about to open a topic asking everything that's answered in your first link
    #15
    davekw7x
    Entropy++
    • Total Posts : 1431
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/07/12 07:13:20 (permalink)
    +2 (2)
    mad_c with emphasis added by davekw7x
    this should not affect your projects
    ...but you nor the IDE should not have to call those directly.
     

    Well, I agree that they should not...
     
    But...
    Many users have reported problems (on several threads on this Forum and to me personally).  This does not happen to everyone, but it does happen.
     
    Depending on the operating system and the nature of the installation (and other unknowable things) sometimes the installation seems complete in the sense that XC8 (v2.00) shows up in the list at Tools->Options->Embedded->Build Tools, but it shows up as v2.00\pic\bin\xc8.exe rather than the appropriate executable in v2.00\bin.  In these cases, attempts at compilation result in fundamental compiler errors not related or caused by specific code.
    [Edit]
    Also I note that manually selecting v2.00\bin\xc8.exe rather than v2.00\bin\xc8-cc.exe results in the very unhelpful message
    (902) no chip name specified; use "PICC --CHIPINFO" to see available chip names
     
    It's gotta be xc8-cc.exe, not xc8.exe.  At least that's the only way it works for me (Your Mileage May Vary).  This is regardless of the selection of C90 or C99 in the project XC8 Global Options box.  (Of course Linux users select xc8-cc since there are no .exe files)

     
    Everyone I have spoken to says all such problems are fixed if you click "Scan for build tools."  Previous compiler installations have not required this (at least not for me).  Once the toolchain is set properly, do not make manual changes in the "Build Tools" box.  Do not make changes in Project->Options path settings to try to "help" the compiler find its own #include files.  If it isn't set up properly, you can't help it by artificial means
     
    Final Note (I promise): Changing the executable in the Build Tools box doesn't automatically cause regeneration of the project makefiles.  At least not always.
     
    I have to go to Project->Properties and change something there (change from C90 to C99 or vice versa, for example) before starting a new build.
     
    Once the toolchain is properly set, then we can get to the real fun stuff: Debugging our code.
    [/Edit]
     
    Regards,

    Dave
    post edited by davekw7x - 2018/07/12 08:10:49

    Sometimes I just can't help myself...
    #16
    JPortici
    Super Member
    • Total Posts : 232
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: 0
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/07/19 01:26:52 (permalink)
    +1 (1)
    have you all noticed an increase in code size in C99 mode?
    I tried it with a couple of projects and i got an increase of 100-200 bytes. The output from my code is more or less the same (switch case selection is moved from before the cases to after the cases, but that's about it) but it seems that standard library functions (i used only string.h) are less optimized and are duplicated more often?
     
    can't be from using 32bit floats as i don't use floats
    #17
    mad_c
    Super Member
    • Total Posts : 1081
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Migrating an XC8 v1.xx project to an XC8 v2.xx project 2018/07/19 15:29:34 (permalink)
    +3 (3)
    Jack_M
    have you all noticed an increase in code size in C99 mode?
     

    That is to be expected. The C99 libraries are new and have more features, plus to date, there has only been a limited amount of work done to improve their efficiency.
     
    Jeff.
    #18
    Jump to:
    © 2018 APG vNext Commercial Version 4.5