Author Topic: Compiler Optimizations  (Read 44 times)

Online mikejp56

  • Multiple posting newcomer
  • *
  • Posts: 10
Compiler Optimizations
« on: Today at 06:34:52 pm »
Hi All,
I am using CB with Linux Mint 20. I get the following warning "/usr/lib/avr/include/util/delay.h:112:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
 # warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
I have set the compiler optimizations for 1, 2, and 3, but I still get the same warning.
I am pretty new to CodeBlocks and AVR programming.
Please point me in the correct direction.
Thanks for reading.
Regards,
mikejp56

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1563
Re: Compiler Optimizations
« Reply #1 on: Today at 07:45:58 pm »

Online mikejp56

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Compiler Optimizations
« Reply #2 on: Today at 08:27:22 pm »
Hi Miguel,
Here is the text of the build log. From what I have read it appears to have something to do with compiler optimizations.
Thanks for your time.

-------------- Build: Debug in Binary_Clock_Mods (compiler: GNU GCC Compiler for AVR)---------------

avr-gcc -Wall -mmcu=atmega328p -DF_CPU=16000000UL -g  -c main.c -o obj/Debug/main.o
avr-gcc  -o bin/Debug/Binary_Clock_Mods.elf obj/Debug/fuse.o obj/Debug/main.o  -mmcu=atmega328p -Wl,-Map=bin/Debug/Binary_Clock_Mods.map,--cref 
In file included from main.c:18:0:
/usr/lib/avr/include/util/delay.h:112:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
 # warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
   ^
Output file is bin/Debug/Binary_Clock_Mods.elf with size 31.85 KB
Running project post-build steps
avr-objdump -h -S bin/Debug/Binary_Clock_Mods.elf > bin/Debug/Binary_Clock_Mods.lss
avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.hex
avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.eep
avr-objcopy --no-change-warnings -j .lock --change-section-lma .lock=0 -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.lock
avr-objcopy --no-change-warnings -j .signature --change-section-lma .signature=0 -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.sig
avr-objcopy --no-change-warnings -j .fuse --change-section-lma .fuse=0 -O ihex bin/Debug/Binary_Clock_Mods.elf bin/Debug/Binary_Clock_Mods.fuse
srec_cat bin/Debug/Binary_Clock_Mods.fuse -Intel -crop 0x00 0x01 -offset  0x00 -O bin/Debug/Binary_Clock_Mods.lfs -Intel
srec_cat bin/Debug/Binary_Clock_Mods.fuse -Intel -crop 0x01 0x02 -offset -0x01 -O bin/Debug/Binary_Clock_Mods.hfs -Intel
/bin/sh: 1: srec_cat: not found
Process terminated with status 127 (0 minute(s), 0 second(s))
0 error(s), 1 warning(s) (0 minute(s), 0 second(s))
 

-------------- Build file: Debug in Binary_Clock_Mods (compiler: GNU GCC Compiler for AVR)---------------

Nothing to be done (all items are up-to-date).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Re: Compiler Optimizations
« Reply #3 on: Today at 08:46:25 pm »
https://www.avrfreaks.net/s/topic/a5C3l000000UUx7EAG/t132775

Over a decade old post; where user found problem in Code::Blocks global compiler settings.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online mikejp56

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Compiler Optimizations
« Reply #4 on: Today at 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