Skip to content

Commit 556859e

Browse files
committed
config: Add OUTPUT_EXT
The optional `OUTPUT_EXT` field in Mbed OS `targets.json` specifies the format of the output image. This is important because * some targets only support one image format * each post-binary hook outputs one image only This avoids confusion of having both .hex and .bin images generated while only one of them is usable. Fixes #216
1 parent f58033e commit 556859e

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

news/216.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a CMake variable `MBED_OUTPUT_EXT` for the output image extension.

src/mbed_tools/build/_internal/templates/mbed_config.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(MBED_TARGET "{{target_name}}" CACHE STRING "")
99
set(MBED_CPU_CORE "{{core}}" CACHE STRING "")
1010
set(MBED_C_LIB "{{c_lib}}" CACHE STRING "")
1111
set(MBED_PRINTF_LIB "{{printf_lib}}" CACHE STRING "")
12+
set(MBED_OUTPUT_EXT "{{OUTPUT_EXT}}" CACHE STRING "")
1213

1314
list(APPEND MBED_TARGET_SUPPORTED_C_LIBS {% for supported_c_lib in supported_c_libs %}
1415
{{supported_c_lib}}

tests/build/test_generate_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"supported_form_factors": ["ARDUINO"],
4848
"supported_toolchains": ["ARM", "GCC_ARM", "IAR"],
4949
"trustzone": False,
50+
"OUTPUT_EXT": "hex",
5051
}
5152

5253

@@ -288,6 +289,7 @@ def test_overrides_target_config_param_from_app(matching_target_and_filter, prog
288289
("target.macros", ["DEFINE"], "DEFINE"),
289290
("target.device_has", ["NOTHING"], "DEVICE_NOTHING"),
290291
("target.features", ["ELECTRICITY"], "FEATURE_ELECTRICITY"),
292+
("OUTPUT_EXT", "hex", 'MBED_OUTPUT_EXT "hex"'),
291293
],
292294
)
293295
def test_overrides_target_non_config_params_from_app(

0 commit comments

Comments
 (0)