From b87b45edc05143e2d63f542e5b66176c170d2f67 Mon Sep 17 00:00:00 2001 From: "Frederic.Pillon" Date: Tue, 30 Jan 2018 10:33:10 +0100 Subject: [PATCH] Add a recipe to generate .hex file Signed-off-by: Frederic.Pillon --- platform.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/platform.txt b/platform.txt index 108a2d401a..018d9b6a69 100644 --- a/platform.txt +++ b/platform.txt @@ -43,7 +43,8 @@ compiler.c.elf.flags=-mcpu={build.mcu} -mthumb {build.flags.optimize} {build.fla 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 binary +compiler.elf2bin.flags=-O binary +compiler.elf2hex.flags=-O ihex compiler.ldflags={build.flags.ldspecs} compiler.size.cmd=arm-none-eabi-size @@ -60,6 +61,7 @@ compiler.cpp.extra_flags= compiler.cpp.std=gnu++14 compiler.S.extra_flags= compiler.ar.extra_flags= +compiler.elf2bin.extra_flags= compiler.elf2hex.extra_flags= compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Source/Templates/gcc/" @@ -107,12 +109,19 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} {compiler.ldflags} {compiler.arm.cmsis.ldflags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -Wl,--start-group {object_files} -Wl,--whole-archive "{archive_file_path}" -Wl,--no-whole-archive -lc -Wl,--end-group -lm -lgcc -lstdc++ --specs=nano.specs ## Create output (.bin file) -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" +recipe.objcopy.bin.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" -## Save hex +## Save bin recipe.output.tmp_file={build.project_name}.bin recipe.output.save_file={build.project_name}.{build.variant}.bin +## Create output (.hex file) +recipe.objcopy.hex.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +## Save hex +recipe.output.tmp_file={build.project_name}.hex +recipe.output.save_file={build.project_name}.{build.variant}.hex + ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" recipe.size.regex=^(?:\.text|\.data|\.rodata)\s+([0-9]+).*