Skip to content

[RFC] Make Targets.json feild OUTPUT_EXT select output format too #3973

@theotherjimmy

Description

@theotherjimmy
  • Type: Bug/Enhancement
  • Priority: Minor

The feild OUTPUT_EXT renames the ELF file created by the selected tool-chain from <name>.elf to <name>.<OUTPUT_EXT>. I would expect more structured behavior. See below for my recommendations.

Target

  • MCU_NRF52
  • MCU_NRF51
  • MCU_NRF51_UNIFIED
  • TEENSY3_1
  • New targets yet to be added

I did some investigation, and I think that all of the post build hooks for the targets in question would not need to be updated to handle my proposed change.

Compiler

The compilers that would support my proposal are:

  • GCC_ARM: all versions
  • ARM: all versions
  • IAR: all versions

Versions

  • mbed-cli: 1.0.0 (irrelevant)
  • mbed-os: 5.1.0 - master (or longer, I did not check farther back)

Actual behavior

The OUTPUT_EXT field renames the ELF file to whatever is contained within that key.The website build system also uses this key to determine what file to transfer to the user.

Expected behavior

The OUTPUT_EXT field would have 3 allowed values: elf, bin and hex. Each of these would create an appropriate file in the output directory from the ELF file.

  • elf does not create an additional file.
  • bin creates a binary file from the ELF file with the extension .bin. This option should be the default.
  • hex creates an Intel HEX file from the ELF file with the extension .hex.

The website build system would still use the contents of this key to determine what file to transfer to the user.

Reasoning

I have been queried about what this key does several times (in person).Each time I am queried, the question is worded something like "I tried to set the OUTPUT_EXT key in targets.json to hex, but I did not get an Intel HEX file output. What gives?" This Implies to me that writers of targets.json expect the key to change the type of the file in addition to the extension.

Request for comments from

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions