Author Topic: how to fix this warning - 'optimize' attribute directive ignored  (Read 4718 times)

Offline d00m

  • Single posting newcomer
  • *
  • Posts: 7
Hello.

I'm using  Code::Blocks 13.12 rev 9501
SDK Version 1.19.0

I've downloaded it from http://sourceforge.net/projects/arduinodev/files/
CodeBlocks-Arduino-20140626.7z
I know I need ask this question on http://arduinodev.com/forums/ but I'll try do it here.

I need fix one .h file from library LowPower
https://github.com/LowPowerLab/LowPower
I need change these strings in header file:
Code
		void	powerDown(period_t period, adc_t adc, bod_t bod);
void powerSave(period_t period, adc_t adc, bod_t bod, timer2_t timer2);
void powerStandby(period_t period, adc_t adc, bod_t bod);
void powerExtStandby(period_t period, adc_t adc, bod_t bod, timer2_t timer2);

to this

Code
void	powerDown(period_t period, adc_t adc, bod_t bod) __attribute__((optimize("-O1")));
void powerSave(period_t period, adc_t adc, bod_t bod, timer2_t timer2) __attribute__((optimize("-O1")));
void powerStandby(period_t period, adc_t adc, bod_t bod) __attribute__((optimize("-O1")));
void powerExtStandby(period_t period, adc_t adc, bod_t bod, timer2_t timer2) __attribute__((optimize("-O1")));
it will fix Sleep power consumption in arduino.

but I receive this output after compiling:

Quote

-------------- Build: Arduino Duemilanove (328) in lora_server (compiler: GNU AVR GCC Compiler)---------------

Compiling: lora_server.ino
Linking console executable: build\lora_server_duemilanove328.elf
In file included from lora_server.ino:116:
LowPower.h:136: warning: 'optimize' attribute directive ignored
LowPower.h:137: warning: 'optimize' attribute directive ignored
LowPower.h:138: warning: 'optimize' attribute directive ignored
LowPower.h:139: warning: 'optimize' attribute directive ignored
Output file is build\lora_server_duemilanove328.elf with size 14.06 KB
Running target post-build steps
avr-objcopy -O ihex -R .eeprom -R .eesafe "build\lora_server_duemilanove328.elf" "build\lora_server_duemilanove328.elf.hex"
avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex "build\lora_server_duemilanove328.elf" "build\lora_server_duemilanove328.elf.eep.hex"
avr-size --mcu=atmega328p --format=avr "build\lora_server_duemilanove328.elf"
AVR Memory Usage
----------------
Device: atmega328p
Program:   14018 bytes (42.8% Full)
(.text + .data + .bootloader)
Data:       1633 bytes (79.7% Full)
(.data + .bss + .noinit)
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 4 warning(s) (0 minute(s), 0 second(s))

So I need somehow enable the optimize attribute in this build tool
Any advice how to do it?
Thanks!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: how to fix this warning - 'optimize' attribute directive ignored
« Reply #1 on: May 21, 2016, 01:45:58 am »
This is a compiler problem and we cannot help much.
Inspect the manual pf your compiler and/or ask in a support channel for your compiler.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]