zoukankan      html  css  js  c++  java
  • Converting flat binary into ARM ELF format

    # The part .data=0x08000000 should be replaced with the correct base offset of the ROM.
    # The value 0x08000000 is valid for STM32.
    arm-none-eabi-objcopy -I binary -O elf32-little --change-section-address .data=0x08000000 input.bin output.elf

     转换有问题,改成

    riscv64-unknown-linux-gnu-objcopy  -I binary -O elf64-little --change-section-address .data=0x08000000  fw_payload_g.bin fw_payload_g.elf

     convert the ELF file into a Bin file

     

    RISCV64-UNKNOWN-ELF cross-compilation tool for RISC-V instruction set

    The following environments are performed in the liunx ubuntu x86_64 environment, and the following examples are used to generate a 32-bit file as a target.

    screen  

    // watch IO infos  
    screen /dev/ttyACM0 115200

    compile

    riscv64-unknown-elf-gcc, RISC-V platform's riscv tool-chain.  
    // complie 64-bit file
    riscv64-unknown-elf-gcc -o file file.c
    // complie 32-bit file
    riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -o file file.c 
    process-file (32-bit platform)
    copy code
    // pretreatment
    riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -E -o file.i file.c 
    // compile
    riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -S -o file.s/file.S file.i 
    // assembler
    riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -c -o file.o file.s/file.S
    // link
    riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -o file file.o 
     
    // get ELF-file
    riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -o file file.c
    // ELF to bin
    riscv32-unknown-elf-objcopy -O binary file file.bin 
    // ELF to HEX
    riscv64-unknown-elf-objcopy -O ihex file file.hex
    
    // disassembler ELF to get ASM
    riscv64-unknown-elf-objdump -d file.elf > file.asm
    copy code
    • The ELF file is mainly a target file that is often used under x86linux.
    • BIN file is a direct binary file, there is no address tag internally
    • HEX files are often used to store programs or data transfer to ROM, EPROM, most programmers, and emulators using Intel HEX files.

    Summary: You can translate into other two files by the ELF file, and HEX can also be converted to a bin file, but BIN is to be converted to the HEX file. You must give a base address. HEX and BIN cannot be converted to an ELF file because the amount of information of ELF is large.

    upload

    upload --hex file.hex --jlink JLinkExe
  • 相关阅读:
    EF Load之详讲
    WPF系列 自定控件
    EF6 的性能优化
    WPF系列 Path表示语法详解(Path之Data属性语法)
    WPFTookit Chart 高级进阶
    WPFTookit Chart 入门
    WPF系列-CheckBox
    WPF系列 Style
    ASP.NET MVC 5 with EF 6 上传文件
    WPF Prism
  • 原文地址:https://www.cnblogs.com/dream397/p/15470410.html
Copyright © 2011-2022 走看看