Generate .bin file from KDS 3.2

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Generate .bin file from KDS 3.2

ソリューションへジャンプ
7,571件の閲覧回数
javierhernande1
Contributor IV

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

ラベル(1)
1 解決策
6 返答(返信)
6,499件の閲覧回数
john71
Senior Contributor I

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.

0 件の賞賛
返信
6,496件の閲覧回数
ErichStyger
Specialist I

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

0 件の賞賛
返信
6,493件の閲覧回数
john71
Senior Contributor I

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.

0 件の賞賛
返信
6,484件の閲覧回数
ErichStyger
Specialist I

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

0 件の賞賛
返信
6,671件の閲覧回数
BlackNight
NXP Employee
NXP Employee
6,670件の閲覧回数
javierhernande1
Contributor IV

Hi Erich,

Works as a charm. Very useful articles, thanks very much!

Best regards,

Javier

0 件の賞賛
返信