Example #1
0
  public static List<String> getCommandLinker(
      String avrBasePath, List<File> inputPaths, String outputName) {
    List<String> baseCommandLinker =
        new ArrayList<String>(
            Arrays.asList(
                new String[] {
                  avrBasePath + "avr-gcc",
                  "-o", // compile, don't link
                  outputName
                }));
    baseCommandLinker.addAll(Compiler.getLinkerFlags());

    for (File f : inputPaths) {
      baseCommandLinker.add(f.getAbsolutePath());
    }
    baseCommandLinker.add("-lm");
    return baseCommandLinker;
  }
Example #2
0
  private static List<String> getCommandCompilerASM(
      String avrBasePath, List<String> includePaths, String sourceName, String objectName) {
    List<String> baseCommandCompilerASM =
        new ArrayList<String>(
            Arrays.asList(
                new String[] {
                  avrBasePath + "avr-g++", "-c", // compile, don't link
                }));
    baseCommandCompilerASM.addAll(Compiler.getCompilerFlags());

    for (String includePath : includePaths) {
      baseCommandCompilerASM.add("-I" + includePath);
    }

    baseCommandCompilerASM.add(sourceName);
    baseCommandCompilerASM.add("-o" + objectName);

    return baseCommandCompilerASM;
  }
Example #3
0
  public static List<String> getCommandCompilerC(
      String avrBasePath, List<String> includePaths, String sourceName, String objectName) {
    List<String> baseCommandCompiler =
        new ArrayList<String>(
            Arrays.asList(
                new String[] {
                  avrBasePath + "avr-gcc", "-c", // compile, don't link
                }));
    baseCommandCompiler.addAll(Compiler.getCompilerFlags());

    for (int i = 0; i < includePaths.size(); i++) {
      baseCommandCompiler.add("-I" + includePaths.get(i));
    }

    baseCommandCompiler.add(sourceName);
    baseCommandCompiler.add("-o" + objectName);

    return baseCommandCompiler;
  }
Example #4
0
  public static void main(String args[]) {
    String midictrlDir = null;
    String board = "minicommand2";

    if (args.length <= 1) {
      return;
    }
    java.util.List printList = new ArrayList();

    int i;
    for (i = 0; i < args.length; i++) {
      if (args[i].equals("--board")) {
        board = args[i + 1];
        i++;
      } else if (args[i].equals("--dir")) {
        midictrlDir = args[i + 1];
        i++;
      } else {
        break;
      }
    }

    if (midictrlDir == null) {
      midictrlDir = System.getProperty("user.dir");
    }

    String hardwarePath =
        (midictrlDir != null ? midictrlDir : System.getProperty("user.dir"))
            + File.separator
            + "hardware";
    Base.init(midictrlDir);
    Target target = null;
    Preferences.initBoards(midictrlDir);
    Preferences.set("board", board);
    try {
      target =
          new Target(
              hardwarePath + File.separator + "cores",
              Preferences.get("boards." + Preferences.get("board") + ".build.core"));
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    for (i = 0; i < args.length; i++) {
      if (args[i].equals("--print-c-flags")) {
        PrintList(Compiler.getCompilerFlags());
      } else if (args[i].equals("--print-cxx-flags")) {
        PrintList(Compiler.getCompilerFlags());
      } else if (args[i].equals("--print-ld-flags")) {
        PrintList(Compiler.getLinkerFlags());
      } else if (args[i].equals("--libraries")) {
        PrintList(Compiler.getLibraries(args[i + 1], target));
      } else if (args[i].equals("--make")) {
        System.out.print("MIDICTRL_LIBS += ");
        PrintList(Compiler.getLibraries(args[i + 1], target));
        System.out.print("CFLAGS += ");
        PrintList(Compiler.getCompilerFlags());
        System.out.print("CXXFLAGS += ");
        PrintList(Compiler.getCompilerFlags());
        System.out.print("CLDFLAGS += ");
        PrintList(Compiler.getLinkerFlags());
      }
    }
  }