This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

tiobj2bin.bat - image not matched to flash memory



I implement CRC check function in bootloader. Application flash image contains flash size & flash CRC32 value at fixed address. Bootloader check flash CRC32 before jump to application.

I found that I can't use tiobj2bin.bat to generate bin file, because it produces binary image that differs from real flash image. Even I specify --fill=0xFFFFFFFF in armhex command line. I solve my problem using arm-none-eabi-objdump.exe from gcc

arm-none-eabi-objcopy" -O binary --gap-fill 0xFF name.out name.bin

And even in this case some small differences exists. I solve this problem by FILL attribute in link.cmd file

Will be nice to have some utility that can produce binary image of firmware that exactly math to flash memory.

  • I am not sure why there were discrepancies in the object file after you added the fill. You can generate the fill in the linker command file by adding the FILL keyword to the memory directive. See page 208 of the ALT User's Guide.

  • Not works :(
    This is part of map file. End of .text and start of .const secsions

    000347b8 00000008 utils.obj (.text)
    000347c0 00000006 rtsv7R4_T_be_v3D16_eabi.lib : copy_decompress_rle.obj (.text:decompress:rle24)
    000347c6 00000002 --HOLE-- [fill = ffffffff]
    000347c8 00000004 sys_phantom.obj (.text:retain)

    .const 0 000347d0 00001c18
    000347d0 000006cb shell_commands.obj (.const:.string)
    00034e9b 00000001 --HOLE-- [fill = ffffffff]
    00034e9c 00000610 MultiPWM.obj (.const:HET_INIT0_PST)
    000354ac 00000400 crc32.obj (.const:crc32_table)
    000358ac 000002b0 shell_commands.obj (.const:shell_commands)

    You can see what holes inside sections filled with 0xffffffff, but hole between sections not filled. I flash firmware using CSS.
    Bytes 0x347cc-0x347cf are zeros.
    bin file created using objcopy has 0xff between sections.

    C:\auto\platform_tx\tx_io_1\Debug>fc /b c:\tmp\mem tx_io_1.bin
    Comparing files C:\TMP\mem and TX_IO_1.BIN
    000347CC: 00 FF
    000347CD: 00 FF
    000347CE: 00 FF
    000347CF: 00 FF

  • I solve this problem using  palign(8), fill = 0xffffffff in link.cmd file. Now results of objcopy, tiobj2bin.bat, and CSS flash (memory image) are same.

    In this case --fill_value is not necessary