AT32WB415
Series Reference Manual
2022.04.13
Page 72
Ver 2.00
Program the code to be saved in security library
Perform system reset, and then reload security library setting words
Read the SLIB_STS0/STS1 register to verify the security library settings
Note:
It is not permissible to program the main Flash and its extended area as a security library simultaneously;
Security library must be enabled before the Flash access protection is activated.
Steps to unlock security library:
Write the previously set security library password to the SLIB_PWD_CLR register
Wait until the OBF bit becomes “0”
Perform system reset, and then reload security library setting word
Read the SLIB_STS0 register to check the security library settings
Note: Disabling the security library will automatically perform mass erase for the main memory and for
security library setting block.
5.6.2
Bootloader code area used as Flash memory extension
There is only one chance for users to program the bootloader code area as the Flash memory extension
area, which will have the same features as those of Flash memory after successful configuration as
follows:
Read the bit 0 in the SLIB_STS0 register to obtain the current mode of the bootloader code area
Write the value 0xA35F6D24 to the SLIB_UNLOCK register to unlock the current mode of
bootloader code area
Write non-0xF to the bit [7: 0] in the BTM_MODE_SET register
Wait until the OBF bit becomes 0
Perform a system reset, and reload setting words
Read the SLIB_STS0 register to verify
Note: The main Flash extended are must be set before the Flash access protection is activated.
5.6.3
CRC verify
The sLib code or user code perform optional CRC check on a page level.
CRC verify procedure as follows:
Check the OBF bit in the FLASH_STS register to confirm that there is no other programming
operation in progress;
Program the start address of the code to be verified in the FLASH_CRC_ADDR register
Program the code count (in terms of pages) to be verified through bit [15:0] in the
FLASH_CRC_CTR register
Enable CRC verify bt setting the bit 16 of the FLASH_CRC_CTR register
Wait until the OBF bit becomes 0
Read the FLASH_CRC_CHKR register to verify
Note: The values of the FLASH_CRC_ADDR register must be aligned with the start address of the
page; CRC verify must not cross the main Flash memory and its extension area.