Additional information learned about Flash protection

Technical questions regarding the XTC tools and programming with XMOS.
bearcat
Respected Member
Posts: 283
Joined: Fri Mar 19, 2010 4:49 am

Additional information learned about Flash protection

Post by bearcat »

The XMOS xFlash manual did not answer all my questions regarding write protecting flash devices. So maybe this can help some. If I got something wrong here, speak up.

1 - Only sector protected devices are supported by xFlash for protection. Very few devices offer this. The Atmel AT25DF041A does, most others don't. SR (Status Register) protected devices are not supported, nor are block protection, or global protection supported for hardware protection. The flash chip can be used, but not hardware protected using xFlash. If you specify an SR protected device, xFlash will give an error regarding hardware protection. This means what it says, the device has no hardware protection. Protection relies on correct software programming code.
2 - A custom Flash device can be specified fine, even with SR protection bits. But xFlash only uses the SR bits to un-protect (if it was prior programmed) the device prior to programming. xFlash appears to not verify the protection status is removed (no error is given). It will spit write/verify errors during programming if the device is write protected. After programming, the SR bits are left alone by xFlash. This makes general sense, otherwise an upgrade image could not be written in the future possibly.
3 - That write protect pin does nothing without also setting the protection bits in the status register(s). If you want hardware protection, you must have a means of setting this pin (like a jumper) for all devices. A device with the hardware pin set, can still be written if the SR bits allow this. Once written, the SR bits can't be changed if the hardware pin is set to protect.
4 - It is possible to hardware protect a device with SR protection, but you must do this yourself using the block protection or global protection bits and sizing the factory image to match those sizes. You will most likely need code in your application to set or verify the SR bits.
5 - If you write the Flash yourself in code, you may want to check, then handle, SR bit protection. I did not check if the XMOS flashlib does this.