Skip to content

Commit b87b45e

Browse files
committed
Add a recipe to generate .hex file
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 3f30641 commit b87b45e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Diff for: platform.txt

+12-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ compiler.c.elf.flags=-mcpu={build.mcu} -mthumb {build.flags.optimize} {build.fla
4343

4444
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
4545

46-
compiler.elf2hex.flags=-O binary
46+
compiler.elf2bin.flags=-O binary
47+
compiler.elf2hex.flags=-O ihex
4748

4849
compiler.ldflags={build.flags.ldspecs}
4950
compiler.size.cmd=arm-none-eabi-size
@@ -60,6 +61,7 @@ compiler.cpp.extra_flags=
6061
compiler.cpp.std=gnu++14
6162
compiler.S.extra_flags=
6263
compiler.ar.extra_flags=
64+
compiler.elf2bin.extra_flags=
6365
compiler.elf2hex.extra_flags=
6466

6567
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
107109
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
108110

109111
## Create output (.bin file)
110-
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"
112+
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"
111113

112-
## Save hex
114+
## Save bin
113115
recipe.output.tmp_file={build.project_name}.bin
114116
recipe.output.save_file={build.project_name}.{build.variant}.bin
115117

118+
## Create output (.hex file)
119+
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"
120+
121+
## Save hex
122+
recipe.output.tmp_file={build.project_name}.hex
123+
recipe.output.save_file={build.project_name}.{build.variant}.hex
124+
116125
## Compute size
117126
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
118127
recipe.size.regex=^(?:\.text|\.data|\.rodata)\s+([0-9]+).*

0 commit comments

Comments
 (0)