Go Down

Topic: [SOLVED] Is there any way to attach -D from within arduino IDE (Read 2 times) previous topic - next topic

liudr


I've only recently started with 1.5 so can't recall exactly but I think you can add your own "recipe" pattern directly to the boards.txt. You will find the default "recipe" patterns in the paltform.txt

Code: [Select]
recipe.cpp.o.pattern=

So this would mean you could copy a board def in the boards.txt, change the name to whatever you want and add your own recipe specifically for your new board definition. This would allow you to optionally invoke your additional compiler defines just by switching board. (I hope this info is correct)

It's certainly easier to achieve this with the vs plugin which also allows you to set a -D list on a per configuration basis. Hence you can have a -D list for "My Normal Compile" and a list for "My Special Compile" etc.


Thanks. I added a new line phi_panel.build.extra_flags=-Ddisable_simple_fns to a new board def I copied and changed and it did the trick, according to the verbose output. I wonder if I can do phi_panel.build.extra_flags=-DXX=10 with the defined number instead of just defining a name. Will try later.

Code: [Select]
##############################################################

phi_panel.name=Phi panel
phi_panel.upload.tool=avrdude
phi_panel.upload.protocol=arduino
phi_panel.upload.maximum_size=32256
phi_panel.upload.speed=115200

phi_panel.bootloader.tool=avrdude
phi_panel.bootloader.low_fuses=0xFF
phi_panel.bootloader.high_fuses=0xDE
phi_panel.bootloader.extended_fuses=0x05
phi_panel.bootloader.unlock_bits=0x3F
phi_panel.bootloader.lock_bits=0x0F
phi_panel.bootloader.file=optiboot/optiboot_atmega328.hex

phi_panel.build.mcu=atmega328p
phi_panel.build.f_cpu=16000000L
phi_panel.build.core=arduino
phi_panel.build.variant=standard
phi_panel.build.extra_flags=-Ddisable_simple_fns

## recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -Ddisable_simple_fns -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

Visual Micro

Great. I don't see why you can't do that. The extra flags are just passed to the compile statement without change, so should work fine.
Arduino for Microsoft Visual Studio Pro and Atmel Studio 6.1 http://www.visualmicro.com
Arduino Debugger http://www.visualmicro.com/post/2012/05/05/Debug-Arduino-Overview.aspx

liudr

Yep, everything I typed in there gets appended to the compiler options. Thanks for helping me through! Karma for you!

Go Up