This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Device suffers from reproducible resets once optimisation is turned on

I've recently begun work on maintaining and adding functionality to an existing product using the Chipcon CC1010.

<snip>

Parents
  • "Using the old implementation, and without optimization turned on I can step through the code fine. When opimization is turned on and i try to step into one of the function pointers that handles the serial tx..."
    (my emphasis)

    Are you really using function pointers?

    If you are, have you carefully read all the application notes and knowledgebase articles about function pointers in C51?

    The nature of the 8051 architecture imposes some particular restrictions on the use of function pointers - especially when you enable the Data Overlaying optimisations...

Reply
  • "Using the old implementation, and without optimization turned on I can step through the code fine. When opimization is turned on and i try to step into one of the function pointers that handles the serial tx..."
    (my emphasis)

    Are you really using function pointers?

    If you are, have you carefully read all the application notes and knowledgebase articles about function pointers in C51?

    The nature of the 8051 architecture imposes some particular restrictions on the use of function pointers - especially when you enable the Data Overlaying optimisations...

Children
  • I'm using numerous function pointers elsewhere for time management and these work fine with optimisation - but their use is quite controlled. I'd removed all the function pointers from around the suspect code but it's possible they're being used elsewhere (in the same file). Doesn't the compiler normally complain about reentrant functions in these scenarios? An example of poor compiler understanding was that the previous code was calling functions like memset and memcpy from within interrupts!! :)

    Thanks for the tip on that one. I'll keep looking for further use of the function pointers.

    I have found that I can individually optimise files in the project so I've set everything to 9 except the screwy file. It freed up 10k so this will keep us going until we have time to sort it out. Any further suggestions would be appreciated though. :)

    Cheers
    Darcy

  • "Doesn't the compiler normally complain about reentrant functions in these scenarios?"

    Not necessarily.

    The problem is that the compiler (and Linker)can't necessarily tell at build time that you have potentially reentrant calls via pointers.
    That's why you have to understand the issues first, and write the code accordingly.