How to convert elf file to binary file that could boot from SD based on CycloneV and FreeRTOS

Hello Everyone. I am developing a project based on Altera Cyclone V SoC RTOS Demo(http://www.freertos.org/RTOSAlteraSoCARMCortex-A9.html). That Demo has been ported successfully and debug normally. Then I try to convert elf file (RTOSDemo.elf) to binary image file which could be stored in a SD card and boot from it, but failed. Two steps I have tried. Firstly, use tool “arm-altera-eabi-objcopy” as following. arm-altera-eabi-objcopy -O binary RTOSDemo.elf RTOSDemo.bin The size of file named RTOSDemo.elf is 1.85 MB, after converting,the size of RTOSDemo.bin is 3.99 GB. Secondly, Try use tool “mkimage” as following. mkimage -A arm -T standalone -C none -a 0x100040 -e 0 -n “Baremetal Image” -d RTOSDemo.bin main-mkimage.bin But the shell return as follow. D:altera15.0embeddedhost_toolsalteramkimagemkimage.exe: Can’t read RTOSDemo.bin: No error Could you please give me some suggestion? Thank you very much.

How to convert elf file to binary file that could boot from SD based on CycloneV and FreeRTOS

Not really a FreeRTOS question as such (how do the docs for the Altera tools tell you to do this?), but:
Firstly, use tool “arm-altera-eabi-objcopy” as following. arm-altera-eabi-objcopy -O binary RTOSDemo.elf RTOSDemo.bin The size of file named RTOSDemo.elf is 1.85 MB, after converting,the size of RTOSDemo.bin is 3.99 GB.
I presume this is because you have a non-contiguous memory map (for example, executable code far away from some RAM block), and the gaps between the memory regions are just being filled with zeros.

How to convert elf file to binary file that could boot from SD based on CycloneV and FreeRTOS

Thank you for your reply. If there is no need to use the Altera tools as above, could you please tell me how to convert the ELF file to the image file which could be stored in a SD card and boot FreeRTOS demo?