This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Fill unused flash with predefined value

Hi,

I use uVision3 with the C166 compiler for an XC167 with external Flash.
My flash utility erases only the used sectors of the flash, but i want all the sectors to be erased. So I thought to fill the hex file with 0xFF.
Can anyone tell me how to do this.

Thanks.

Parents Reply Children
  • I think HEX2BIN has options to fill unused space with a specified value?

    Check it out here: http://www.keil.com/download/list/utility.htm

    But I concur with the others - why not just erase the whole flash?!

  • The problem is, that the flash utility is programmed by an external company and it would cost too much.

  • "So I thought to fill the hex file with 0xFF."

    "[...] and it would cost too much."

    I don't understand your rely. You specifically ask for how to fill the unused flash with a predefined value, and then say that you don't want it because it would cost too much. Exactly what do you want?

    As noted, most flash chips allows erase either of individual flash sectors or of the full chip. The programmer normally has an option to erase the full chip, or specific sectors or only the sectors that are used - or no erase at all if it is known that the chip is empty.

    If you have another company to program the chips - how come that the unused sectors aren't already erased? Are you not producing with brand new chips?

    Second - if you need to erase some sectors to program the chip, ht will take very little time to erase everything.

    Since 0xFF is normally the "empty" value for an erased flash, most programmers can skip processing blocks with 0xFF - the only extra job they then need is that the validate cycle may have to read out the empty blocks too. Some programmers performs a blank check before the programming and then knows that if they start with a blank chip, they do not need to read out and verify blocks of 0xFF.

    Note that serial programmers can take significantly longer to program a chip when the data file is padded with 0xFF, since the transfer time may represent the majority of the programming time. But going the "erase route" should work for them too. No need to program the parts of the chip that are expected to be erased.

  • The erased state of Infineon Flash is zero. So simply skipping it by the programmer is not an option.

  • Correct - some chips have 0x00 and some have 0xff as erased state. But a developer who thinks obviously makes the decision that filled reguions should use the same value as erased cells.