1) Some flash devices default to all (0xFF) when erased, and some default to all (0x00) when erased. Depending on your flash device erase will produce either result 1 or result 2.
2) To get the opposite values, you would need to erase, and then write the value to the flash. (Some flash allows writing to already written data to accumulate instead, and in this case you don't need to erase first.)
See here for flash examples for the PSoC 4:
For PSoC4 User's Flash, the default/Factory value is 0x00.
1. Write 0xFF:
- To write 0xFF, The API, CySysFlashWrite() can be used in customer firmware code. The FlashWrite example integrated in PSoC Creator can be referred.
- To write 0xFF, another way is by SWD interface, with using CLI command and Kitprog/MiniProg-3.
2. Write 0x00, EraseAll is not the only way.
- Similarly, CySysFlashWrite() can be used in customer firmware code.
- another way is through Kitprog/MiniProg-3 with using SWD interface, by CLI/COM command.
Thank you for your answer.
I will ask in addition.
Is there a way to create a Hex file whose "User's Flash (Program)" area is All "1"?
＞Is there a way to create a Hex file whose "User's Flash (Program)" area is All "1"?
Erasing the chip and setting it to be all ones might work using an external programmer like the MiniProg3, but otherwise you can get most of the chip set to all 1's by decaring a constant number array of all 1's in the program.