Fill unused bytes of ROM with 0xFF

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fill unused bytes of ROM with 0xFF

3,972 Views
manjunathkm
Contributor III

Hello,

Can anyone guide me with settings required in the IDE to fill unused bytes of ROM location with 0xFF in hex file

I am creating hex file for application that am going to load using CAN bootloader. But the application hex file is created only for the code available. But in my case, i am suppose to fill the unused bytes with 0xFF, So that bootloader will program entire flash memory allocated for the application.

Can someone help with this

thanks in advance..

Manjunath

Tags (1)
3 Replies

3,011 Views
bobpaddock
Senior Contributor III

The erased flash will be 0xFF by default no need to rewrite.

Do you mean there is more than one section that needs to be separated by 0xFF's?

The linker script can be modified:

FILLing unused Memory with the GNU Linker | MCU on Eclipse 

or  SRecord 1.64  can be used to add fill bytes  during the build process.

0 Kudos
Reply

3,011 Views
manjunathkm
Contributor III

Hi Bob,

The link that you have shared is more useful

I am able to fill with 0xFF in the hex file using below script

.fill :
{
FILL(0xFFFFFFFF);
. = ORIGIN(FLASH_2) + LENGTH(FLASH_2) - 1;
BYTE(0xFF)
___ROM_AT = .;
} > FLASH_2

Many Thanks

Manjunath

3,011 Views
manjunathkm
Contributor III

Hi Bob,

I have only one section, Lets say its starts from 0x00010000 and size is 0xFFFF.

Currently the hex file generated only for the used memory, means for the code available. But I have to generate hex file for entire size, So unused location in the hex file shall be filled with 0xFF

Many Thanks

Manjunath

0 Kudos
Reply