mirror of https://github.com/noisymime/Arduino.git
Adding support for .S files in libraries and cores. Patches from René Bohne.
This commit is contained in:
parent
f2010ebd2b
commit
048143f3d5
|
@ -86,6 +86,7 @@ public class Compiler implements MessageConsumer {
|
||||||
|
|
||||||
List<File> targetObjectFiles =
|
List<File> targetObjectFiles =
|
||||||
compileFiles(avrBasePath, buildPath, includePaths,
|
compileFiles(avrBasePath, buildPath, includePaths,
|
||||||
|
findFilesInPath(target.getPath(), "S", true),
|
||||||
findFilesInPath(target.getPath(), "c", true),
|
findFilesInPath(target.getPath(), "c", true),
|
||||||
findFilesInPath(target.getPath(), "cpp", true));
|
findFilesInPath(target.getPath(), "cpp", true));
|
||||||
|
|
||||||
|
@ -115,12 +116,14 @@ public class Compiler implements MessageConsumer {
|
||||||
includePaths.add(libraryFolder.getPath() + File.separator + "utility");
|
includePaths.add(libraryFolder.getPath() + File.separator + "utility");
|
||||||
objectFiles.addAll(
|
objectFiles.addAll(
|
||||||
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
|
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
|
||||||
|
findFilesInFolder(libraryFolder, "S", false),
|
||||||
findFilesInFolder(libraryFolder, "c", false),
|
findFilesInFolder(libraryFolder, "c", false),
|
||||||
findFilesInFolder(libraryFolder, "cpp", false)));
|
findFilesInFolder(libraryFolder, "cpp", false)));
|
||||||
outputFolder = new File(outputFolder, "utility");
|
outputFolder = new File(outputFolder, "utility");
|
||||||
createFolder(outputFolder);
|
createFolder(outputFolder);
|
||||||
objectFiles.addAll(
|
objectFiles.addAll(
|
||||||
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
|
compileFiles(avrBasePath, outputFolder.getAbsolutePath(), includePaths,
|
||||||
|
findFilesInFolder(new File(libraryFolder, "utility"), "S", false),
|
||||||
findFilesInFolder(new File(libraryFolder, "utility"), "c", false),
|
findFilesInFolder(new File(libraryFolder, "utility"), "c", false),
|
||||||
findFilesInFolder(new File(libraryFolder, "utility"), "cpp", false)));
|
findFilesInFolder(new File(libraryFolder, "utility"), "cpp", false)));
|
||||||
// other libraries should not see this library's utility/ folder
|
// other libraries should not see this library's utility/ folder
|
||||||
|
@ -131,6 +134,7 @@ public class Compiler implements MessageConsumer {
|
||||||
|
|
||||||
objectFiles.addAll(
|
objectFiles.addAll(
|
||||||
compileFiles(avrBasePath, buildPath, includePaths,
|
compileFiles(avrBasePath, buildPath, includePaths,
|
||||||
|
findFilesInPath(buildPath, "S", false),
|
||||||
findFilesInPath(buildPath, "c", false),
|
findFilesInPath(buildPath, "c", false),
|
||||||
findFilesInPath(buildPath, "cpp", false)));
|
findFilesInPath(buildPath, "cpp", false)));
|
||||||
|
|
||||||
|
@ -190,11 +194,20 @@ public class Compiler implements MessageConsumer {
|
||||||
|
|
||||||
private List<File> compileFiles(String avrBasePath,
|
private List<File> compileFiles(String avrBasePath,
|
||||||
String buildPath, List<File> includePaths,
|
String buildPath, List<File> includePaths,
|
||||||
|
List<File> sSources,
|
||||||
List<File> cSources, List<File> cppSources)
|
List<File> cSources, List<File> cppSources)
|
||||||
throws RunnerException {
|
throws RunnerException {
|
||||||
|
|
||||||
List<File> objectPaths = new ArrayList<File>();
|
List<File> objectPaths = new ArrayList<File>();
|
||||||
|
|
||||||
|
for (File file : sSources) {
|
||||||
|
String objectPath = buildPath + File.separator + file.getName() + ".o";
|
||||||
|
objectPaths.add(new File(objectPath));
|
||||||
|
execAsynchronously(getCommandCompilerS(avrBasePath, includePaths,
|
||||||
|
file.getAbsolutePath(),
|
||||||
|
objectPath));
|
||||||
|
}
|
||||||
|
|
||||||
for (File file : cSources) {
|
for (File file : cSources) {
|
||||||
String objectPath = buildPath + File.separator + file.getName() + ".o";
|
String objectPath = buildPath + File.separator + file.getName() + ".o";
|
||||||
objectPaths.add(new File(objectPath));
|
objectPaths.add(new File(objectPath));
|
||||||
|
@ -430,8 +443,31 @@ public class Compiler implements MessageConsumer {
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static private List getCommandCompilerS(String avrBasePath, List includePaths,
|
||||||
|
String sourceName, String objectName) {
|
||||||
|
List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] {
|
||||||
|
avrBasePath + "avr-gcc",
|
||||||
|
"-c", // compile, don't link
|
||||||
|
"-g", // include debugging info (so errors include line numbers)
|
||||||
|
"-assembler-with-cpp",
|
||||||
|
"-mmcu=" + Preferences.get("boards." + Preferences.get("board") + ".build.mcu"),
|
||||||
|
"-DF_CPU=" + Preferences.get("boards." + Preferences.get("board") + ".build.f_cpu"),
|
||||||
|
}));
|
||||||
|
|
||||||
|
for (int i = 0; i < includePaths.size(); i++) {
|
||||||
|
baseCommandCompiler.add("-I" + (String) includePaths.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
baseCommandCompiler.add(sourceName);
|
||||||
|
baseCommandCompiler.add("-o"+ objectName);
|
||||||
|
|
||||||
|
return baseCommandCompiler;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static private List getCommandCompilerC(String avrBasePath, List includePaths,
|
static private List getCommandCompilerC(String avrBasePath, List includePaths,
|
||||||
String sourceName, String objectName) {
|
String sourceName, String objectName) {
|
||||||
|
|
||||||
List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] {
|
List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] {
|
||||||
avrBasePath + "avr-gcc",
|
avrBasePath + "avr-gcc",
|
||||||
"-c", // compile, don't link
|
"-c", // compile, don't link
|
||||||
|
@ -457,6 +493,7 @@ public class Compiler implements MessageConsumer {
|
||||||
|
|
||||||
static private List getCommandCompilerCPP(String avrBasePath,
|
static private List getCommandCompilerCPP(String avrBasePath,
|
||||||
List includePaths, String sourceName, String objectName) {
|
List includePaths, String sourceName, String objectName) {
|
||||||
|
|
||||||
List baseCommandCompilerCPP = new ArrayList(Arrays.asList(new String[] {
|
List baseCommandCompilerCPP = new ArrayList(Arrays.asList(new String[] {
|
||||||
avrBasePath + "avr-g++",
|
avrBasePath + "avr-g++",
|
||||||
"-c", // compile, don't link
|
"-c", // compile, don't link
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class Target {
|
||||||
base);
|
base);
|
||||||
|
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
if (files[i].endsWith(".c") || files[i].endsWith(".cpp"))
|
if (files[i].endsWith(".S") || files[i].endsWith(".c") || files[i].endsWith(".cpp"))
|
||||||
sources.add(files[i]);
|
sources.add(files[i]);
|
||||||
if (files[i].endsWith(".o"))
|
if (files[i].endsWith(".o"))
|
||||||
objects.add(files[i]);
|
objects.add(files[i]);
|
||||||
|
|
Loading…
Reference in New Issue