Keil MDK Bin Format Guide – Everything You Should Know

Learn to generate Bin files in Keil MDK with this full guide, covering every essential step for seamless development.
Keil MDK Bin Format Guide – Everything You Should Know

Table of Contents

In embedded development, Keil MDK (Microcontroller Development Kit) is a preferred integrated development environment (IDE) for many developers. It supports various ARM Cortex-M microcontrollers and provides powerful debugging and compilation features. In actual development, we often need to generate a Bin format file from the compiled code for firmware flashing or OTA upgrades. This article will detail how to generate a Bin format file in the Keil MDK development environment.

What is a Bin File?

A Bin file (binary file) is a file format that contains raw binary data, typically used for storing microcontroller firmware. Compared to Hex files, Bin files are more compact and directly reflect memory data distribution, making them commonly used for production flashing or remote upgrades.

Why Generate a Bin File?

  • Firmware Flashing: Many flashing tools (such as J-Link and ST-Link) support direct Bin file flashing.
  • OTA Upgrades: Bin files are commonly used as transmission formats in over-the-air (OTA) upgrades.
  • Space Efficiency: Bin files are smaller than Hex files, making them suitable for storage and transmission.

Steps to Generate a Bin File in Keil MDK

1. Open the Project

Launch Keil MDK and open your target project. If you don’t have a project yet, create a new one first.

2. Configure Output Options

Open the Options for Target dialog and navigate to the User tab.

In the Run User Programs After Build/Rebuild section, check Run #1.

In the Run #1 input box, enter the following command:

Go to the Project menu and select Options for Target (or press the shortcut key Alt+F7).

In the pop-up dialog, switch to the Output tab.

Check Create HEX File to ensure the generation of a Hex file. Although this step does not directly generate a Bin file, the Hex file serves as the basis for Bin file generation.

3. Use the fromelf Tool to Generate a Bin File

Keil MDK includes a tool called fromelf, which can convert Hex or ELF files to Bin files. The specific configuration steps are as follows:

C:\Keil_v5\ARM\ARMCC\bin\fromelf.exe --bin -o ..\MDKBOOT.bin ..\MDKObjects\BOOT_MDK.axf  

4. Compile the Project

After saving the settings, click Build (F7) or Rebuild (Ctrl+Alt+F7) to compile the project.

Once compilation is complete, the fromelf tool will automatically generate the Bin file and save it to the specified path.

5. Verify the Output

Open the output directory (e.g., .Output) and check if the project.bin file has been generated.

If the file exists, the generation was successful.

Related:

  1. EXT4, SquashFS, JFFS2 & More: File System Comparison
  2. Why Is Space Occupied on Hard Drives with No Files?
End-of-DiskMFR-blog

Disclaimer:

  1. This channel does not make any representations or warranties regarding the availability, accuracy, timeliness, effectiveness, or completeness of any information posted. It hereby disclaims any liability or consequences arising from the use of the information.
  2. This channel is non-commercial and non-profit. The re-posted content does not signify endorsement of its views or responsibility for its authenticity. It does not intend to constitute any other guidance. This channel is not liable for any inaccuracies or errors in the re-posted or published information, directly or indirectly.
  3. Some data, materials, text, images, etc., used in this channel are sourced from the internet, and all reposts are duly credited to their sources. If you discover any work that infringes on your intellectual property rights or personal legal interests, please contact us, and we will promptly modify or remove it.
DiskMFR Field Sales Manager - Leo

It’s Leo Zhi. He was born on August 1987. Major in Electronic Engineering & Business English, He is an Enthusiastic professional, a responsible person, and computer hardware & software literate. Proficient in NAND flash products for more than 10 years, critical thinking skills, outstanding leadership, excellent Teamwork, and interpersonal skills.  Understanding customer technical queries and issues, providing initial analysis and solutions. If you have any queries, Please feel free to let me know, Thanks

Please let us know what you require, and you will get our reply within 24 hours.









    Our team will answer your inquiries within 24 hours.
    Your information will be kept strictly confidential.

    • Our team will answer your inquiries within 24 hours.
    • Your information will be kept strictly confidential.

    Let's Have A Chat

    Learn How We Served 100+ Global Device Brands with our Products & Get Free Sample!!!

    Email Popup Background 2