LockedMigrate a project from MPLAB C18 to XC8

Author
stinf
Starting Member
  • Total Posts : 75
  • Reward points : 0
  • Joined: 2006/03/07 02:03:24
  • Location: Napoli, Italy
  • Status: offline
2012/06/04 07:23:30 (permalink)
0

Migrate a project from MPLAB C18 to XC8

Hi all,
I just installed XC8 (still on MPLAB 8.85, at the moment...), switched MPLAB to use it instead of my fully licensed MPLAB C Compiler for PIC18, and tried to quickly compile a project I am working on, but I got TONS of errors...
I checked the XC8 User's Guide, but the only related page (page 70) does not say much. Is there a kind of a table comparing the two compilers? I would need something like "const rom char * -> whatever" (this is simply the first error...)
Or, is there a way I can understand the "practical" difference among the two?
 
Thanks in advance,
Stefano
#1

5 Replies Related Threads

    mad_c
    Super Member
    • Total Posts : 1093
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re:Migrate a project from MPLAB C18 to XC8 2012/06/04 15:47:07 (permalink)
    0
    Hi,
     
    We plan to release a migration document, but unfortunately that is a little way off. Here is a 2-cent summary. Of course, the user's guide will show examples and describe the XC8 syntax.
    • Include the generic header file <xc.h> in every module -- no device specific header files are required.
    • 'rom' in C18 implies storage in the program memory. That is accomplished by just using 'const' in XC8. Any non-auto const object is stored in program memory with XC8.
    • XC8 uses #pragma config directives for configuration bits, similar to C18. (I dont think any change is required here.)
    • For interrupt functions, just use the 'interrupt' qualifier on each ISR. For the low priority ISR, additionally use the low_priority keyword. No pragmas are required.
    • Avoid allocating variables to banks manually, but if you must, use the banks keywords rather than the C18 pragmas.
    Jeff.
    #2
    stinf
    Starting Member
    • Total Posts : 75
    • Reward points : 0
    • Joined: 2006/03/07 02:03:24
    • Location: Napoli, Italy
    • Status: offline
    Re:Migrate a project from MPLAB C18 to XC8 2012/06/05 01:10:12 (permalink)
    0
    Jeff,
    thanks for your answer. Do you know approximately when will this migration document be released? It should be of great help.
    Anyway, your summary can surely answer to many of my questions, but others arise:
    • Is the linker file still necessary? I modified it in order to have some locations to store variables which must not change their value after a CPU reset. I also customized the c018iz_e initialization file in order to inizialize only variables out of those locations. I also modified the linker file to allocate a LUT.
    • Is the extended memory model supported?
    • How do I access the external memory (I use a PIC18LF8723)?
    • In C18 I disabled integer promotions in order to save a lot of memory, but in XC8 I cannot see any similar option... does it mean it is already optimized and does not need it?
    Thanks again,
    Stefano
    #3
    ghcmja
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2012/06/14 10:49:30
    • Location: 0
    • Status: offline
    Re:Migrate a project from MPLAB C18 to XC8 2012/06/14 11:39:25 (permalink)
    0
    Hello,
     
    I have a problem while migrating the USB HID Mouse from Microchip Applications Library 2012-04-03 to XC8.
     
     
    I've set the include directories correctly.
    Using Ubuntu 12.04, Mplab X 1.20, XC8 1.00 free mode.
    XC8 has an additional option: "--cmode=c18" for C18 compatibility.
     
    While buiding the project I've these error messages:
     
    :: advisory: Employing 18F4550 errata work-arounds:
    :: advisory:  * Corrupted fast interrupt shadow registers
    (1273) Omniscient Code Generation not available in Free mode (warning)
    :0: error: can't open intermediate file "build/PICDEM_FSUSB/production/_ext/926206843/usb_device.p1": No such file or directory
    :0: error: can't open intermediate file "build/PICDEM_FSUSB/production/_ext/1785203669/usb_function_hid.p1": No such file or directory
    :0: error: can't open intermediate file "build/PICDEM_FSUSB/production/_ext/926206843/usb_hal_pic24.p1": No such file or directory
    :0: error: can't open intermediate file "build/PICDEM_FSUSB/production/_ext/1472/mouse.p1": No such file or directory
    :0: error: can't open intermediate file "build/PICDEM_FSUSB/production/_ext/1472/usb_descriptors.p1": No such file or directory
    (908) exit status = 1
     
     
     
    All search paths are ok, directories are valid, but filenames in the directories has an additional ".d" extension, example:
    "build/PICDEM_FSUSB/production/_ext/1472/usb_descriptors.p1.d"
    NOT
    "build/PICDEM_FSUSB/production/_ext/1472/usb_descriptors.p1"
     
    I've tried under windows XP, (Mplab X 1.2, XC8 1.00) I get the same error messages.
     
    Is anybody has the same problem?
     
    Any idea?
     
    Thank you.
     
    Sorry, this is not an answer, i've made a mistake...
     
    post edited by ghcmja - 2012/06/14 11:42:46
    #4
    dm.chikov
    New Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2012/06/11 01:23:16
    • Location: 0
    • Status: offline
    Re:Migrate a project from MPLAB C18 to XC8 2012/06/15 02:01:13 (permalink)
    0
    You can use mcc18 driver.
    It is in bin directory of ur XC8
     
    #5
    ghcmja
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2012/06/14 10:49:30
    • Location: 0
    • Status: offline
    Re:Migrate a project from MPLAB C18 to XC8 2012/06/17 11:17:16 (permalink)
    0
     
    I don't know how to use the mcc18 located under XC8. I've tried:
     
    Tools>Options>Embedded>Build tools>Add new toolchain>C18
    I try to give the toolchain (...bin/mcc18) directory but I cant press the OK button, because it is disabled, and get the following message:
     
    Base directory is currently used by another toolchain.
    (of course, it is the XC8 tool's base directory)
     
    Am I doing something wrong?
     
    GY
     
    #6
    Jump to:
    © 2018 APG vNext Trial Version 4.5