Hi,
It's possible to generate the .bin file when running 'Build project' in a SDK_2.0 project?
To avoid having to do it manually.
arm-none-eabi-objcopy -O binary hello_world_frdmk64f.elf hello_world_frdmk64f.bin
Best regards,
Javier
Solved! Go to Solution.
Hi Javier,
I hope this helps,
Erich
My main program starts at 0x5000 so my linker file is
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00005000, LENGTH = 0x000001E8
m_text (RX) : ORIGIN = 0x00005410, LENGTH = 0x000FABF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
/*m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010*/
}
But a bin file generated at the offset 0x5000 not at 0. Even if I feed the file to a bootloader starting at 0x5000 in the bin file - main program doesn't run after exit from a bootloader.
That's exepcted, see https://sourceware.org/binutils/docs/binutils/objcopy.html
objcopy can be used to generate a raw binary file by using an output target of ‘binary’ (e.g., use -O binary). When objcopy generates a raw binary file, it will essentially produce a memory dump of the contents of the input object file. All symbols and relocation information will be discarded. The memory dump will start at the load address of the lowest section copied into the output file.
If you indeed want to have a binary starting with address 0, then I recommend using the SRecord tool which allows you to do any kind of manipulation and conversion, see for example https://mcuoneclipse.com/2018/03/07/converting-binary-files-to-intel-hex-format-with-the-srecord-too...
I hope this helps,
Erich
Thank you. I did so. But when I burn the file with a bootloader - the main program doesn't run. May be I miss something?
I cut out the block 0-4fff that bootloader address space and burn the file starting at 0x5000.
I guess either your bootloader has a problem or your application has a problem.
If you just look at the bin file you won't see the problem.
You have to kick in the debugger to see what is going on: See for example https://mcuoneclipse.com/2020/11/03/debugging-bootloader-and-application-with-one-debug-session/
I hope this helps,
Erich
Hi Javier,
I hope this helps,
Erich
Hi Erich,
Works as a charm. Very useful articles, thanks very much!
Best regards,
Javier