From e5fa7e8183f1ea29d43c72c79bcf1d1efb8f3972 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Mon, 11 Feb 2013 19:31:39 +0100 Subject: [PATCH] BOARDS and ARCH defines from boards.txt See #308 --- app/src/processing/app/debug/Compiler.java | 1 + hardware/arduino/avr/boards.txt | 16 ++++++++++++++++ hardware/arduino/avr/platform.txt | 4 ++-- hardware/arduino/sam/boards.txt | 2 ++ hardware/arduino/sam/platform.txt | 4 ++-- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 1bd8b8c25..26597116a 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -142,6 +142,7 @@ public class Compiler implements MessageConsumer { p.put("build.path", _buildPath); p.put("build.project_name", _primaryClassName); + p.put("build.arch", targetPlatform.getName().toUpperCase()); if (!p.containsKey("compiler.path")) p.put("compiler.path", Base.getAvrBasePath()); diff --git a/hardware/arduino/avr/boards.txt b/hardware/arduino/avr/boards.txt index 137211363..d9860e6c3 100644 --- a/hardware/arduino/avr/boards.txt +++ b/hardware/arduino/avr/boards.txt @@ -20,6 +20,7 @@ uno.bootloader.file=optiboot/optiboot_atmega328.hex uno.build.mcu=atmega328p uno.build.f_cpu=16000000L +uno.build.board=ARDUINO_UNO uno.build.core=arduino uno.build.variant=standard @@ -36,6 +37,7 @@ atmega328diecimila.bootloader.unlock_bits=0x3F atmega328diecimila.bootloader.lock_bits=0x0F atmega328diecimila.build.f_cpu=16000000L +atmega328diecimila.build.board=ARDUINO_DUEMILANOVE atmega328diecimila.build.core=arduino atmega328diecimila.build.variant=standard @@ -75,6 +77,7 @@ nano.bootloader.unlock_bits=0x3F nano.bootloader.lock_bits=0x0F nano.build.f_cpu=16000000L +nano.build.board=ARDUINO_NANO nano.build.core=arduino nano.build.variant=eightanaloginputs @@ -124,6 +127,7 @@ mega2560.bootloader.lock_bits=0x0F mega2560.build.mcu=atmega2560 mega2560.build.f_cpu=16000000L +mega2560.build.board=ARDUINO_MEGA2560 mega2560.build.core=arduino mega2560.build.variant=mega @@ -147,6 +151,7 @@ mega.bootloader.lock_bits=0x0F mega.build.mcu=atmega1280 mega.build.f_cpu=16000000L +mega.build.board=ARDUINO_MEGA mega.build.core=arduino mega.build.variant=mega @@ -173,6 +178,7 @@ leonardo.build.mcu=atmega32u4 leonardo.build.f_cpu=16000000L leonardo.build.vid=0x2341 leonardo.build.pid=0x8036 +leonardo.build.board=ARDUINO_LEONARDO leonardo.build.core=arduino leonardo.build.variant=leonardo leonardo.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} @@ -200,6 +206,7 @@ micro.build.mcu=atmega32u4 micro.build.f_cpu=16000000L micro.build.vid=0x2341 micro.build.pid=0x8037 +micro.build.board=ARDUINO_MICRO micro.build.core=arduino micro.build.variant=micro micro.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} @@ -227,6 +234,7 @@ esplora.build.mcu=atmega32u4 esplora.build.f_cpu=16000000L esplora.build.vid=0x2341 esplora.build.pid=0x8036 +esplora.build.board=ARDUINO_ESPLORA esplora.build.core=arduino esplora.build.variant=leonardo esplora.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} @@ -244,6 +252,7 @@ mini.bootloader.unlock_bits=0x3F mini.bootloader.lock_bits=0x0F mini.build.f_cpu=16000000L +mini.build.board=ARDUINO_MINI mini.build.core=arduino mini.build.variant=eightanaloginputs @@ -291,6 +300,7 @@ ethernet.bootloader.lock_bits=0x0F ethernet.build.variant=standard ethernet.build.mcu=atmega328p ethernet.build.f_cpu=16000000L +ethernet.build.board=ARDUINO_ETHERNET ethernet.build.core=arduino ############################################################## @@ -312,6 +322,7 @@ fio.bootloader.lock_bits=0x0F fio.build.mcu=atmega328p fio.build.f_cpu=8000000L +fio.build.board=ARDUINO_FIO fio.build.core=arduino fio.build.variant=eightanaloginputs @@ -330,6 +341,7 @@ bt.bootloader.unlock_bits=0x3F bt.bootloader.lock_bits=0x0F bt.build.f_cpu=16000000L +bt.build.board=ARDUINO_BT bt.build.core=arduino bt.build.variant=eightanaloginputs @@ -377,6 +389,7 @@ LilyPadUSB.build.mcu=atmega32u4 LilyPadUSB.build.f_cpu=8000000L LilyPadUSB.build.vid=0x1B4F LilyPadUSB.build.pid=0x9208 +LilyPadUSB.build.board=ARDUINO_LILYPAD_USB LilyPadUSB.build.core=arduino LilyPadUSB.build.variant=leonardo LilyPadUSB.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} @@ -393,6 +406,7 @@ lilypad.bootloader.unlock_bits=0x3F lilypad.bootloader.lock_bits=0x0F lilypad.build.f_cpu=8000000L +lilypad.build.board=ARDUINO_LILYPAD lilypad.build.core=arduino lilypad.build.variant=standard @@ -433,6 +447,7 @@ pro.bootloader.tool=avrdude pro.bootloader.unlock_bits=0x3F pro.bootloader.lock_bits=0x0F +pro.build.board=ARDUINO_PRO pro.build.core=arduino pro.build.variant=standard @@ -506,6 +521,7 @@ atmegang.bootloader.lock_bits=0x0F atmegang.build.mcu=atmegang atmegang.build.f_cpu=16000000L +atmegang.build.board=ARDUINO_NG atmegang.build.core=arduino atmegang.build.variant=standard diff --git a/hardware/arduino/avr/platform.txt b/hardware/arduino/avr/platform.txt index d439ddd5c..a6cd314c1 100644 --- a/hardware/arduino/avr/platform.txt +++ b/hardware/arduino/avr/platform.txt @@ -27,10 +27,10 @@ build.extra_flags= # -------------------- ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" ## Create archives recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}" diff --git a/hardware/arduino/sam/boards.txt b/hardware/arduino/sam/boards.txt index 5d6f386cd..d3629e596 100644 --- a/hardware/arduino/sam/boards.txt +++ b/hardware/arduino/sam/boards.txt @@ -8,6 +8,7 @@ arduino_due_x_dbg.upload.wait_for_upload_port=false arduino_due_x_dbg.upload.native_usb=false arduino_due_x_dbg.build.mcu=cortex-m3 arduino_due_x_dbg.build.f_cpu=84000000L +arduino_due_x_dbg.build.board=ARDUINO_DUE arduino_due_x_dbg.build.core=arduino arduino_due_x_dbg.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON arduino_due_x_dbg.build.ldscript=linker_scripts/gcc/flash.ld @@ -25,6 +26,7 @@ arduino_due_x.upload.wait_for_upload_port=true arduino_due_x.upload.native_usb=true arduino_due_x.build.mcu=cortex-m3 arduino_due_x.build.f_cpu=84000000L +arduino_due_x.build.board=ARDUINO_DUE arduino_due_x.build.core=arduino arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON arduino_due_x.build.ldscript=linker_scripts/gcc/flash.ld diff --git a/hardware/arduino/sam/platform.txt b/hardware/arduino/sam/platform.txt index fedb29e12..3594610ea 100644 --- a/hardware/arduino/sam/platform.txt +++ b/hardware/arduino/sam/platform.txt @@ -30,10 +30,10 @@ compiler.libsam.c.flags="-I{build.system.path}/libsam" "-I{build.system.path}/CM # --------------------- ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}" ## Create archives recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"