From cd0afb409142c748929d7e44305ef28a65787088 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Wed, 20 Jul 2022 13:18:53 +0200 Subject: [PATCH] Call objcopy.postobjcopy only when needed --- boards.txt | 12 +++--------- platform.txt | 2 -- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/boards.txt b/boards.txt index 5cd6b1258..d24217776 100644 --- a/boards.txt +++ b/boards.txt @@ -13,7 +13,6 @@ edge_control.build.fpu=-mfpu=fpv4-sp-d16 edge_control.build.float-abi=-mfloat-abi=softfp edge_control.build.board=EDGE_CONTROL edge_control.build.ldscript=linker_script.ld -edge_control.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit edge_control.compiler.mbed.arch.define=-DARDUINO_ARCH_NRF52840 edge_control.compiler.mbed.defines={build.variant.path}/defines.txt edge_control.compiler.mbed.ldflags={build.variant.path}/ldflags.txt @@ -80,11 +79,10 @@ envie_m7.build.slot_size=0x1E0000 envie_m7.build.header_size=0x20000 envie_m7.build.alignment=32 envie_m7.build.version=1.2.3+4 -envie_m7.menu.security.sien.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" {tools.imgtool.flags} +envie_m7.menu.security.sien.recipe.hooks.objcopy.postobjcopy.1.pattern="{tools.imgtool.path}/{tools.imgtool.cmd}" {tools.imgtool.flags} envie_m7.menu.security.sien.build.keys.keychain={runtime.platform.path}/libraries/MCUboot/default_keys envie_m7.menu.security.sien.build.keys.sign_key=ecdsa-p256-signing-priv-key.pem envie_m7.menu.security.sien.build.keys.encrypt_key=ecdsa-p256-encrypt-pub-key.pem -envie_m7.menu.security.none.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit envie_m7.compiler.mbed.arch.define= envie_m7.compiler.mbed.defines={build.variant.path}/defines.txt envie_m7.compiler.mbed.ldflags={build.variant.path}/ldflags.txt @@ -167,7 +165,6 @@ envie_m4.menu.split.100_0.build.extra_ldflags=-DCM4_BINARY_START=0x60000000 -DCM envie_m4.build.architecture=cortex-m4 envie_m4.build.board=PORTENTA_H7_M4 envie_m4.build.ldscript=linker_script.ld -envie_m4.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit envie_m4.compiler.mbed.arch.define= envie_m4.compiler.mbed.defines={build.variant.path}/defines.txt envie_m4.compiler.mbed.ldflags={build.variant.path}/ldflags.txt @@ -279,7 +276,6 @@ nano33ble.build.fpu=-mfpu=fpv4-sp-d16 nano33ble.build.float-abi=-mfloat-abi=softfp nano33ble.build.board=ARDUINO_NANO33BLE nano33ble.build.ldscript=linker_script.ld -nano33ble.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit nano33ble.compiler.mbed.arch.define=-DARDUINO_ARCH_NRF52840 nano33ble.compiler.mbed.defines={build.variant.path}/defines.txt nano33ble.compiler.mbed.ldflags={build.variant.path}/ldflags.txt @@ -337,7 +333,6 @@ nanorp2040connect.build.float-abi= nanorp2040connect.build.architecture=cortex-m0plus nanorp2040connect.build.board=NANO_RP2040_CONNECT nanorp2040connect.build.ldscript=linker_script.ld -nanorp2040connect.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit nanorp2040connect.compiler.mbed.arch.define=-DARDUINO_ARCH_RP2040 nanorp2040connect.compiler.mbed.defines={build.variant.path}/defines.txt nanorp2040connect.compiler.mbed.ldflags={build.variant.path}/ldflags.txt @@ -346,6 +341,7 @@ nanorp2040connect.compiler.mbed.cxxflags={build.variant.path}/cxxflags.txt nanorp2040connect.compiler.mbed.includes={build.variant.path}/includes.txt nanorp2040connect.compiler.mbed.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys nanorp2040connect.compiler.mbed="{build.variant.path}/libs/libmbed.a" +nanorp2040connect.recipe.hooks.objcopy.postobjcopy.1.pattern="{runtime.tools.rp2040tools.path}/elf2uf2" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.uf2" nanorp2040connect.vid.0=0x2341 nanorp2040connect.pid.0=0x005e nanorp2040connect.vid.1=0x2341 @@ -393,7 +389,6 @@ pico.build.float-abi= pico.build.architecture=cortex-m0plus pico.build.board=RASPBERRY_PI_PICO pico.build.ldscript=linker_script.ld -pico.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit pico.compiler.mbed.arch.define=-DARDUINO_ARCH_RP2040 pico.compiler.mbed.defines={build.variant.path}/defines.txt pico.compiler.mbed.ldflags={build.variant.path}/ldflags.txt @@ -402,6 +397,7 @@ pico.compiler.mbed.cxxflags={build.variant.path}/cxxflags.txt pico.compiler.mbed.includes={build.variant.path}/includes.txt pico.compiler.mbed.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys pico.compiler.mbed="{build.variant.path}/libs/libmbed.a" +pico.recipe.hooks.objcopy.postobjcopy.1.pattern="{runtime.tools.rp2040tools.path}/elf2uf2" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.uf2" pico.vid.0=0x2e8a pico.pid.0=0x00C0 pico.upload_port.0.vid=0x2e8a @@ -437,7 +433,6 @@ nicla_sense.build.fpu=-mfpu=fpv4-sp-d16 nicla_sense.build.float-abi=-mfloat-abi=softfp nicla_sense.build.board=NICLA nicla_sense.build.ldscript=linker_script.ld -nicla_sense.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit nicla_sense.compiler.mbed.arch.define=-DARDUINO_ARCH_NRF52832 nicla_sense.compiler.mbed.defines={build.variant.path}/defines.txt nicla_sense.compiler.mbed.ldflags={build.variant.path}/ldflags.txt @@ -485,7 +480,6 @@ nicla_vision.build.extra_flags= nicla_vision.build.architecture=cortex-m7 nicla_vision.build.board=NICLA_VISION nicla_vision.build.ldscript=linker_script.ld -nicla_vision.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit nicla_vision.compiler.mbed.arch.define= nicla_vision.compiler.mbed.defines={build.variant.path}/defines.txt nicla_vision.compiler.mbed.ldflags={build.variant.path}/ldflags.txt diff --git a/platform.txt b/platform.txt index ae0e4d83d..ae7acc43b 100644 --- a/platform.txt +++ b/platform.txt @@ -96,8 +96,6 @@ recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf ## Create output (hex file) recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" -## Create output secure image (bin file) -recipe.hooks.objcopy.postobjcopy.1.pattern={build.postbuild.cmd} ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).*