How to fill the unused memory with 0xff in bindary mode

cancel
Showing results for 
Search instead for 
Did you mean: 

How to fill the unused memory with 0xff in bindary mode

890 Views
cheney
Contributor III

Dear team:

    I want to fill the unused memory with 0xff when the output file format is set to Raw binary mode.

   I add the "--gap-fill 0xff" in the <Create Flash Image>command line pattern.

   But the generate code's size become 536,806,400bytes. It's seem that the objcopy tool fill the gap between the rom and ram.

   So how to resolve this problem?

Labels (1)
0 Kudos
3 Replies

444 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

Binary file is raw memory image (all memory in the MCU) - and doesn't contain any info about address - it is continuous file.

You have couple options:

  • The smartest one - is produce srec file instead of raw binary. SREC contains addresses and parsing of that file is very easy and can be implemented in boot loader with low effort. 
  • or split your huge bin file into two (or more) small files without gaps.
  • optimize your code and try to find out what part ends in the RAM (or FlexNVM in case that FlexNVM is used as PFLASH). For FLASH target there shouldn't be code in RAM after build. 

Jiri

0 Kudos

444 Views
cheney
Contributor III

Hi, Jiri:

Thanks for you reply.

It's correct that the bin file is generated without any address information. And i saw the bin file is start from vector table(address:0).

After i tried to fill 0xff to unused space, the target bin file become very huge.

I want to find out why the target bin is generated out of the ROM boundary.

I've upload the test project, please see the attachment.

Hope you can give me some advice.

Best regards!

0 Kudos

443 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I tested your project - and the question is - why you need to fill all unused memory by 0xFF ? Your program doesn't contain any code outside .text section. You can remove --gap-fill 0xff  and use generated .bin file - in your test project 1 480 Bytes long (modified project is attached). 

Jiri

0 Kudos