bin 文件和hex文件的区别:
1.bin文件只包含程序数据,因此程序放在哪个位置必须指定;
2.hex文件包含了单片机程序数据信息、程序起始地址信息以及main函数运行地址,使用非常方便。
keil bin文件和hex文件生产方法
1.bin 文件生成
利用keil fromelf 工具,fromelf.exe在keil安装目录下\ARM\ARMCC\bin中可以找到该文件,再通过fromelf 工具实现axf转bin文件。
axf 转 bin:
Project -> Options for Target -> User -> After Build/Rebuild 添加指令:
格式:
基本格式为:
fromelf [options] output_file input_file
其中:
[options]:选项字
output_file:输出文件
input_file:输入文件
例如:
D:\soft\KEIL_ARM\ARM\ARMCC\bin\fromelf.exe --bin --output D:\MDK\MDK-ARM\MDK/Demo.bin D:\MDK\MDK-ARM\MDK/MDK.axf
其中:
选项字为:–bin --output
输出文件:./Objects/Demo.bin
输入文件:./Objects/Demo.axf
2.Hex文件生成
Project ->Options for Target -> Output 勾选上“Create HEX File”