Skip to content

Commit 5a35be0

Browse files
author
Federico Fissore
committed
Compiler: cores files get compiled under "core", libraries under "libraries". Fixes #2997
1 parent 46058a5 commit 5a35be0

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

arduino-core/src/processing/app/debug/Compiler.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,12 @@ void compileLibraries(List<File> includeFolders) throws RunnerException, Prefere
10111011
private void compileLibrary(UserLibrary lib, List<File> includeFolders)
10121012
throws RunnerException, PreferencesMapException {
10131013
File libFolder = lib.getSrcFolder();
1014-
File libBuildFolder = prefs.getFile(("build.path"), lib.getName());
1014+
File librariesFolder = new File(prefs.getFile("build.path"), "libraries");
1015+
if (!librariesFolder.exists() && !librariesFolder.mkdirs()) {
1016+
throw new RunnerException("Unable to create folder " + librariesFolder);
1017+
}
1018+
1019+
File libBuildFolder = new File(librariesFolder, lib.getName());
10151020

10161021
if (lib.useRecursion()) {
10171022
// libBuildFolder == {build.path}/LibName
@@ -1058,7 +1063,10 @@ void compileCore()
10581063

10591064
File coreFolder = prefs.getFile("build.core.path");
10601065
File variantFolder = prefs.getFile("build.variant.path");
1061-
File buildFolder = prefs.getFile("build.path");
1066+
File buildFolder = new File(prefs.getFile("build.path"), "core");
1067+
if (!buildFolder.exists() && !buildFolder.mkdirs()) {
1068+
throw new RunnerException("Unable to create folder " + buildFolder);
1069+
}
10621070

10631071
List<File> includeFolders = new ArrayList<File>();
10641072
includeFolders.add(coreFolder); // include core path only
@@ -1108,6 +1116,7 @@ void compileCore()
11081116
dict.put("ide_version", "" + BaseNoGui.REVISION);
11091117
dict.put("archive_file", afile.getName());
11101118
dict.put("object_file", file.getAbsolutePath());
1119+
dict.put("build.path", buildFolder.getAbsolutePath());
11111120

11121121
String[] cmdArray;
11131122
String cmd = prefs.getOrExcept("recipe.ar.pattern");
@@ -1144,7 +1153,7 @@ void compileLink()
11441153
PreferencesMap dict = new PreferencesMap(prefs);
11451154
String flags = dict.get("compiler.c.elf.flags") + optRelax;
11461155
dict.put("compiler.c.elf.flags", flags);
1147-
dict.put("archive_file", "core.a");
1156+
dict.put("archive_file", new File("core", "core.a").getPath());
11481157
dict.put("object_files", objectFileList);
11491158
dict.put("ide_version", "" + BaseNoGui.REVISION);
11501159

hardware/arduino/sam/platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -mcpu={b
7575
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
7676

7777
## Combine gc-sections, archives, and objects
78-
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc
78+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/core/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc
7979

8080
## Create output (.bin file)
8181
recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"

hardware/platform.keys.rewrite.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ new.3.compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
1515
old.4.tools.bossac.path={runtime.ide.path}/hardware/tools
1616
new.4.tools.bossac.path={runtime.tools.bossac.path}
1717

18+
old.5.recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc
19+
new.5.recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/core/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc
20+

0 commit comments

Comments
 (0)