Skip to content

Commit a393641

Browse files
committed
"objcopy" recipes are no more tied to "hex" extension
This allow to define specific recipes for every platform but keeps backward compatibility. See arduino#2614
1 parent c0c9314 commit a393641

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

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

+12-7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.io.PrintWriter;
3535
import java.util.ArrayList;
3636
import java.util.Arrays;
37+
import java.util.Collections;
3738
import java.util.LinkedList;
3839
import java.util.List;
3940
import java.util.Map;
@@ -399,13 +400,17 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE
399400
progressListener.progress(60);
400401
compileLink();
401402

402-
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
403-
progressListener.progress(70);
404-
runRecipe("recipe.objcopy.eep.pattern");
405-
406-
// 6. build the .hex file
407-
progressListener.progress(80);
408-
runRecipe("recipe.objcopy.output.pattern");
403+
// 5. run objcopy to generate output files
404+
progressListener.progress(75);
405+
List<String> objcopyPatterns = new ArrayList<String>();
406+
for (String key : prefs.keySet()) {
407+
if (key.startsWith("recipe.objcopy.") && key.endsWith(".pattern"))
408+
objcopyPatterns.add(key);
409+
}
410+
Collections.sort(objcopyPatterns);
411+
for (String recipe : objcopyPatterns) {
412+
runRecipe(recipe);
413+
}
409414

410415
progressListener.progress(90);
411416
return true;

hardware/arduino/avr/platform.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,9 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil
6161
## Combine gc-sections, archives, and objects
6262
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
6363

64-
## Create eeprom
64+
## Create output files (.eep and .hex)
6565
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
66-
67-
## Create hex
68-
recipe.objcopy.output.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
66+
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
6967

7068
## Compute size
7169
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"

hardware/arduino/sam/platform.txt

+2-5
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil
6565
## Combine gc-sections, archives, and objects
6666
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
6767

68-
## Create eeprom
69-
recipe.objcopy.eep.pattern=
70-
71-
## Create hex
72-
recipe.objcopy.output.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"
68+
## Create output (.bin file)
69+
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"
7370

7471
## Compute size
7572
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"

0 commit comments

Comments
 (0)