User forums > Help

Compiler Optimizations

<< < (2/2)

Miguel Gimenez:
Were optimizations enabled in the log you posted?

stahta01:

--- Quote from: mikejp56 on April 19, 2024, 08:56:08 pm ---Hi stahta01,
I have set the compiler optimizations to 1, 2, and 3, but this issue still occurs. There was another post about using the compiler optimizations to solve an issue that I saw.
I just tried the same code with MPLABX with the same results, and the same warning message, so it doesn't appear to be a CB issue. I am just reaching out for help from people with way more experience than me.
Regards,
mikejp56

--- End quote ---

See https://www.nongnu.org/avr-libc/user-manual/group__util__delay.html

Did you define F_CPU as required?
Edit: You did as "-DF_CPU=16000000UL"

And, you need to find an website that supports your AVR compiler; because some or most of your question is off topic (OT) for this website.

Edit: Did you rebuild the project trying at least 3 different optimizations? Edit3: I suggest "O1" "O2" and "Og".
If yes, what optimizations did you try?
Post at least one build log of those opt. builds?

Edit2: Try building the project without the debug mode (-g) being used. Sometimes debug mode make things easier and sometimes harder.

Tim S.

mikejp56:
Hi stahta01,
I did try to build using the optimizations 01, 02, and 03 with no success.
I obviously fat fingered the F_CPU define. I will retry that again without the D! This code is for a crystal controlled clock running at 16MHz. It keeps correct time without the F_CPU define.
I realized afterward that it is a compiler issue when I compiled the same exact c code in MPLABX (which I really do not like) and got the same warning from the compiler.
Regards,
mikejp56

Navigation

[0] Message Index

[*] Previous page

Go to full version