MDK生成bin格式固件文件

    技术2025-07-31  13

    MDK生成bin格式固件文件


    使用keil自带的fromelf进行转换,在keil的安装目录下的ARM\ARMCC\bin目录中。

    fromelf语法格式使用说明:

    Product: MDK Plus 5.21 Component: ARM Compiler 5.06 update 3 (build 300) Tool: fromelf [4d35c3] For support see http://www.arm.com/support Software supplied by: ARM Limited ARM image conversion utility fromelf [options] input_file Options: --help display this help screen --vsn display version information --output file the output file. (defaults to stdout for -text format) --nodebug do not put debug areas in the output image --nolinkview do not put sections in the output image Binary Output Formats: --bin Plain Binary --m32 Motorola 32 bit Hex --i32 Intel 32 bit Hex --vhx Byte Oriented Hex format --base addr Optionally set base address for m32,i32 Output Formats Requiring Debug Information --fieldoffsets Assembly Language Description of Structures/Classes --expandarrays Arrays inside and outside structures are expanded Other Output Formats: --elf ELF --text Text Information Flags for Text Information -v verbose -a print data addresses (For images built with debug) -c disassemble code -d print contents of data section -e print exception tables -g print debug tables -r print relocation information -s print symbol table -t print string table -y print dynamic segment contents -z print code and data size information

    打开Keil如下图,添加一行:

    fromelf --bin -o "$L@L.bin" "#L"

    fromelf工具中中$L、@L、#L的用法:

    #L表示axf文件路径(带文件名)$L表示axf文件路径(不带文件名)@L表示axf文件名,不包含.axf后缀
    Processed: 0.018, SQL: 9