• AVR Freaks

XC16 Compiler Optimizations and Code Configurator

New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2018/12/17 17:53:34
  • Location: 0
  • Status: offline
2019/04/10 17:14:18 (permalink)

XC16 Compiler Optimizations and Code Configurator

I have been using the Code Configurator and XC16 compiler with the optimization level set to 0 to target a PIC24FJ128GC006 processor.  So far so good and I have I2C, comm ports, timers, all running using interrupts totally managed by the code generated by the code configurator.
Noticing that I was getting over 70% on my flash utilization, I though I would set the compiler optimization to one and try running the code.  As you have probably guessed, it did not run at all.  I traced it down and it seems to be getting stuck trying to access an I2C peripheral.   I placed some volatile keywords in the stucture declarations used for the initiating I2C transfers and that seemed to help as the code seems to make it past this block with good status.
However, now when compiling the code, I get all kinds of warnings because the volatile keyword is not part of the structure typedef that was created by code configurator- 
So, the base line question is if you are going to use compiler optimizations, should you or should you not be using code generated from the code configurator?   And, if it is ok to use the code configurator, is it safe to ignore all the warnings?

1 Reply Related Threads

    Aussie Susan
    Super Member
    • Total Posts : 3709
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: XC16 Compiler Optimizations and Code Configurator 2019/04/11 19:51:21 (permalink)
    Perhaps you should be asking this in the MCC forum.
    As to whether you is it 'safe' to ignore a warning, that is really your call. It is a 'warning' and not an error. All the compiler is telling you is that something may not be working the way you expect so you should check out the result and, if you are happy, then continue on.
    Jump to:
    © 2020 APG vNext Commercial Version 4.5