PSoC62 erase SFlash

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JeHu_3414236
Level 5
Level 5
10 likes received First like received

When I want to reprogram the bootloader, I use PSoC Programmer to erase SFlash and Main Flash first.  Does this erase SFlash factory settings like trims and ID?  When I dump SFlash it does not show these registers so I don't know.  If I use the COM API PSoC6_WriteRow(), can I erase factory settings or are they write protected?

0 Likes
1 Solution

The comment is relevant only when the silicon is in VIRGIN lifecycle. Silicons leave the factory only after they are transitioned to NORMAL mode and hence there is no way of overwriting or erasing the non-accessible regions of the SFlash.

Sorry about the comment, we will remove it to avoid confusion.

Is it correct to not erase anything in SFlash before programming the bootloader?

I'm not sure about your application, but if you are following the steps to create a secure bootloader as mentioned in this application note, then when programming a secure bootloader, the corresponding public key is placed in the Table of Contents 2 (TOC2) in PSoC 6 MCU supervisory flash (SFlash).

If your application doesn't need to store anything in the user accessible SFlash region, then you need not do anything concerning the SFlash.

Regards,

Dheeraj

View solution in original post

3 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Flash boot, trim constants, and the Table of Contents1 (TOC1) are located in SFlash (Supervisory Flash) which is restricted from being reprogrammed in either Normal or Secure modes. Please find the regions accessible in the SFlash below:

sflash.PNG

Writing to listed sub-regions is not possible when the chip is in SECURE Life Cycle stage. Writing to any Sflash address outside the specified sub-regions is not possible in any Life Cycle stage except VIRGIN, which is a factory-only stage.

So, wehn you perform erase SFlash in PSoC Programmer, we are talking about the regions in the figure.

PSoC6_WriteRow() can only be used on unprotected rows. Factory settings are write protected.

Hope this answers your query

Regards,

Dheeraj

0 Likes

Thank you.  I want to reprogram a secure bootloader using the COM API and the example program from PSoC Programmer examples \Cypress\Programmer\Examples\Programming\PSoC6\SWD\C_Sharp.  In this example it does not erase SFlash before programming with this comment:

//Do not erase Supervisory Flash region, since there stored device configuration data

//PSoC6 device may be corrupted if SFlash will be erased

Is this comment referring to something else besides the factory settings which can corrupt the device?  I tried programming different versions of the secure bootloader using the example code without erasing anything in SFlash first and it seems to work fine.  Is it correct to not erase anything in SFlash before programming the bootloader?

0 Likes

The comment is relevant only when the silicon is in VIRGIN lifecycle. Silicons leave the factory only after they are transitioned to NORMAL mode and hence there is no way of overwriting or erasing the non-accessible regions of the SFlash.

Sorry about the comment, we will remove it to avoid confusion.

Is it correct to not erase anything in SFlash before programming the bootloader?

I'm not sure about your application, but if you are following the steps to create a secure bootloader as mentioned in this application note, then when programming a secure bootloader, the corresponding public key is placed in the Table of Contents 2 (TOC2) in PSoC 6 MCU supervisory flash (SFlash).

If your application doesn't need to store anything in the user accessible SFlash region, then you need not do anything concerning the SFlash.

Regards,

Dheeraj