6 years, 4 months ago.

How to download .hex file instead of .bin file on new mbed-os version

Hi guys =)

I'm working with mbed online compiler and mbed cli for a while (almost three years- oh yeah!) and I had tons of problems :D

The newest one is that mbed online compiler generates .bin file instead of .hex. I know that's setting within make file that I can not change in online compiler. I'm developing for NRF52_DK and I know for many tools for bin<->hex conversion (like arm-none-eabi-objcopy) but for some other reasons it would be much better for me to get .hex file after compilation.

Do you have any info is there somewhere secret setting? I used to use .json file for some additional settings for UART but can find anything online related to my current problem.

Thank you, jurica238814

1 Answer

6 years, 4 months ago.

Hello Jurica,

To download a hex file instead of a bin file from the online compiler, you will need to add a target.json file to your working directory and override the output extension. More reference here: https://os.mbed.com/docs/v5.9/tools/adding-and-configuring-targets.html

For example:

Overriding K64F to output hex

"K64F": {
    "core": null,
    "default_toolchain": "ARM",
    "supported_toolchains": null,
    "extra_labels": [],
    "is_disk_virtual": false,
    "macros": [],
    "OUTPUT_EXT": "hex",
    "detect_code": [],
    "public": false
}

Please let me know if you have any questions!

- Peter, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!

Hi Petar, thank you for your reply.

I added target.json file into my project but still the same problem. Compilation and build process give me .bin file only. Here's the json file added into my project:

"NRF52_DK": {
    "core": null,
    "default_toolchain": "ARM",
    "supported_toolchains": null,
    "macros": [],
    "OUTPUT_EXT": "hex",
    "detect_code": [],
    "public": false
}

Thank you, Jurica.

posted by Jurica Resetar 06 Aug 2018