From 1b3ae5fa63c2ca7c5a585f3929d382b441bbba9f Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 30 Dec 2011 15:46:04 +0100 Subject: [PATCH] Created second level in hardware folder: hardware/PACKAGE/PLATFORM/... Made some helper class for files filtering. platforms.txt now contains only one platform at a time. Some cleanup in Compiler and AvrDudeUploader classes. --- app/src/processing/app/Base.java | 251 +++++++++-------- app/src/processing/app/Preferences.java | 1 + .../processing/app/debug/AvrdudeUploader.java | 97 +++---- app/src/processing/app/debug/Compiler.java | 265 +++++++++--------- .../processing/app/debug/TargetPackage.java | 44 +++ .../{Target.java => TargetPlatform.java} | 23 +- .../app/{ => helpers}/PreferencesMap.java | 2 +- .../app/helpers/filefilters/OnlyDirs.java | 43 +++ build/shared/lib/preferences.txt | 4 +- hardware/arduino/{ => avr}/boards.txt | 0 .../bootloaders/atmega/ATmegaBOOT_168.c | 0 .../atmega/ATmegaBOOT_168_atmega1280.hex | 0 .../atmega/ATmegaBOOT_168_atmega328.hex | 0 .../ATmegaBOOT_168_atmega328_pro_8MHz.hex | 0 .../atmega/ATmegaBOOT_168_diecimila.hex | 0 .../bootloaders/atmega/ATmegaBOOT_168_ng.hex | 0 .../atmega/ATmegaBOOT_168_pro_8MHz.hex | 0 .../{ => avr}/bootloaders/atmega/Makefile | 0 .../bootloaders/atmega8/ATmegaBOOT.c | 0 .../bootloaders/atmega8/ATmegaBOOT.hex | 0 .../{ => avr}/bootloaders/atmega8/Makefile | 0 .../{ => avr}/bootloaders/bt/ATmegaBOOT_168.c | 0 .../bootloaders/bt/ATmegaBOOT_168.hex | 0 .../bt/ATmegaBOOT_168_atmega328_bt.hex | 0 .../arduino/{ => avr}/bootloaders/bt/Makefile | 0 .../diskloader/DiskLoader-Leonardo.hex | 0 .../{ => avr}/bootloaders/diskloader/Makefile | 0 .../bootloaders/diskloader/src/DiskLoader.cpp | 0 .../bootloaders/diskloader/src/Platform.h | 0 .../bootloaders/diskloader/src/USBCore.cpp | 0 .../bootloaders/diskloader/src/USBCore.h | 0 .../bootloaders/diskloader/src/USBDesc.cpp | 0 .../bootloaders/diskloader/src/USBDesc.h | 0 .../bootloaders/lilypad/LilyPadBOOT_168.hex | 0 .../bootloaders/lilypad/src/ATmegaBOOT.c | 0 .../bootloaders/lilypad/src/Makefile | 0 .../{ => avr}/bootloaders/optiboot/Makefile | 0 .../{ => avr}/bootloaders/optiboot/README.TXT | 0 .../{ => avr}/bootloaders/optiboot/boot.h | 0 .../{ => avr}/bootloaders/optiboot/makeall | 0 .../{ => avr}/bootloaders/optiboot/omake | 0 .../{ => avr}/bootloaders/optiboot/omake.bat | 0 .../{ => avr}/bootloaders/optiboot/optiboot.c | 0 .../optiboot/optiboot_atmega168.hex | 0 .../optiboot/optiboot_atmega168.lst | 0 .../optiboot/optiboot_atmega328-Mini.hex | 0 .../optiboot/optiboot_atmega328.hex | 0 .../optiboot/optiboot_atmega328.lst | 0 .../bootloaders/optiboot/optiboot_atmega8.hex | 0 .../bootloaders/optiboot/optiboot_atmega8.lst | 0 .../{ => avr}/bootloaders/optiboot/pin_defs.h | 0 .../{ => avr}/bootloaders/optiboot/stk500.h | 0 .../bootloaders/stk500v2/License.txt | 0 .../{ => avr}/bootloaders/stk500v2/Makefile | 0 .../bootloaders/stk500v2/STK500V2.pnproj | 0 .../bootloaders/stk500v2/STK500V2.pnps | 0 .../bootloaders/stk500v2/avrinterruptnames.h | 0 .../{ => avr}/bootloaders/stk500v2/command.h | 0 .../bootloaders/stk500v2/stk500boot.c | 0 .../bootloaders/stk500v2/stk500boot.ppg | 0 .../stk500v2/stk500boot_v2_mega2560.hex | 0 .../arduino/{ => avr}/cores/arduino/Arduino.h | 0 .../arduino/{ => avr}/cores/arduino/CDC.cpp | 0 .../arduino/{ => avr}/cores/arduino/Client.h | 0 .../arduino/{ => avr}/cores/arduino/HID.cpp | 0 .../cores/arduino/HardwareSerial.cpp | 0 .../{ => avr}/cores/arduino/HardwareSerial.h | 0 .../{ => avr}/cores/arduino/IPAddress.cpp | 0 .../{ => avr}/cores/arduino/IPAddress.h | 0 .../{ => avr}/cores/arduino/Platform.h | 0 .../arduino/{ => avr}/cores/arduino/Print.cpp | 0 .../arduino/{ => avr}/cores/arduino/Print.h | 0 .../{ => avr}/cores/arduino/Printable.h | 0 .../arduino/{ => avr}/cores/arduino/Server.h | 0 .../{ => avr}/cores/arduino/Stream.cpp | 0 .../arduino/{ => avr}/cores/arduino/Stream.h | 0 .../arduino/{ => avr}/cores/arduino/Tone.cpp | 0 .../arduino/{ => avr}/cores/arduino/USBAPI.h | 0 .../{ => avr}/cores/arduino/USBCore.cpp | 0 .../arduino/{ => avr}/cores/arduino/USBCore.h | 0 .../arduino/{ => avr}/cores/arduino/USBDesc.h | 0 .../arduino/{ => avr}/cores/arduino/Udp.h | 0 .../{ => avr}/cores/arduino/WCharacter.h | 0 .../{ => avr}/cores/arduino/WInterrupts.c | 0 .../arduino/{ => avr}/cores/arduino/WMath.cpp | 0 .../{ => avr}/cores/arduino/WString.cpp | 0 .../arduino/{ => avr}/cores/arduino/WString.h | 0 .../arduino/{ => avr}/cores/arduino/binary.h | 0 .../arduino/{ => avr}/cores/arduino/main.cpp | 0 .../arduino/{ => avr}/cores/arduino/new.cpp | 0 .../arduino/{ => avr}/cores/arduino/new.h | 0 .../arduino/{ => avr}/cores/arduino/wiring.c | 0 .../{ => avr}/cores/arduino/wiring_analog.c | 0 .../{ => avr}/cores/arduino/wiring_digital.c | 0 .../{ => avr}/cores/arduino/wiring_private.h | 0 .../{ => avr}/cores/arduino/wiring_pulse.c | 0 .../{ => avr}/cores/arduino/wiring_shift.c | 0 ...dfu-usbserial-atmega16u2-Mega2560-Rev3.hex | 0 ...-dfu-usbserial-atmega16u2-MegaADK-Rev3.hex | 0 ...INED-dfu-usbserial-atmega16u2-Uno-Rev3.hex | 0 .../MEGA-dfu_and_usbserial_combined.hex | 0 .../arduino/{ => avr}/firmwares/README.txt | 0 .../UNO-dfu_and_usbserial_combined.hex | 0 .../firmwares/arduino-usbdfu/Arduino-usbdfu.c | 0 .../firmwares/arduino-usbdfu/Arduino-usbdfu.h | 0 .../firmwares/arduino-usbdfu/Board/LEDs.h | 0 .../firmwares/arduino-usbdfu/Descriptors.c | 0 .../firmwares/arduino-usbdfu/Descriptors.h | 0 .../firmwares/arduino-usbdfu/makefile | 0 .../firmwares/arduino-usbdfu/readme.txt | 0 ...ino-usbserial-atmega16u2-Mega2560-Rev3.hex | 0 ...uino-usbserial-atmega16u2-MegaADK-Rev3.hex | 0 .../Arduino-usbserial-atmega16u2-Uno-Rev3.hex | 0 .../Arduino-usbserial-mega.hex | 0 .../Arduino-usbserial-uno.hex | 0 .../arduino-usbserial/Arduino-usbserial.c | 0 .../arduino-usbserial/Arduino-usbserial.h | 0 .../firmwares/arduino-usbserial/Board/LEDs.h | 0 .../firmwares/arduino-usbserial/Descriptors.c | 0 .../firmwares/arduino-usbserial/Descriptors.h | 0 .../Lib/LightweightRingBuff.h | 0 .../firmwares/arduino-usbserial/makefile | 0 .../firmwares/arduino-usbserial/readme.txt | 0 hardware/arduino/avr/platforms.txt | 64 +++++ hardware/arduino/{ => avr}/programmers.txt | 0 .../variants/eightanaloginputs/pins_arduino.h | 0 .../variants/leonardo/pins_arduino.h | 0 .../{ => avr}/variants/mega/pins_arduino.h | 0 .../{ => avr}/variants/micro/pins_arduino.h | 0 .../variants/standard/pins_arduino.h | 0 hardware/arduino/platforms.txt | 64 ----- 131 files changed, 475 insertions(+), 383 deletions(-) create mode 100644 app/src/processing/app/debug/TargetPackage.java rename app/src/processing/app/debug/{Target.java => TargetPlatform.java} (81%) rename app/src/processing/app/{ => helpers}/PreferencesMap.java (98%) create mode 100644 app/src/processing/app/helpers/filefilters/OnlyDirs.java rename hardware/arduino/{ => avr}/boards.txt (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega/ATmegaBOOT_168.c (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega/ATmegaBOOT_168_diecimila.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega/ATmegaBOOT_168_ng.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega/ATmegaBOOT_168_pro_8MHz.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega/Makefile (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega8/ATmegaBOOT.c (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega8/ATmegaBOOT.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/atmega8/Makefile (100%) rename hardware/arduino/{ => avr}/bootloaders/bt/ATmegaBOOT_168.c (100%) rename hardware/arduino/{ => avr}/bootloaders/bt/ATmegaBOOT_168.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/bt/ATmegaBOOT_168_atmega328_bt.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/bt/Makefile (100%) rename hardware/arduino/{ => avr}/bootloaders/diskloader/DiskLoader-Leonardo.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/diskloader/Makefile (100%) rename hardware/arduino/{ => avr}/bootloaders/diskloader/src/DiskLoader.cpp (100%) rename hardware/arduino/{ => avr}/bootloaders/diskloader/src/Platform.h (100%) rename hardware/arduino/{ => avr}/bootloaders/diskloader/src/USBCore.cpp (100%) rename hardware/arduino/{ => avr}/bootloaders/diskloader/src/USBCore.h (100%) rename hardware/arduino/{ => avr}/bootloaders/diskloader/src/USBDesc.cpp (100%) rename hardware/arduino/{ => avr}/bootloaders/diskloader/src/USBDesc.h (100%) rename hardware/arduino/{ => avr}/bootloaders/lilypad/LilyPadBOOT_168.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/lilypad/src/ATmegaBOOT.c (100%) rename hardware/arduino/{ => avr}/bootloaders/lilypad/src/Makefile (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/Makefile (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/README.TXT (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/boot.h (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/makeall (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/omake (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/omake.bat (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/optiboot.c (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/optiboot_atmega168.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/optiboot_atmega168.lst (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/optiboot_atmega328-Mini.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/optiboot_atmega328.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/optiboot_atmega328.lst (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/optiboot_atmega8.hex (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/optiboot_atmega8.lst (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/pin_defs.h (100%) rename hardware/arduino/{ => avr}/bootloaders/optiboot/stk500.h (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/License.txt (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/Makefile (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/STK500V2.pnproj (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/STK500V2.pnps (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/avrinterruptnames.h (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/command.h (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/stk500boot.c (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/stk500boot.ppg (100%) rename hardware/arduino/{ => avr}/bootloaders/stk500v2/stk500boot_v2_mega2560.hex (100%) rename hardware/arduino/{ => avr}/cores/arduino/Arduino.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/CDC.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/Client.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/HID.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/HardwareSerial.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/HardwareSerial.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/IPAddress.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/IPAddress.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/Platform.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/Print.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/Print.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/Printable.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/Server.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/Stream.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/Stream.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/Tone.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/USBAPI.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/USBCore.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/USBCore.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/USBDesc.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/Udp.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/WCharacter.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/WInterrupts.c (100%) rename hardware/arduino/{ => avr}/cores/arduino/WMath.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/WString.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/WString.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/binary.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/main.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/new.cpp (100%) rename hardware/arduino/{ => avr}/cores/arduino/new.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/wiring.c (100%) rename hardware/arduino/{ => avr}/cores/arduino/wiring_analog.c (100%) rename hardware/arduino/{ => avr}/cores/arduino/wiring_digital.c (100%) rename hardware/arduino/{ => avr}/cores/arduino/wiring_private.h (100%) rename hardware/arduino/{ => avr}/cores/arduino/wiring_pulse.c (100%) rename hardware/arduino/{ => avr}/cores/arduino/wiring_shift.c (100%) rename hardware/arduino/{ => avr}/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex (100%) rename hardware/arduino/{ => avr}/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-MegaADK-Rev3.hex (100%) rename hardware/arduino/{ => avr}/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex (100%) rename hardware/arduino/{ => avr}/firmwares/MEGA-dfu_and_usbserial_combined.hex (100%) rename hardware/arduino/{ => avr}/firmwares/README.txt (100%) rename hardware/arduino/{ => avr}/firmwares/UNO-dfu_and_usbserial_combined.hex (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbdfu/Arduino-usbdfu.c (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbdfu/Arduino-usbdfu.h (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbdfu/Board/LEDs.h (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbdfu/Descriptors.c (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbdfu/Descriptors.h (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbdfu/makefile (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbdfu/readme.txt (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Uno-Rev3.hex (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Arduino-usbserial-mega.hex (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Arduino-usbserial.c (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Arduino-usbserial.h (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Board/LEDs.h (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Descriptors.c (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Descriptors.h (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/Lib/LightweightRingBuff.h (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/makefile (100%) rename hardware/arduino/{ => avr}/firmwares/arduino-usbserial/readme.txt (100%) create mode 100644 hardware/arduino/avr/platforms.txt rename hardware/arduino/{ => avr}/programmers.txt (100%) rename hardware/arduino/{ => avr}/variants/eightanaloginputs/pins_arduino.h (100%) rename hardware/arduino/{ => avr}/variants/leonardo/pins_arduino.h (100%) rename hardware/arduino/{ => avr}/variants/mega/pins_arduino.h (100%) rename hardware/arduino/{ => avr}/variants/micro/pins_arduino.h (100%) rename hardware/arduino/{ => avr}/variants/standard/pins_arduino.h (100%) delete mode 100755 hardware/arduino/platforms.txt diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 2d2769494..2e769eb82 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -31,7 +31,10 @@ import java.util.List; import javax.swing.*; import processing.app.debug.Compiler; -import processing.app.debug.Target; +import processing.app.debug.TargetPackage; +import processing.app.debug.TargetPlatform; +import processing.app.helpers.PreferencesMap; +import processing.app.helpers.filefilters.OnlyDirs; import processing.core.*; import static processing.app.I18n._; @@ -90,7 +93,7 @@ public class Base { // found in the sketchbook) static public String librariesClassPath; - static public Map targetsTable; + static public Map targetsTable; // Location for untitled items static File untitledFolder; @@ -267,7 +270,7 @@ public class Base { } } - targetsTable = new HashMap(); + targetsTable = new HashMap(); loadHardware(getHardwareFolder()); loadHardware(getSketchbookHardwareFolder()); @@ -939,52 +942,51 @@ public class Base { } - public void rebuildImportMenu(JMenu importMenu) { - //System.out.println("rebuilding import menu"); - importMenu.removeAll(); + public void rebuildImportMenu(JMenu importMenu) { + // System.out.println("rebuilding import menu"); + importMenu.removeAll(); - // reset the set of libraries - libraries = new HashSet(); + // reset the set of libraries + libraries = new HashSet(); - // reset the table mapping imports to libraries - importToLibraryTable = new HashMap(); + // reset the table mapping imports to libraries + importToLibraryTable = new HashMap(); - // Add from the "libraries" subfolder in the Processing directory - //Choose which library to add by chip platform - - try { - // Find the current target. Get the platform, and then select the - // correct name and core path. - String platformname = getBoardPreferences().get("platform"); - String targetname = getPlatformPreferences(platformname) - .get("name"); - String libraryPath = getPlatformPreferences(platformname).get( - "library.core.path"); + // Add from the "libraries" subfolder in the Processing directory + // Choose which library to add by chip platform - JMenuItem platformItem = new JMenuItem(targetname); - platformItem.setEnabled(false); - importMenu.add(platformItem); - importMenu.addSeparator(); - addLibraries(importMenu, getCoreLibraries(libraryPath)); - } catch (IOException e) { - e.printStackTrace(); - } - // Add libraries found in the sketchbook folder - int separatorIndex = importMenu.getItemCount(); - try { - File sketchbookLibraries = getSketchbookLibrariesFolder(); - boolean found = addLibraries(importMenu, sketchbookLibraries); - if (found) { - JMenuItem contrib = new JMenuItem(_("Contributed")); - contrib.setEnabled(false); - importMenu.insert(contrib, separatorIndex); - importMenu.insertSeparator(separatorIndex); - } - } catch (IOException e) { - e.printStackTrace(); - } - } + try { + // Find the current target. Get the platform, and then select the + // correct name and core path. + String platformname = getBoardPreferences().get("platform"); + String targetname = getPlatformPreferences(platformname).get("name"); + String libraryPath = getPlatformPreferences(platformname).get( + "library.core.path"); + JMenuItem platformItem = new JMenuItem(targetname); + platformItem.setEnabled(false); + importMenu.add(platformItem); + importMenu.addSeparator(); + addLibraries(importMenu, getCoreLibraries(libraryPath)); + } catch (IOException e) { + e.printStackTrace(); + } + + // Add libraries found in the sketchbook folder + int separatorIndex = importMenu.getItemCount(); + try { + File sketchbookLibraries = getSketchbookLibrariesFolder(); + boolean found = addLibraries(importMenu, sketchbookLibraries); + if (found) { + JMenuItem contrib = new JMenuItem(_("Contributed")); + contrib.setEnabled(false); + importMenu.insert(contrib, separatorIndex); + importMenu.insertSeparator(separatorIndex); + } + } catch (IOException e) { + e.printStackTrace(); + } + } public void rebuildExamplesMenu(JMenu menu) { //System.out.println("rebuilding examples menu"); @@ -1008,64 +1010,73 @@ public class Base { } - public void rebuildBoardsMenu(JMenu menu) { + @SuppressWarnings("serial") + public void rebuildBoardsMenu(JMenu menu) { //System.out.println("rebuilding boards menu"); menu.removeAll(); ButtonGroup group = new ButtonGroup(); - for (Target target : targetsTable.values()) { - for (String board : target.getBoards().keySet()) { - AbstractAction action = - new AbstractAction(target.getBoards().get(board).get("name")) { - public void actionPerformed(ActionEvent actionevent) { - //System.out.println("Switching to " + target + ":" + board); - Preferences.set("target", (String) getValue("target")); - Preferences.set("board", (String) getValue("board")); - onBoardOrPortChange(); - Sketch.buildSettingChanged(); - //Debug: created new imports menu based on board - rebuildImportMenu(activeEditor.importMenu); - } - }; - action.putValue("target", target.getName()); - action.putValue("board", board); - JMenuItem item = new JRadioButtonMenuItem(action); - if (target.getName().equals(Preferences.get("target")) && - board.equals(Preferences.get("board"))) { - item.setSelected(true); - } - group.add(item); - menu.add(item); - } - } + for (TargetPackage targetPackage : targetsTable.values()) { + for (TargetPlatform targetPlatform : targetPackage.platforms()) { + for (String board : targetPlatform.getBoards().keySet()) { + AbstractAction action = new AbstractAction(targetPlatform.getBoards().get( + board).get("name")) { + public void actionPerformed(ActionEvent actionevent) { + // System.out.println("Switching to " + target + ":" + board); + Preferences.set("package", (String) getValue("package")); + Preferences.set("platform", (String) getValue("platform")); + Preferences.set("board", (String) getValue("board")); + onBoardOrPortChange(); + Sketch.buildSettingChanged(); + // Debug: created new imports menu based on board + rebuildImportMenu(activeEditor.importMenu); + } + }; + action.putValue("package", targetPackage.getName()); + action.putValue("platform", targetPlatform.getName()); + action.putValue("board", board); + JMenuItem item = new JRadioButtonMenuItem(action); + if (targetPackage.getName().equals(Preferences.get("package")) + && targetPlatform.getName().equals(Preferences.get("platform")) + && board.equals(Preferences.get("board"))) { + item.setSelected(true); + } + group.add(item); + menu.add(item); + } + } + } } - public void rebuildProgrammerMenu(JMenu menu) { + @SuppressWarnings("serial") + public void rebuildProgrammerMenu(JMenu menu) { //System.out.println("rebuilding programmer menu"); menu.removeAll(); ButtonGroup group = new ButtonGroup(); - for (Target target : targetsTable.values()) { - for (String programmer : target.getProgrammers().keySet()) { - AbstractAction action = - new AbstractAction( - target.getProgrammers().get(programmer).get("name")) { - public void actionPerformed(ActionEvent actionevent) { - Preferences.set("programmer", getValue("target") + ":" + - getValue("programmer")); - } - }; - action.putValue("target", target.getName()); - action.putValue("programmer", programmer); - JMenuItem item = new JRadioButtonMenuItem(action); - if (Preferences.get("programmer").equals(target.getName() + ":" + - programmer)) { - item.setSelected(true); - } - group.add(item); - menu.add(item); - } - } - } + for (TargetPackage targetPackage : targetsTable.values()) { + for (TargetPlatform targetPlatform : targetPackage.platforms()) { + for (String programmer : targetPlatform.getProgrammers().keySet()) { + String id = targetPackage.getName() + ":" + targetPlatform.getName() + ":" + + programmer; + AbstractAction action = new AbstractAction(targetPlatform.getProgrammers() + .get(programmer).get("name")) { + public void actionPerformed(ActionEvent actionevent) { + Preferences.set("programmer", "" + getValue("id")); + } + }; +// action.putValue("package", targetPackage.getName()); +// action.putValue("platform", targetPlatform.getName()); +// action.putValue("programmer", programmer); + action.putValue("id", id); + JMenuItem item = new JRadioButtonMenuItem(action); + if (Preferences.get("programmer").equals(id)) + item.setSelected(true); + group.add(item); + menu.add(item); + } + } + } + } /** @@ -1260,14 +1271,8 @@ public class Base { protected void loadHardware(File folder) { if (!folder.isDirectory()) return; - String list[] = folder.list(new FilenameFilter() { - public boolean accept(File dir, String name) { - // skip .DS_Store files, .svn folders, etc - if (name.charAt(0) == '.') return false; - if (name.equals("CVS")) return false; - return (new File(dir, name).isDirectory()); - } - }); + String list[] = folder.list(new OnlyDirs()); + // if a bad folder or something like that, this might come back null if (list == null) return; @@ -1277,7 +1282,7 @@ public class Base { for (String target : list) { File subfolder = new File(folder, target); - targetsTable.put(target, new Target(target, subfolder)); + targetsTable.put(target, new TargetPackage(target, subfolder)); } } @@ -1560,36 +1565,38 @@ public class Base { } - static public Target getTarget() { - System.out.println("Base.targetsTable.get(Preferences.get(\"target\"))" + Base.targetsTable.get(Preferences.get("target"))); - System.out.println("Preferences.get(\"target\")" + Preferences.get("target")); - Target target = Base.targetsTable.get(Preferences.get("target")); - if (target == null) { - System.out.println("default target is not in list. Replace with default."); - Preferences.set("target", "arduino"); - target = Base.targetsTable.get(Preferences.get("target")); + static public TargetPlatform getTarget() { + TargetPackage pack = targetsTable.get(Preferences.get("target_package")); + TargetPlatform platform = pack.get(Preferences.get("target_platform")); + if (platform == null) { + System.out.println("Selected platform is not in list. Replace with default."); + Preferences.set("target_platform", "arduino"); + platform = pack.get(Preferences.get("target_platform")); } - return target; + return platform; } static public PreferencesMap getPlatformPreferences() { - Target target = getTarget(); - Map platforms = target.getPlatforms(); - return platforms.get(Preferences.get("platform")); + return getTarget().getPlatform(); } - //Get a specific platform - static public PreferencesMap getPlatformPreferences(String platformName) { - if (platformName == null) - platformName = Preferences.get("platform"); - Target target = getTarget(); - Map platforms = target.getPlatforms(); - return platforms.get(platformName); + // Search for a specific platform + static public TargetPlatform getTargetPlatform(String pack, String platform) { + return targetsTable.get(pack).get(platform); } + + // Get a specific platform preferences inside actual package + static public PreferencesMap getPlatformPreferences(String platformName) { + if (platformName == null) + platformName = Preferences.get("platform"); + TargetPackage pack = targetsTable.get(Preferences.get("target_package")); + TargetPlatform target = pack.get(platformName); + return target.getPlatform(); + } static public PreferencesMap getBoardPreferences() { - Target target = getTarget(); + TargetPlatform target = getTarget(); if (target != null) { String board = Preferences.get("board"); return target.getBoards().get(board); diff --git a/app/src/processing/app/Preferences.java b/app/src/processing/app/Preferences.java index 93038ce80..865433cde 100644 --- a/app/src/processing/app/Preferences.java +++ b/app/src/processing/app/Preferences.java @@ -30,6 +30,7 @@ import java.util.*; import javax.swing.*; +import processing.app.helpers.PreferencesMap; import processing.app.syntax.*; import processing.core.*; import static processing.app.I18n._; diff --git a/app/src/processing/app/debug/AvrdudeUploader.java b/app/src/processing/app/debug/AvrdudeUploader.java index c3536d1ca..eea81649b 100755 --- a/app/src/processing/app/debug/AvrdudeUploader.java +++ b/app/src/processing/app/debug/AvrdudeUploader.java @@ -26,34 +26,35 @@ package processing.app.debug; +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + import processing.app.Base; import processing.app.Preferences; import processing.app.SerialException; - -import java.io.*; -import java.util.*; - +import processing.app.helpers.PreferencesMap; public class AvrdudeUploader extends Uploader { - public AvrdudeUploader() { - } public boolean uploadUsingPreferences(String buildPath, String className, boolean usingProgrammer) throws RunnerException, SerialException { - Map boardPreferences = Base.getBoardPreferences(); + PreferencesMap boardPreferences = Base.getBoardPreferences(); // if no protocol is specified for this board, assume it lacks a // bootloader and upload using the selected programmer. if (usingProgrammer || boardPreferences.get("upload.protocol") == null) { String programmer = Preferences.get("programmer"); - Target target = Base.getTarget(); + TargetPlatform targetPlatform = Base.getTarget(); - if (programmer.indexOf(":") != -1) { - target = Base.targetsTable.get(programmer.substring(0, programmer.indexOf(":"))); - programmer = programmer.substring(programmer.indexOf(":") + 1); + if (programmer.contains(":")) { + String[] split = programmer.split(":"); + targetPlatform = Base.getTargetPlatform(split[0], split[1]); + programmer = split[2]; } - Collection params = getProgrammerCommands(target, programmer); + Collection params = getProgrammerCommands(targetPlatform, programmer); params.add("-Uflash:w:" + buildPath + File.separator + className + ".hex:i"); return avrdude(params); } @@ -63,8 +64,8 @@ public class AvrdudeUploader extends Uploader { private boolean uploadViaBootloader(String buildPath, String className) throws RunnerException, SerialException { - Map boardPreferences = Base.getBoardPreferences(); - List commandDownloader = new ArrayList(); + PreferencesMap boardPreferences = Base.getBoardPreferences(); + List commandDownloader = new ArrayList(); String protocol = boardPreferences.get("upload.protocol"); // avrdude wants "stk500v1" to distinguish it from stk500v2 @@ -88,17 +89,18 @@ public class AvrdudeUploader extends Uploader { public boolean burnBootloader() throws RunnerException { String programmer = Preferences.get("programmer"); - Target target = Base.getTarget(); - if (programmer.indexOf(":") != -1) { - target = Base.targetsTable.get(programmer.substring(0, programmer.indexOf(":"))); - programmer = programmer.substring(programmer.indexOf(":") + 1); + TargetPlatform targetPlatform = Base.getTarget(); + if (programmer.contains(":")) { + String[] split = programmer.split(":"); + targetPlatform = Base.getTargetPlatform(split[0], split[1]); + programmer = split[2]; } - return burnBootloader(getProgrammerCommands(target, programmer)); + return burnBootloader(getProgrammerCommands(targetPlatform, programmer)); } - private Collection getProgrammerCommands(Target target, String programmer) { - Map programmerPreferences = target.getProgrammers().get(programmer); - List params = new ArrayList(); + private Collection getProgrammerCommands(TargetPlatform target, String programmer) { + PreferencesMap programmerPreferences = target.getProgrammers().get(programmer); + List params = new ArrayList(); params.add("-c" + programmerPreferences.get("protocol")); if ("usb".equals(programmerPreferences.get("communication"))) { @@ -122,10 +124,10 @@ public class AvrdudeUploader extends Uploader { return params; } - protected boolean burnBootloader(Collection params) + protected boolean burnBootloader(Collection params) throws RunnerException { - Map boardPreferences = Base.getBoardPreferences(); - List fuses = new ArrayList(); + PreferencesMap boardPreferences = Base.getBoardPreferences(); + List fuses = new ArrayList(); fuses.add("-e"); // erase the chip if (boardPreferences.get("bootloader.unlock_bits") != null) fuses.add("-Ulock:w:" + boardPreferences.get("bootloader.unlock_bits") + ":m"); @@ -141,26 +143,27 @@ public class AvrdudeUploader extends Uploader { Thread.sleep(1000); } catch (InterruptedException e) {} - Target t; - List bootloader = new ArrayList(); + List bootloader = new ArrayList(); String bootloaderPath = boardPreferences.get("bootloader.path"); - if (bootloaderPath != null) { - if (bootloaderPath.indexOf(':') == -1) { - t = Base.getTarget(); // the current target (associated with the board) - } else { - String targetName = bootloaderPath.substring(0, bootloaderPath.indexOf(':')); - t = Base.targetsTable.get(targetName); - bootloaderPath = bootloaderPath.substring(bootloaderPath.indexOf(':') + 1); - } - - File bootloadersFile = new File(t.getFolder(), "bootloaders"); - File bootloaderFile = new File(bootloadersFile, bootloaderPath); - bootloaderPath = bootloaderFile.getAbsolutePath(); - - bootloader.add("-Uflash:w:" + bootloaderPath + File.separator + - boardPreferences.get("bootloader.file") + ":i"); - } + if (bootloaderPath != null) { + TargetPlatform targetPlatform; + if (bootloaderPath.contains(":")) { + // the current target (associated with the board) + targetPlatform = Base.getTarget(); + } else { + String[] split = bootloaderPath.split(":", 3); + targetPlatform = Base.getTargetPlatform(split[0], split[1]); + bootloaderPath = split[2]; + } + + File bootloadersFile = new File(targetPlatform.getFolder(), "bootloaders"); + File bootloaderFile = new File(bootloadersFile, bootloaderPath); + bootloaderPath = bootloaderFile.getAbsolutePath(); + + bootloader.add("-Uflash:w:" + bootloaderPath + File.separator + + boardPreferences.get("bootloader.file") + ":i"); + } if (boardPreferences.get("bootloader.lock_bits") != null) bootloader.add("-Ulock:w:" + boardPreferences.get("bootloader.lock_bits") + ":m"); @@ -170,14 +173,14 @@ public class AvrdudeUploader extends Uploader { return true; } - public boolean avrdude(Collection p1, Collection p2) throws RunnerException { - ArrayList p = new ArrayList(p1); + public boolean avrdude(Collection p1, Collection p2) throws RunnerException { + List p = new ArrayList(p1); p.addAll(p2); return avrdude(p); } - public boolean avrdude(Collection params) throws RunnerException { - List commandDownloader = new ArrayList(); + public boolean avrdude(Collection params) throws RunnerException { + List commandDownloader = new ArrayList(); if(Base.isLinux()) { if ((new File(Base.getHardwarePath() + "/tools/" + "avrdude")).exists()) { diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 7ddcc8725..839c0375e 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -36,11 +36,11 @@ import java.util.List; import java.util.Map; import processing.app.Base; -import processing.app.PreferencesMap; import processing.app.I18n; import processing.app.Preferences; import processing.app.Sketch; import processing.app.SketchCode; +import processing.app.helpers.PreferencesMap; import processing.core.PApplet; public class Compiler implements MessageConsumer { @@ -82,103 +82,102 @@ public class Compiler implements MessageConsumer { PreferencesMap boardPreferences = Base.getBoardPreferences(); // Check for null platform, and use system default if not found - PreferencesMap platformPreferences; - String platform = boardPreferences.get("platform"); - if (platform == null) - platformPreferences = Base.getPlatformPreferences(); - else - platformPreferences = Base.getPlatformPreferences(platform); - - // Merge all the global preference configuration - PreferencesMap configPreferences = new PreferencesMap(); - configPreferences.putAll(Preferences.getMap()); - configPreferences.putAll(platformPreferences); - configPreferences.putAll(boardPreferences); - for (String k : configPreferences.keySet()) { - if (configPreferences.get(k)==null) - configPreferences.put(k, ""); - } - - String avrBasePath = configPreferences.get("compiler.path"); - if (avrBasePath == null) - { - avrBasePath = Base.getAvrBasePath(); - System.out.println("avrBasePath: " + avrBasePath); - } - else - { - System.out.println("avrBasePath:exists: " + avrBasePath); + String platform = boardPreferences.get("platform"); + PreferencesMap platformPreferences; + if (platform == null) + platformPreferences = Base.getPlatformPreferences(); + else + platformPreferences = Base.getPlatformPreferences(platform); - //Put in the system path in the compiler path if available - MessageFormat compileFormat = new MessageFormat(avrBasePath); - String basePath = System.getProperty("user.dir"); - if (Base.isMacOS()) { - //logger.debug("basePath: " + basePath); - basePath += "/Arduino.app/Contents/Resources/Java"; + // Merge all the global preference configuration + PreferencesMap configPreferences = new PreferencesMap(); + configPreferences.putAll(Preferences.getMap()); + configPreferences.putAll(platformPreferences); + configPreferences.putAll(boardPreferences); + for (String k : configPreferences.keySet()) { + if (configPreferences.get(k) == null) + configPreferences.put(k, ""); } - Object[] Args = {basePath}; - avrBasePath = compileFormat.format( Args ); - System.out.println("avrBasePath:new: " + avrBasePath); - } - board = configPreferences.get("board"); - if (board == "") - board = "_UNKNOWN"; - - String core = configPreferences.get("build.core"); - if (core == null) { - RunnerException re = new RunnerException(_("No board selected; please choose a board from the Tools > Board menu.")); - re.hideStackTrace(); - throw re; - } - String corePath; - if (core.indexOf(':') == -1) { - Target t = Base.getTarget(); - File coreFolder = new File(new File(t.getFolder(), "cores"), core); - corePath = coreFolder.getAbsolutePath(); + String avrBasePath = configPreferences.get("compiler.path"); + if (avrBasePath == null) { + avrBasePath = Base.getAvrBasePath(); + System.out.println("avrBasePath: " + avrBasePath); + } else { + System.out.println("avrBasePath:exists: " + avrBasePath); + + // Put in the system path in the compiler path if available + MessageFormat compileFormat = new MessageFormat(avrBasePath); + String basePath = System.getProperty("user.dir"); + if (Base.isMacOS()) { + // logger.debug("basePath: " + basePath); + basePath += "/Arduino.app/Contents/Resources/Java"; + } + Object[] Args = { basePath }; + avrBasePath = compileFormat.format(Args); + System.out.println("avrBasePath:new: " + avrBasePath); + } + board = configPreferences.get("board"); + if (board == "") + board = "_UNKNOWN"; + + String core = configPreferences.get("build.core"); + if (core == null) { + RunnerException re = new RunnerException( + _("No board selected; please choose a board from the Tools > Board menu.")); + re.hideStackTrace(); + throw re; + } + + File coreFolder; + if (!core.contains(":")) { + TargetPlatform t = Base.getTarget(); + coreFolder = new File(t.getFolder(), "cores"); + coreFolder = new File(coreFolder, core); } else { - Target t = Base.targetsTable.get(core.substring(0, core.indexOf(':'))); - File coreFolder = new File(t.getFolder(), "cores"); - coreFolder = new File(coreFolder, core.substring(core.indexOf(':') + 1)); - corePath = coreFolder.getAbsolutePath(); + String[] split = core.split(":", 3); + TargetPlatform t = Base.getTargetPlatform(split[0], split[1]); + coreFolder = new File(t.getFolder(), "cores"); + coreFolder = new File(coreFolder, split[2]); } + String corePath = coreFolder.getAbsolutePath(); String variant = boardPreferences.get("build.variant"); String variantPath = null; - if (variant != null) { - if (variant.indexOf(':') == -1) { - Target t = Base.getTarget(); - File variantFolder = new File(new File(t.getFolder(), "variants"), variant); - variantPath = variantFolder.getAbsolutePath(); - } else { - Target t = Base.targetsTable.get(variant.substring(0, variant.indexOf(':'))); - File variantFolder = new File(t.getFolder(), "variants"); - variantFolder = new File(variantFolder, variant.substring(variant.indexOf(':') + 1)); - variantPath = variantFolder.getAbsolutePath(); - } - } + if (variant != null) { + File variantFolder; + if (!variant.contains(":")) { + TargetPlatform t = Base.getTarget(); + variantFolder = new File(t.getFolder(), "variants"); + variantFolder = new File(variantFolder, variant); + } else { + String[] split = variant.split(":"); + TargetPlatform t = Base.getTargetPlatform(split[0], split[1]); + variantFolder = new File(t.getFolder(), "variants"); + variantFolder = new File(variantFolder, split[2]); + } + variantPath = variantFolder.getAbsolutePath(); + } - // 0. include paths for core + all libraries - sketch.setCompilingProgress(20); - List includePaths = new ArrayList(); - includePaths.add(corePath); - if (variantPath != null) - includePaths.add(variantPath); - for (File file : sketch.getImportedLibraries()) - includePaths.add(file.getPath()); + // 0. include paths for core + all libraries + sketch.setCompilingProgress(20); + List includePaths = new ArrayList(); + includePaths.add(corePath); + if (variantPath != null) + includePaths.add(variantPath); + for (File file : sketch.getImportedLibraries()) + includePaths.add(file.getPath()); - // 1. compile the sketch (already in the buildPath) - System.out.println("1. compileSketch"); - sketch.setCompilingProgress(30); - compileSketch(avrBasePath, _buildPath, includePaths, configPreferences); + // 1. compile the sketch (already in the buildPath) + System.out.println("1. compileSketch"); + sketch.setCompilingProgress(30); + compileSketch(avrBasePath, _buildPath, includePaths, configPreferences); - // 2. compile the libraries, outputting .o files to: // - // 2. compile the libraries, outputting .o files to: - // // - //Doesn't really use configPreferences - System.out.println("2. compileLibraries"); - sketch.setCompilingProgress(40); - compileLibraries(avrBasePath, _buildPath, includePaths, configPreferences); + // 2. compile the libraries, outputting .o files to: // + // Doesn't really use configPreferences + System.out.println("2. compileLibraries"); + sketch.setCompilingProgress(40); + compileLibraries(avrBasePath, _buildPath, includePaths, configPreferences); /* for (File libraryFolder : sketch.getImportedLibraries()) { @@ -206,13 +205,13 @@ public class Compiler implements MessageConsumer { } */ - // 3. compile the core, outputting .o files to and then - // collecting them into the core.a library file. - System.out.println("3. compileCore"); - System.out.println("corePath: " + corePath); - sketch.setCompilingProgress(50); - compileCore(avrBasePath, _buildPath, corePath, variant, variantPath, configPreferences); - + // 3. compile the core, outputting .o files to and then + // collecting them into the core.a library file. + System.out.println("3. compileCore"); + System.out.println("corePath: " + corePath); + sketch.setCompilingProgress(50); + compileCore(avrBasePath, _buildPath, corePath, variant, variantPath, + configPreferences); /* includePaths.clear(); @@ -237,10 +236,11 @@ public class Compiler implements MessageConsumer { execAsynchronously(commandAR); } */ - // 4. link it all together into the .elf file - sketch.setCompilingProgress(60); - System.out.println("4. compileLink"); - compileLink(avrBasePath, _buildPath, corePath, includePaths, configPreferences); + // 4. link it all together into the .elf file + sketch.setCompilingProgress(60); + System.out.println("4. compileLink"); + compileLink(avrBasePath, _buildPath, corePath, includePaths, + configPreferences); /* List baseCommandLinker = new ArrayList(Arrays.asList(new String[] { @@ -271,8 +271,8 @@ public class Compiler implements MessageConsumer { List commandObjcopy; */ - // 5. extract EEPROM data (from EEMEM directive) to .eep file. - sketch.setCompilingProgress(70); + // 5. extract EEPROM data (from EEMEM directive) to .eep file. + sketch.setCompilingProgress(70); /* commandObjcopy = new ArrayList(baseCommandObjcopy); commandObjcopy.add(2, "ihex"); @@ -286,11 +286,11 @@ public class Compiler implements MessageConsumer { commandObjcopy.add(buildPath + File.separator + primaryClassName + ".eep"); execAsynchronously(commandObjcopy); */ - System.out.println("5. compileEep"); - compileEep(avrBasePath, _buildPath, includePaths, configPreferences); - - // 6. build the .hex file - sketch.setCompilingProgress(80); + System.out.println("5. compileEep"); + compileEep(avrBasePath, _buildPath, includePaths, configPreferences); + + // 6. build the .hex file + sketch.setCompilingProgress(80); /* commandObjcopy = new ArrayList(baseCommandObjcopy); commandObjcopy.add(2, "ihex"); @@ -299,13 +299,12 @@ public class Compiler implements MessageConsumer { commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex"); execAsynchronously(commandObjcopy); */ - System.out.println("6. compileHex"); - compileHex(avrBasePath, _buildPath, includePaths, configPreferences); - - sketch.setCompilingProgress(90); - return true; - } + System.out.println("6. compileHex"); + compileHex(avrBasePath, _buildPath, includePaths, configPreferences); + sketch.setCompilingProgress(90); + return true; + } private List compileFiles(String avrBasePath, String buildPath, List includePaths, @@ -425,22 +424,20 @@ public class Compiler implements MessageConsumer { */ private void execAsynchronously(String[] command) throws RunnerException { - //eliminate any empty array entries - List stringList = new ArrayList(); - for(String string : command) { - string = string.trim(); - if(string != null && string.length() > 0) { - stringList.add(string); - } - } - command = stringList.toArray(new String[stringList.size()]); + // eliminate any empty array entries + List stringList = new ArrayList(); + for (String string : command) { + string = string.trim(); + if (!string.isEmpty()) + stringList.add(string); + } + command = stringList.toArray(new String[stringList.size()]); int result = 0; if (verbose || Preferences.getBoolean("build.verbose")) { - for(int j = 0; j < command.length; j++) { - System.out.print(command[j] + " "); - } + for (String c : command) + System.out.print(c + " "); System.out.println(); } @@ -483,18 +480,18 @@ public class Compiler implements MessageConsumer { //System.out.println("throwing up " + exception); if (exception != null) { throw exception; } - if (result > 1) { - // a failure in the tool (e.g. unable to locate a sub-executable) - System.err.println( - I18n.format(_("{0} returned {1}"), command[0], result)); - } + if (result > 1) { + // a failure in the tool (e.g. unable to locate a sub-executable) + System.err + .println(I18n.format(_("{0} returned {1}"), command[0], result)); + } - if (result != 0) { - RunnerException re = new RunnerException(_("Error compiling.")); - re.hideStackTrace(); - throw re; - } - System.out.println("execAsync: Done."); + if (result != 0) { + RunnerException re = new RunnerException(_("Error compiling.")); + re.hideStackTrace(); + throw re; + } + System.out.println("execAsync: Done."); } diff --git a/app/src/processing/app/debug/TargetPackage.java b/app/src/processing/app/debug/TargetPackage.java new file mode 100644 index 000000000..5fe85e3f8 --- /dev/null +++ b/app/src/processing/app/debug/TargetPackage.java @@ -0,0 +1,44 @@ +package processing.app.debug; + +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import processing.app.helpers.filefilters.OnlyDirs; + +public class TargetPackage { + + String name; + File folder; + + Map platforms = new HashMap(); + + public TargetPackage(String _name, File _folder) { + name = _name; + folder = _folder; + + String[] platformsList = folder.list(new OnlyDirs()); + for (String platformName : platformsList) { + File platformFolder = new File(folder, platformName); + TargetPlatform platform = new TargetPlatform(platformName, platformFolder); + platforms.put(platformName, platform); + } + } + + public Map getPlatforms() { + return platforms; + } + + public Collection platforms() { + return platforms.values(); + } + + public TargetPlatform get(String platform) { + return platforms.get(platform); + } + + public String getName() { + return name; + } +} diff --git a/app/src/processing/app/debug/Target.java b/app/src/processing/app/debug/TargetPlatform.java similarity index 81% rename from app/src/processing/app/debug/Target.java rename to app/src/processing/app/debug/TargetPlatform.java index d5bc9f1d3..f504a498d 100644 --- a/app/src/processing/app/debug/Target.java +++ b/app/src/processing/app/debug/TargetPlatform.java @@ -29,22 +29,22 @@ import java.io.File; import java.util.HashMap; import java.util.Map; -import processing.app.PreferencesMap; +import processing.app.helpers.PreferencesMap; -public class Target { +public class TargetPlatform { private String name; private File folder; private Map boards; private Map programmers; - private Map platforms; + private PreferencesMap platform; - public Target(String _name, File _folder) { - System.out.println("Target: constructor start, name: " + _name); + public TargetPlatform(String _name, File _folder) { + System.out.println("TargetPlatform: constructor start, name: " + _name); name = _name; folder = _folder; boards = new HashMap(); programmers = new HashMap(); - platforms = new HashMap(); + platform = new PreferencesMap(); try { File boardsFile = new File(_folder, "boards.txt"); @@ -59,11 +59,8 @@ public class Target { try { File platformsFile = new File(_folder, "platforms.txt"); - if (platformsFile.exists()) { - PreferencesMap platformPreferences = new PreferencesMap(); - platformPreferences.load(platformsFile); - platforms = platformPreferences.createFirstLevelMap(); - } + if (platformsFile.exists()) + platform.load(platformsFile); } catch (Exception e) { System.err.println("Error loading platforms from platform.txt: " + e); @@ -99,7 +96,7 @@ public class Target { return programmers; } - public Map getPlatforms() { - return platforms; + public PreferencesMap getPlatform() { + return platform; } } diff --git a/app/src/processing/app/PreferencesMap.java b/app/src/processing/app/helpers/PreferencesMap.java similarity index 98% rename from app/src/processing/app/PreferencesMap.java rename to app/src/processing/app/helpers/PreferencesMap.java index 6ef2f6bdb..36668d6eb 100644 --- a/app/src/processing/app/PreferencesMap.java +++ b/app/src/processing/app/helpers/PreferencesMap.java @@ -21,7 +21,7 @@ $Id$ */ -package processing.app; +package processing.app.helpers; import java.io.File; import java.io.FileInputStream; diff --git a/app/src/processing/app/helpers/filefilters/OnlyDirs.java b/app/src/processing/app/helpers/filefilters/OnlyDirs.java new file mode 100644 index 000000000..bd26e12b3 --- /dev/null +++ b/app/src/processing/app/helpers/filefilters/OnlyDirs.java @@ -0,0 +1,43 @@ +/* + OnlyDirs - FilenameFilter that accepts only directories (CVS, .svn, + .DS_Store files are excluded as well) + Part of the Arduino project - http://www.arduino.cc/ + + Copyright (c) 2011 Cristian Maglie + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package processing.app.helpers.filefilters; + +import java.io.File; +import java.io.FilenameFilter; + +/** + * This filter accepts only directories (excluding .DS_Store files, .svn + * folders, etc) + * + * @author Cristian Maglie + */ +public class OnlyDirs implements FilenameFilter { + + @Override + public boolean accept(File dir, String name) { + if (name.charAt(0) == '.') + return false; + if (name.equals("CVS")) + return false; + return new File(dir, name).isDirectory(); + } +} diff --git a/build/shared/lib/preferences.txt b/build/shared/lib/preferences.txt index c1d370cfe..524d78dc5 100755 --- a/build/shared/lib/preferences.txt +++ b/build/shared/lib/preferences.txt @@ -237,9 +237,9 @@ run.present.exclusive = false run.present.exclusive.macosx = true # ARDUINO PREFERENCES +target_package = arduino +target_platform = avr board = uno -target = arduino -platform = avr software=ARDUINO programmer = arduino:avrispmkii diff --git a/hardware/arduino/boards.txt b/hardware/arduino/avr/boards.txt similarity index 100% rename from hardware/arduino/boards.txt rename to hardware/arduino/avr/boards.txt diff --git a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168.c b/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168.c similarity index 100% rename from hardware/arduino/bootloaders/atmega/ATmegaBOOT_168.c rename to hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168.c diff --git a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex b/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex similarity index 100% rename from hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex rename to hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega1280.hex diff --git a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex b/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex similarity index 100% rename from hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex rename to hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex diff --git a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex b/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex similarity index 100% rename from hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex rename to hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex diff --git a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_diecimila.hex b/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_diecimila.hex similarity index 100% rename from hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_diecimila.hex rename to hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_diecimila.hex diff --git a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_ng.hex b/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_ng.hex similarity index 100% rename from hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_ng.hex rename to hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_ng.hex diff --git a/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_pro_8MHz.hex b/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_pro_8MHz.hex similarity index 100% rename from hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_pro_8MHz.hex rename to hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_pro_8MHz.hex diff --git a/hardware/arduino/bootloaders/atmega/Makefile b/hardware/arduino/avr/bootloaders/atmega/Makefile similarity index 100% rename from hardware/arduino/bootloaders/atmega/Makefile rename to hardware/arduino/avr/bootloaders/atmega/Makefile diff --git a/hardware/arduino/bootloaders/atmega8/ATmegaBOOT.c b/hardware/arduino/avr/bootloaders/atmega8/ATmegaBOOT.c similarity index 100% rename from hardware/arduino/bootloaders/atmega8/ATmegaBOOT.c rename to hardware/arduino/avr/bootloaders/atmega8/ATmegaBOOT.c diff --git a/hardware/arduino/bootloaders/atmega8/ATmegaBOOT.hex b/hardware/arduino/avr/bootloaders/atmega8/ATmegaBOOT.hex similarity index 100% rename from hardware/arduino/bootloaders/atmega8/ATmegaBOOT.hex rename to hardware/arduino/avr/bootloaders/atmega8/ATmegaBOOT.hex diff --git a/hardware/arduino/bootloaders/atmega8/Makefile b/hardware/arduino/avr/bootloaders/atmega8/Makefile similarity index 100% rename from hardware/arduino/bootloaders/atmega8/Makefile rename to hardware/arduino/avr/bootloaders/atmega8/Makefile diff --git a/hardware/arduino/bootloaders/bt/ATmegaBOOT_168.c b/hardware/arduino/avr/bootloaders/bt/ATmegaBOOT_168.c similarity index 100% rename from hardware/arduino/bootloaders/bt/ATmegaBOOT_168.c rename to hardware/arduino/avr/bootloaders/bt/ATmegaBOOT_168.c diff --git a/hardware/arduino/bootloaders/bt/ATmegaBOOT_168.hex b/hardware/arduino/avr/bootloaders/bt/ATmegaBOOT_168.hex similarity index 100% rename from hardware/arduino/bootloaders/bt/ATmegaBOOT_168.hex rename to hardware/arduino/avr/bootloaders/bt/ATmegaBOOT_168.hex diff --git a/hardware/arduino/bootloaders/bt/ATmegaBOOT_168_atmega328_bt.hex b/hardware/arduino/avr/bootloaders/bt/ATmegaBOOT_168_atmega328_bt.hex similarity index 100% rename from hardware/arduino/bootloaders/bt/ATmegaBOOT_168_atmega328_bt.hex rename to hardware/arduino/avr/bootloaders/bt/ATmegaBOOT_168_atmega328_bt.hex diff --git a/hardware/arduino/bootloaders/bt/Makefile b/hardware/arduino/avr/bootloaders/bt/Makefile similarity index 100% rename from hardware/arduino/bootloaders/bt/Makefile rename to hardware/arduino/avr/bootloaders/bt/Makefile diff --git a/hardware/arduino/bootloaders/diskloader/DiskLoader-Leonardo.hex b/hardware/arduino/avr/bootloaders/diskloader/DiskLoader-Leonardo.hex similarity index 100% rename from hardware/arduino/bootloaders/diskloader/DiskLoader-Leonardo.hex rename to hardware/arduino/avr/bootloaders/diskloader/DiskLoader-Leonardo.hex diff --git a/hardware/arduino/bootloaders/diskloader/Makefile b/hardware/arduino/avr/bootloaders/diskloader/Makefile similarity index 100% rename from hardware/arduino/bootloaders/diskloader/Makefile rename to hardware/arduino/avr/bootloaders/diskloader/Makefile diff --git a/hardware/arduino/bootloaders/diskloader/src/DiskLoader.cpp b/hardware/arduino/avr/bootloaders/diskloader/src/DiskLoader.cpp similarity index 100% rename from hardware/arduino/bootloaders/diskloader/src/DiskLoader.cpp rename to hardware/arduino/avr/bootloaders/diskloader/src/DiskLoader.cpp diff --git a/hardware/arduino/bootloaders/diskloader/src/Platform.h b/hardware/arduino/avr/bootloaders/diskloader/src/Platform.h similarity index 100% rename from hardware/arduino/bootloaders/diskloader/src/Platform.h rename to hardware/arduino/avr/bootloaders/diskloader/src/Platform.h diff --git a/hardware/arduino/bootloaders/diskloader/src/USBCore.cpp b/hardware/arduino/avr/bootloaders/diskloader/src/USBCore.cpp similarity index 100% rename from hardware/arduino/bootloaders/diskloader/src/USBCore.cpp rename to hardware/arduino/avr/bootloaders/diskloader/src/USBCore.cpp diff --git a/hardware/arduino/bootloaders/diskloader/src/USBCore.h b/hardware/arduino/avr/bootloaders/diskloader/src/USBCore.h similarity index 100% rename from hardware/arduino/bootloaders/diskloader/src/USBCore.h rename to hardware/arduino/avr/bootloaders/diskloader/src/USBCore.h diff --git a/hardware/arduino/bootloaders/diskloader/src/USBDesc.cpp b/hardware/arduino/avr/bootloaders/diskloader/src/USBDesc.cpp similarity index 100% rename from hardware/arduino/bootloaders/diskloader/src/USBDesc.cpp rename to hardware/arduino/avr/bootloaders/diskloader/src/USBDesc.cpp diff --git a/hardware/arduino/bootloaders/diskloader/src/USBDesc.h b/hardware/arduino/avr/bootloaders/diskloader/src/USBDesc.h similarity index 100% rename from hardware/arduino/bootloaders/diskloader/src/USBDesc.h rename to hardware/arduino/avr/bootloaders/diskloader/src/USBDesc.h diff --git a/hardware/arduino/bootloaders/lilypad/LilyPadBOOT_168.hex b/hardware/arduino/avr/bootloaders/lilypad/LilyPadBOOT_168.hex similarity index 100% rename from hardware/arduino/bootloaders/lilypad/LilyPadBOOT_168.hex rename to hardware/arduino/avr/bootloaders/lilypad/LilyPadBOOT_168.hex diff --git a/hardware/arduino/bootloaders/lilypad/src/ATmegaBOOT.c b/hardware/arduino/avr/bootloaders/lilypad/src/ATmegaBOOT.c similarity index 100% rename from hardware/arduino/bootloaders/lilypad/src/ATmegaBOOT.c rename to hardware/arduino/avr/bootloaders/lilypad/src/ATmegaBOOT.c diff --git a/hardware/arduino/bootloaders/lilypad/src/Makefile b/hardware/arduino/avr/bootloaders/lilypad/src/Makefile similarity index 100% rename from hardware/arduino/bootloaders/lilypad/src/Makefile rename to hardware/arduino/avr/bootloaders/lilypad/src/Makefile diff --git a/hardware/arduino/bootloaders/optiboot/Makefile b/hardware/arduino/avr/bootloaders/optiboot/Makefile similarity index 100% rename from hardware/arduino/bootloaders/optiboot/Makefile rename to hardware/arduino/avr/bootloaders/optiboot/Makefile diff --git a/hardware/arduino/bootloaders/optiboot/README.TXT b/hardware/arduino/avr/bootloaders/optiboot/README.TXT similarity index 100% rename from hardware/arduino/bootloaders/optiboot/README.TXT rename to hardware/arduino/avr/bootloaders/optiboot/README.TXT diff --git a/hardware/arduino/bootloaders/optiboot/boot.h b/hardware/arduino/avr/bootloaders/optiboot/boot.h similarity index 100% rename from hardware/arduino/bootloaders/optiboot/boot.h rename to hardware/arduino/avr/bootloaders/optiboot/boot.h diff --git a/hardware/arduino/bootloaders/optiboot/makeall b/hardware/arduino/avr/bootloaders/optiboot/makeall similarity index 100% rename from hardware/arduino/bootloaders/optiboot/makeall rename to hardware/arduino/avr/bootloaders/optiboot/makeall diff --git a/hardware/arduino/bootloaders/optiboot/omake b/hardware/arduino/avr/bootloaders/optiboot/omake similarity index 100% rename from hardware/arduino/bootloaders/optiboot/omake rename to hardware/arduino/avr/bootloaders/optiboot/omake diff --git a/hardware/arduino/bootloaders/optiboot/omake.bat b/hardware/arduino/avr/bootloaders/optiboot/omake.bat similarity index 100% rename from hardware/arduino/bootloaders/optiboot/omake.bat rename to hardware/arduino/avr/bootloaders/optiboot/omake.bat diff --git a/hardware/arduino/bootloaders/optiboot/optiboot.c b/hardware/arduino/avr/bootloaders/optiboot/optiboot.c similarity index 100% rename from hardware/arduino/bootloaders/optiboot/optiboot.c rename to hardware/arduino/avr/bootloaders/optiboot/optiboot.c diff --git a/hardware/arduino/bootloaders/optiboot/optiboot_atmega168.hex b/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega168.hex similarity index 100% rename from hardware/arduino/bootloaders/optiboot/optiboot_atmega168.hex rename to hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega168.hex diff --git a/hardware/arduino/bootloaders/optiboot/optiboot_atmega168.lst b/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega168.lst similarity index 100% rename from hardware/arduino/bootloaders/optiboot/optiboot_atmega168.lst rename to hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega168.lst diff --git a/hardware/arduino/bootloaders/optiboot/optiboot_atmega328-Mini.hex b/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328-Mini.hex similarity index 100% rename from hardware/arduino/bootloaders/optiboot/optiboot_atmega328-Mini.hex rename to hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328-Mini.hex diff --git a/hardware/arduino/bootloaders/optiboot/optiboot_atmega328.hex b/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex similarity index 100% rename from hardware/arduino/bootloaders/optiboot/optiboot_atmega328.hex rename to hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex diff --git a/hardware/arduino/bootloaders/optiboot/optiboot_atmega328.lst b/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328.lst similarity index 100% rename from hardware/arduino/bootloaders/optiboot/optiboot_atmega328.lst rename to hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328.lst diff --git a/hardware/arduino/bootloaders/optiboot/optiboot_atmega8.hex b/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega8.hex similarity index 100% rename from hardware/arduino/bootloaders/optiboot/optiboot_atmega8.hex rename to hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega8.hex diff --git a/hardware/arduino/bootloaders/optiboot/optiboot_atmega8.lst b/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega8.lst similarity index 100% rename from hardware/arduino/bootloaders/optiboot/optiboot_atmega8.lst rename to hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega8.lst diff --git a/hardware/arduino/bootloaders/optiboot/pin_defs.h b/hardware/arduino/avr/bootloaders/optiboot/pin_defs.h similarity index 100% rename from hardware/arduino/bootloaders/optiboot/pin_defs.h rename to hardware/arduino/avr/bootloaders/optiboot/pin_defs.h diff --git a/hardware/arduino/bootloaders/optiboot/stk500.h b/hardware/arduino/avr/bootloaders/optiboot/stk500.h similarity index 100% rename from hardware/arduino/bootloaders/optiboot/stk500.h rename to hardware/arduino/avr/bootloaders/optiboot/stk500.h diff --git a/hardware/arduino/bootloaders/stk500v2/License.txt b/hardware/arduino/avr/bootloaders/stk500v2/License.txt similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/License.txt rename to hardware/arduino/avr/bootloaders/stk500v2/License.txt diff --git a/hardware/arduino/bootloaders/stk500v2/Makefile b/hardware/arduino/avr/bootloaders/stk500v2/Makefile similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/Makefile rename to hardware/arduino/avr/bootloaders/stk500v2/Makefile diff --git a/hardware/arduino/bootloaders/stk500v2/STK500V2.pnproj b/hardware/arduino/avr/bootloaders/stk500v2/STK500V2.pnproj similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/STK500V2.pnproj rename to hardware/arduino/avr/bootloaders/stk500v2/STK500V2.pnproj diff --git a/hardware/arduino/bootloaders/stk500v2/STK500V2.pnps b/hardware/arduino/avr/bootloaders/stk500v2/STK500V2.pnps similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/STK500V2.pnps rename to hardware/arduino/avr/bootloaders/stk500v2/STK500V2.pnps diff --git a/hardware/arduino/bootloaders/stk500v2/avrinterruptnames.h b/hardware/arduino/avr/bootloaders/stk500v2/avrinterruptnames.h similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/avrinterruptnames.h rename to hardware/arduino/avr/bootloaders/stk500v2/avrinterruptnames.h diff --git a/hardware/arduino/bootloaders/stk500v2/command.h b/hardware/arduino/avr/bootloaders/stk500v2/command.h similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/command.h rename to hardware/arduino/avr/bootloaders/stk500v2/command.h diff --git a/hardware/arduino/bootloaders/stk500v2/stk500boot.c b/hardware/arduino/avr/bootloaders/stk500v2/stk500boot.c similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/stk500boot.c rename to hardware/arduino/avr/bootloaders/stk500v2/stk500boot.c diff --git a/hardware/arduino/bootloaders/stk500v2/stk500boot.ppg b/hardware/arduino/avr/bootloaders/stk500v2/stk500boot.ppg similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/stk500boot.ppg rename to hardware/arduino/avr/bootloaders/stk500v2/stk500boot.ppg diff --git a/hardware/arduino/bootloaders/stk500v2/stk500boot_v2_mega2560.hex b/hardware/arduino/avr/bootloaders/stk500v2/stk500boot_v2_mega2560.hex similarity index 100% rename from hardware/arduino/bootloaders/stk500v2/stk500boot_v2_mega2560.hex rename to hardware/arduino/avr/bootloaders/stk500v2/stk500boot_v2_mega2560.hex diff --git a/hardware/arduino/cores/arduino/Arduino.h b/hardware/arduino/avr/cores/arduino/Arduino.h similarity index 100% rename from hardware/arduino/cores/arduino/Arduino.h rename to hardware/arduino/avr/cores/arduino/Arduino.h diff --git a/hardware/arduino/cores/arduino/CDC.cpp b/hardware/arduino/avr/cores/arduino/CDC.cpp similarity index 100% rename from hardware/arduino/cores/arduino/CDC.cpp rename to hardware/arduino/avr/cores/arduino/CDC.cpp diff --git a/hardware/arduino/cores/arduino/Client.h b/hardware/arduino/avr/cores/arduino/Client.h similarity index 100% rename from hardware/arduino/cores/arduino/Client.h rename to hardware/arduino/avr/cores/arduino/Client.h diff --git a/hardware/arduino/cores/arduino/HID.cpp b/hardware/arduino/avr/cores/arduino/HID.cpp similarity index 100% rename from hardware/arduino/cores/arduino/HID.cpp rename to hardware/arduino/avr/cores/arduino/HID.cpp diff --git a/hardware/arduino/cores/arduino/HardwareSerial.cpp b/hardware/arduino/avr/cores/arduino/HardwareSerial.cpp similarity index 100% rename from hardware/arduino/cores/arduino/HardwareSerial.cpp rename to hardware/arduino/avr/cores/arduino/HardwareSerial.cpp diff --git a/hardware/arduino/cores/arduino/HardwareSerial.h b/hardware/arduino/avr/cores/arduino/HardwareSerial.h similarity index 100% rename from hardware/arduino/cores/arduino/HardwareSerial.h rename to hardware/arduino/avr/cores/arduino/HardwareSerial.h diff --git a/hardware/arduino/cores/arduino/IPAddress.cpp b/hardware/arduino/avr/cores/arduino/IPAddress.cpp similarity index 100% rename from hardware/arduino/cores/arduino/IPAddress.cpp rename to hardware/arduino/avr/cores/arduino/IPAddress.cpp diff --git a/hardware/arduino/cores/arduino/IPAddress.h b/hardware/arduino/avr/cores/arduino/IPAddress.h similarity index 100% rename from hardware/arduino/cores/arduino/IPAddress.h rename to hardware/arduino/avr/cores/arduino/IPAddress.h diff --git a/hardware/arduino/cores/arduino/Platform.h b/hardware/arduino/avr/cores/arduino/Platform.h similarity index 100% rename from hardware/arduino/cores/arduino/Platform.h rename to hardware/arduino/avr/cores/arduino/Platform.h diff --git a/hardware/arduino/cores/arduino/Print.cpp b/hardware/arduino/avr/cores/arduino/Print.cpp similarity index 100% rename from hardware/arduino/cores/arduino/Print.cpp rename to hardware/arduino/avr/cores/arduino/Print.cpp diff --git a/hardware/arduino/cores/arduino/Print.h b/hardware/arduino/avr/cores/arduino/Print.h similarity index 100% rename from hardware/arduino/cores/arduino/Print.h rename to hardware/arduino/avr/cores/arduino/Print.h diff --git a/hardware/arduino/cores/arduino/Printable.h b/hardware/arduino/avr/cores/arduino/Printable.h similarity index 100% rename from hardware/arduino/cores/arduino/Printable.h rename to hardware/arduino/avr/cores/arduino/Printable.h diff --git a/hardware/arduino/cores/arduino/Server.h b/hardware/arduino/avr/cores/arduino/Server.h similarity index 100% rename from hardware/arduino/cores/arduino/Server.h rename to hardware/arduino/avr/cores/arduino/Server.h diff --git a/hardware/arduino/cores/arduino/Stream.cpp b/hardware/arduino/avr/cores/arduino/Stream.cpp similarity index 100% rename from hardware/arduino/cores/arduino/Stream.cpp rename to hardware/arduino/avr/cores/arduino/Stream.cpp diff --git a/hardware/arduino/cores/arduino/Stream.h b/hardware/arduino/avr/cores/arduino/Stream.h similarity index 100% rename from hardware/arduino/cores/arduino/Stream.h rename to hardware/arduino/avr/cores/arduino/Stream.h diff --git a/hardware/arduino/cores/arduino/Tone.cpp b/hardware/arduino/avr/cores/arduino/Tone.cpp similarity index 100% rename from hardware/arduino/cores/arduino/Tone.cpp rename to hardware/arduino/avr/cores/arduino/Tone.cpp diff --git a/hardware/arduino/cores/arduino/USBAPI.h b/hardware/arduino/avr/cores/arduino/USBAPI.h similarity index 100% rename from hardware/arduino/cores/arduino/USBAPI.h rename to hardware/arduino/avr/cores/arduino/USBAPI.h diff --git a/hardware/arduino/cores/arduino/USBCore.cpp b/hardware/arduino/avr/cores/arduino/USBCore.cpp similarity index 100% rename from hardware/arduino/cores/arduino/USBCore.cpp rename to hardware/arduino/avr/cores/arduino/USBCore.cpp diff --git a/hardware/arduino/cores/arduino/USBCore.h b/hardware/arduino/avr/cores/arduino/USBCore.h similarity index 100% rename from hardware/arduino/cores/arduino/USBCore.h rename to hardware/arduino/avr/cores/arduino/USBCore.h diff --git a/hardware/arduino/cores/arduino/USBDesc.h b/hardware/arduino/avr/cores/arduino/USBDesc.h similarity index 100% rename from hardware/arduino/cores/arduino/USBDesc.h rename to hardware/arduino/avr/cores/arduino/USBDesc.h diff --git a/hardware/arduino/cores/arduino/Udp.h b/hardware/arduino/avr/cores/arduino/Udp.h similarity index 100% rename from hardware/arduino/cores/arduino/Udp.h rename to hardware/arduino/avr/cores/arduino/Udp.h diff --git a/hardware/arduino/cores/arduino/WCharacter.h b/hardware/arduino/avr/cores/arduino/WCharacter.h similarity index 100% rename from hardware/arduino/cores/arduino/WCharacter.h rename to hardware/arduino/avr/cores/arduino/WCharacter.h diff --git a/hardware/arduino/cores/arduino/WInterrupts.c b/hardware/arduino/avr/cores/arduino/WInterrupts.c similarity index 100% rename from hardware/arduino/cores/arduino/WInterrupts.c rename to hardware/arduino/avr/cores/arduino/WInterrupts.c diff --git a/hardware/arduino/cores/arduino/WMath.cpp b/hardware/arduino/avr/cores/arduino/WMath.cpp similarity index 100% rename from hardware/arduino/cores/arduino/WMath.cpp rename to hardware/arduino/avr/cores/arduino/WMath.cpp diff --git a/hardware/arduino/cores/arduino/WString.cpp b/hardware/arduino/avr/cores/arduino/WString.cpp similarity index 100% rename from hardware/arduino/cores/arduino/WString.cpp rename to hardware/arduino/avr/cores/arduino/WString.cpp diff --git a/hardware/arduino/cores/arduino/WString.h b/hardware/arduino/avr/cores/arduino/WString.h similarity index 100% rename from hardware/arduino/cores/arduino/WString.h rename to hardware/arduino/avr/cores/arduino/WString.h diff --git a/hardware/arduino/cores/arduino/binary.h b/hardware/arduino/avr/cores/arduino/binary.h similarity index 100% rename from hardware/arduino/cores/arduino/binary.h rename to hardware/arduino/avr/cores/arduino/binary.h diff --git a/hardware/arduino/cores/arduino/main.cpp b/hardware/arduino/avr/cores/arduino/main.cpp similarity index 100% rename from hardware/arduino/cores/arduino/main.cpp rename to hardware/arduino/avr/cores/arduino/main.cpp diff --git a/hardware/arduino/cores/arduino/new.cpp b/hardware/arduino/avr/cores/arduino/new.cpp similarity index 100% rename from hardware/arduino/cores/arduino/new.cpp rename to hardware/arduino/avr/cores/arduino/new.cpp diff --git a/hardware/arduino/cores/arduino/new.h b/hardware/arduino/avr/cores/arduino/new.h similarity index 100% rename from hardware/arduino/cores/arduino/new.h rename to hardware/arduino/avr/cores/arduino/new.h diff --git a/hardware/arduino/cores/arduino/wiring.c b/hardware/arduino/avr/cores/arduino/wiring.c similarity index 100% rename from hardware/arduino/cores/arduino/wiring.c rename to hardware/arduino/avr/cores/arduino/wiring.c diff --git a/hardware/arduino/cores/arduino/wiring_analog.c b/hardware/arduino/avr/cores/arduino/wiring_analog.c similarity index 100% rename from hardware/arduino/cores/arduino/wiring_analog.c rename to hardware/arduino/avr/cores/arduino/wiring_analog.c diff --git a/hardware/arduino/cores/arduino/wiring_digital.c b/hardware/arduino/avr/cores/arduino/wiring_digital.c similarity index 100% rename from hardware/arduino/cores/arduino/wiring_digital.c rename to hardware/arduino/avr/cores/arduino/wiring_digital.c diff --git a/hardware/arduino/cores/arduino/wiring_private.h b/hardware/arduino/avr/cores/arduino/wiring_private.h similarity index 100% rename from hardware/arduino/cores/arduino/wiring_private.h rename to hardware/arduino/avr/cores/arduino/wiring_private.h diff --git a/hardware/arduino/cores/arduino/wiring_pulse.c b/hardware/arduino/avr/cores/arduino/wiring_pulse.c similarity index 100% rename from hardware/arduino/cores/arduino/wiring_pulse.c rename to hardware/arduino/avr/cores/arduino/wiring_pulse.c diff --git a/hardware/arduino/cores/arduino/wiring_shift.c b/hardware/arduino/avr/cores/arduino/wiring_shift.c similarity index 100% rename from hardware/arduino/cores/arduino/wiring_shift.c rename to hardware/arduino/avr/cores/arduino/wiring_shift.c diff --git a/hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex b/hardware/arduino/avr/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex similarity index 100% rename from hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex rename to hardware/arduino/avr/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex diff --git a/hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-MegaADK-Rev3.hex b/hardware/arduino/avr/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-MegaADK-Rev3.hex similarity index 100% rename from hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-MegaADK-Rev3.hex rename to hardware/arduino/avr/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-MegaADK-Rev3.hex diff --git a/hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex b/hardware/arduino/avr/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex similarity index 100% rename from hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex rename to hardware/arduino/avr/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex diff --git a/hardware/arduino/firmwares/MEGA-dfu_and_usbserial_combined.hex b/hardware/arduino/avr/firmwares/MEGA-dfu_and_usbserial_combined.hex similarity index 100% rename from hardware/arduino/firmwares/MEGA-dfu_and_usbserial_combined.hex rename to hardware/arduino/avr/firmwares/MEGA-dfu_and_usbserial_combined.hex diff --git a/hardware/arduino/firmwares/README.txt b/hardware/arduino/avr/firmwares/README.txt similarity index 100% rename from hardware/arduino/firmwares/README.txt rename to hardware/arduino/avr/firmwares/README.txt diff --git a/hardware/arduino/firmwares/UNO-dfu_and_usbserial_combined.hex b/hardware/arduino/avr/firmwares/UNO-dfu_and_usbserial_combined.hex similarity index 100% rename from hardware/arduino/firmwares/UNO-dfu_and_usbserial_combined.hex rename to hardware/arduino/avr/firmwares/UNO-dfu_and_usbserial_combined.hex diff --git a/hardware/arduino/firmwares/arduino-usbdfu/Arduino-usbdfu.c b/hardware/arduino/avr/firmwares/arduino-usbdfu/Arduino-usbdfu.c similarity index 100% rename from hardware/arduino/firmwares/arduino-usbdfu/Arduino-usbdfu.c rename to hardware/arduino/avr/firmwares/arduino-usbdfu/Arduino-usbdfu.c diff --git a/hardware/arduino/firmwares/arduino-usbdfu/Arduino-usbdfu.h b/hardware/arduino/avr/firmwares/arduino-usbdfu/Arduino-usbdfu.h similarity index 100% rename from hardware/arduino/firmwares/arduino-usbdfu/Arduino-usbdfu.h rename to hardware/arduino/avr/firmwares/arduino-usbdfu/Arduino-usbdfu.h diff --git a/hardware/arduino/firmwares/arduino-usbdfu/Board/LEDs.h b/hardware/arduino/avr/firmwares/arduino-usbdfu/Board/LEDs.h similarity index 100% rename from hardware/arduino/firmwares/arduino-usbdfu/Board/LEDs.h rename to hardware/arduino/avr/firmwares/arduino-usbdfu/Board/LEDs.h diff --git a/hardware/arduino/firmwares/arduino-usbdfu/Descriptors.c b/hardware/arduino/avr/firmwares/arduino-usbdfu/Descriptors.c similarity index 100% rename from hardware/arduino/firmwares/arduino-usbdfu/Descriptors.c rename to hardware/arduino/avr/firmwares/arduino-usbdfu/Descriptors.c diff --git a/hardware/arduino/firmwares/arduino-usbdfu/Descriptors.h b/hardware/arduino/avr/firmwares/arduino-usbdfu/Descriptors.h similarity index 100% rename from hardware/arduino/firmwares/arduino-usbdfu/Descriptors.h rename to hardware/arduino/avr/firmwares/arduino-usbdfu/Descriptors.h diff --git a/hardware/arduino/firmwares/arduino-usbdfu/makefile b/hardware/arduino/avr/firmwares/arduino-usbdfu/makefile similarity index 100% rename from hardware/arduino/firmwares/arduino-usbdfu/makefile rename to hardware/arduino/avr/firmwares/arduino-usbdfu/makefile diff --git a/hardware/arduino/firmwares/arduino-usbdfu/readme.txt b/hardware/arduino/avr/firmwares/arduino-usbdfu/readme.txt similarity index 100% rename from hardware/arduino/firmwares/arduino-usbdfu/readme.txt rename to hardware/arduino/avr/firmwares/arduino-usbdfu/readme.txt diff --git a/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex b/hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex rename to hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex diff --git a/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex b/hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex rename to hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex diff --git a/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Uno-Rev3.hex b/hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Uno-Rev3.hex similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Uno-Rev3.hex rename to hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Uno-Rev3.hex diff --git a/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-mega.hex b/hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-mega.hex similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-mega.hex rename to hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-mega.hex diff --git a/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex b/hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex rename to hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex diff --git a/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial.c b/hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial.c similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial.c rename to hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial.c diff --git a/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial.h b/hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial.h similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial.h rename to hardware/arduino/avr/firmwares/arduino-usbserial/Arduino-usbserial.h diff --git a/hardware/arduino/firmwares/arduino-usbserial/Board/LEDs.h b/hardware/arduino/avr/firmwares/arduino-usbserial/Board/LEDs.h similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Board/LEDs.h rename to hardware/arduino/avr/firmwares/arduino-usbserial/Board/LEDs.h diff --git a/hardware/arduino/firmwares/arduino-usbserial/Descriptors.c b/hardware/arduino/avr/firmwares/arduino-usbserial/Descriptors.c similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Descriptors.c rename to hardware/arduino/avr/firmwares/arduino-usbserial/Descriptors.c diff --git a/hardware/arduino/firmwares/arduino-usbserial/Descriptors.h b/hardware/arduino/avr/firmwares/arduino-usbserial/Descriptors.h similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Descriptors.h rename to hardware/arduino/avr/firmwares/arduino-usbserial/Descriptors.h diff --git a/hardware/arduino/firmwares/arduino-usbserial/Lib/LightweightRingBuff.h b/hardware/arduino/avr/firmwares/arduino-usbserial/Lib/LightweightRingBuff.h similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/Lib/LightweightRingBuff.h rename to hardware/arduino/avr/firmwares/arduino-usbserial/Lib/LightweightRingBuff.h diff --git a/hardware/arduino/firmwares/arduino-usbserial/makefile b/hardware/arduino/avr/firmwares/arduino-usbserial/makefile similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/makefile rename to hardware/arduino/avr/firmwares/arduino-usbserial/makefile diff --git a/hardware/arduino/firmwares/arduino-usbserial/readme.txt b/hardware/arduino/avr/firmwares/arduino-usbserial/readme.txt similarity index 100% rename from hardware/arduino/firmwares/arduino-usbserial/readme.txt rename to hardware/arduino/avr/firmwares/arduino-usbserial/readme.txt diff --git a/hardware/arduino/avr/platforms.txt b/hardware/arduino/avr/platforms.txt new file mode 100644 index 000000000..a0d60a860 --- /dev/null +++ b/hardware/arduino/avr/platforms.txt @@ -0,0 +1,64 @@ +#########Compiler Recipe################################# +##compile c object files +##Default.recipe, overide if overide exists, these defauls should remain the same, if you need to change them do it as an overide. + +#default.recipe.c.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10} +#default.recipe.cpp.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10} +#default.recipe.ar.pattern={0}{1}|{2}|{3}{4}|{5} +#default.recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}|{8}|-L{9}|-lm +#default.recipe.objcopy.eep.pattern={0}{1}|{2}|{3}.elf|{4}.eep +#default.recipe.objcopy.hex.pattern={0}{1}|{2}|{3}.elf|{4}.hex + +########avr compile pattern ########## +#recipe.c.o.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-D{7=ARDUINO}={6=Base.REVISION}{7=-I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=OBJECT_NAME} +#object name seems to have build path in it. +recipe.c.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10} + + +##compile cc object files +#recipe.cc.o.pattern={0=compiler.path}{1=compiler.cc.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-DARDUINO={6=Base.REVISION}{-7=I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=BUILD_PATH}{10=OBJECT_NAME} +recipe.cpp.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10} +##create archives +#recipe.ar.pattern={0=compiler.path}{1=compiler.ar.cmd}{2=compiler.ar.flags}{3=BUILD_PATH}{4=CORE_NAME=core.a}{5=BUILD_PATH}{6=OBJECT_NAME} +recipe.ar.pattern={0}{1}|{2}|{3}{4}|{5} + +##combine gc-sections| archives, and objects +#recipe.c.combine.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.combine.flags}{3=compiler.cpudef}{4=build.mcu} -o {5=BUILD_PATH}{6=SOURCE_NAME}.elf {7=BUILD_PATH}{8=SOURCE_NAME}.o {9=BUILD_PATH}{10=CORE_NAME=core.a} -L{11=BUILD_PATH} -lm +#recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}{8}|{9}|-L{10}|-lm +recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}|{8}|-L{9}|-lm + +##create eeprom +#recipe.objcopy.eep.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.eep.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.eep +recipe.objcopy.eep.pattern={0}{1}|{2}|{3}.elf|{4}.eep + +##create hex +#recipe.objcopy.hex.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.elf.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.hex +recipe.objcopy.hex.pattern={0}{1}|{2}|{3}.elf|{4}.hex + + + +######################################################## +name=Arduino +#compiler.path Official default is correct, only need to change this if you want to overide the initial default +#compiler.path={0}/hardware/tools/avr/bin/ +compiler.c.cmd=avr-gcc +compiler.c.flags=|-c|-g|-Os|-w|-ffunction-sections|-fdata-sections +compiler.c.elf.flags=|-Os|-Wl,--gc-sections +compiler.c.elf.cmd=avr-gcc +compiler.S.flags=|-c|-g|-assembler-with-cpp +compiler.cpp.cmd=avr-g++ +compiler.cpp.flags=|-c|-g|-Os|-w|-fno-exceptions|-ffunction-sections|-fdata-sections +compiler.ar.cmd=avr-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=avr-objcopy +compiler.objcopy.eep.flags=|-O|ihex|-j|.eeprom|--set-section-flags=.eeprom=alloc,load|--no-change-warnings|--change-section-lma|.eeprom=0 +compiler.elf2hex.flags=|-O|ihex|-R|.eeprom +compiler.elf2hex.cmd=avr-objcopy +compiler.ldflags= +compiler.cpudef=-mmcu= +compiler.upload.cmd= +compiler.upload.flags= +compiler.define=-DARDUINO= +library.path=./hardware/arduino/cores/arduino +library.core.path=./libraries + diff --git a/hardware/arduino/programmers.txt b/hardware/arduino/avr/programmers.txt similarity index 100% rename from hardware/arduino/programmers.txt rename to hardware/arduino/avr/programmers.txt diff --git a/hardware/arduino/variants/eightanaloginputs/pins_arduino.h b/hardware/arduino/avr/variants/eightanaloginputs/pins_arduino.h similarity index 100% rename from hardware/arduino/variants/eightanaloginputs/pins_arduino.h rename to hardware/arduino/avr/variants/eightanaloginputs/pins_arduino.h diff --git a/hardware/arduino/variants/leonardo/pins_arduino.h b/hardware/arduino/avr/variants/leonardo/pins_arduino.h similarity index 100% rename from hardware/arduino/variants/leonardo/pins_arduino.h rename to hardware/arduino/avr/variants/leonardo/pins_arduino.h diff --git a/hardware/arduino/variants/mega/pins_arduino.h b/hardware/arduino/avr/variants/mega/pins_arduino.h similarity index 100% rename from hardware/arduino/variants/mega/pins_arduino.h rename to hardware/arduino/avr/variants/mega/pins_arduino.h diff --git a/hardware/arduino/variants/micro/pins_arduino.h b/hardware/arduino/avr/variants/micro/pins_arduino.h similarity index 100% rename from hardware/arduino/variants/micro/pins_arduino.h rename to hardware/arduino/avr/variants/micro/pins_arduino.h diff --git a/hardware/arduino/variants/standard/pins_arduino.h b/hardware/arduino/avr/variants/standard/pins_arduino.h similarity index 100% rename from hardware/arduino/variants/standard/pins_arduino.h rename to hardware/arduino/avr/variants/standard/pins_arduino.h diff --git a/hardware/arduino/platforms.txt b/hardware/arduino/platforms.txt deleted file mode 100755 index ae495d5b7..000000000 --- a/hardware/arduino/platforms.txt +++ /dev/null @@ -1,64 +0,0 @@ -#########Compiler Recipe################################# -##compile c object files -##Default.recipe, overide if overide exists, these defauls should remain the same, if you need to change them do it as an overide. - -#default.recipe.c.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10} -#default.recipe.cpp.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10} -#default.recipe.ar.pattern={0}{1}|{2}|{3}{4}|{5} -#default.recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}|{8}|-L{9}|-lm -#default.recipe.objcopy.eep.pattern={0}{1}|{2}|{3}.elf|{4}.eep -#default.recipe.objcopy.hex.pattern={0}{1}|{2}|{3}.elf|{4}.hex - -########avr compile pattern ########## -#avr.recipe.c.o.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-D{7=ARDUINO}={6=Base.REVISION}{7=-I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=OBJECT_NAME} -#object name seems to have build path in it. -avr.recipe.c.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10} - - -##compile cc object files -#avr.recipe.cc.o.pattern={0=compiler.path}{1=compiler.cc.cmd}{2=compiler.c.flags}{3=compiler.cpudef}{4=build.mcu}-DF_CPU={5=build.f_cpu}-DARDUINO={6=Base.REVISION}{-7=I/INCLUDE_PATHS} {8=SOURCE_NAME} -o{9=BUILD_PATH}{10=OBJECT_NAME} -avr.recipe.cpp.o.pattern={0}{1}|{2}|{3}{4}|-DF_CPU={5}|-D{6}={7}|{8}|{9}|-o|{10} -##create archives -#avr.recipe.ar.pattern={0=compiler.path}{1=compiler.ar.cmd}{2=compiler.ar.flags}{3=BUILD_PATH}{4=CORE_NAME=core.a}{5=BUILD_PATH}{6=OBJECT_NAME} -avr.recipe.ar.pattern={0}{1}|{2}|{3}{4}|{5} - -##combine gc-sections| archives, and objects -#avr.recipe.c.combine.pattern={0=compiler.path}{1=compiler.c.cmd}{2=compiler.combine.flags}{3=compiler.cpudef}{4=build.mcu} -o {5=BUILD_PATH}{6=SOURCE_NAME}.elf {7=BUILD_PATH}{8=SOURCE_NAME}.o {9=BUILD_PATH}{10=CORE_NAME=core.a} -L{11=BUILD_PATH} -lm -#avr.recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}{8}|{9}|-L{10}|-lm -avr.recipe.c.combine.pattern={0}{1}|{2}|{3}{4}|-o|{5}{6}.elf|{7}|{8}|-L{9}|-lm - -##create eeprom -#avr.recipe.objcopy.eep.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.eep.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.eep -avr.recipe.objcopy.eep.pattern={0}{1}|{2}|{3}.elf|{4}.eep - -##create hex -#avr.recipe.objcopy.hex.pattern={0=compiler.path}{1=compiler.objcopy.cmd}{2=compiler.objcopy.elf.flags} {3=BUILD_PATH}{4=SOURCE_NAME}.elf {5=BUILD_PATH}{6=SOURCE_NAME}.hex -avr.recipe.objcopy.hex.pattern={0}{1}|{2}|{3}.elf|{4}.hex - - - -######################################################## -avr.name=Arduino -#avr.compiler.path Official default is correct, only need to change this if you want to overide the initial default -#avr.compiler.path={0}/hardware/tools/avr/bin/ -avr.compiler.c.cmd=avr-gcc -avr.compiler.c.flags=|-c|-g|-Os|-w|-ffunction-sections|-fdata-sections -avr.compiler.c.elf.flags=|-Os|-Wl,--gc-sections -avr.compiler.c.elf.cmd=avr-gcc -avr.compiler.S.flags=|-c|-g|-assembler-with-cpp -avr.compiler.cpp.cmd=avr-g++ -avr.compiler.cpp.flags=|-c|-g|-Os|-w|-fno-exceptions|-ffunction-sections|-fdata-sections -avr.compiler.ar.cmd=avr-ar -avr.compiler.ar.flags=rcs -avr.compiler.objcopy.cmd=avr-objcopy -avr.compiler.objcopy.eep.flags=|-O|ihex|-j|.eeprom|--set-section-flags=.eeprom=alloc,load|--no-change-warnings|--change-section-lma|.eeprom=0 -avr.compiler.elf2hex.flags=|-O|ihex|-R|.eeprom -avr.compiler.elf2hex.cmd=avr-objcopy -avr.compiler.ldflags= -avr.compiler.cpudef=-mmcu= -avr.compiler.upload.cmd= -avr.compiler.upload.flags= -avr.compiler.define=-DARDUINO= -avr.library.path=./hardware/arduino/cores/arduino -avr.library.core.path=./libraries -