GD32VF103 User Manual
40
the Flash Memory page protection functions will be disabled. When WP in the option bytes is
modified, a system reset followed is necessary.
2.3.11.
Security protection
The FMC provides a security protection function to prevent illegal code/data access on the
Flash memory. This function is useful for protecting the software/firmware from illegal users.
No protection: when setting SPC byte and its complement value to 0x5AA5, no protection
performed. The main flash and option bytes block are accessible by all operations.
Under protection: when setting SPC byte and its complement value to any value except
0x5AA5, the security protection is performed. Note that a power reset should be followed
instead of a system reset if the SPC modification is performed while the debug module is still
connected to JTAG device. Under the security protection, the main flash can only be accessed
by user code and the first 4KB flash is under erase/program protection. In debug mode, boot
from SRAM or boot from boot loader mode, all operations to main flash is forbidden. If a read
operation to main flash in debug, boot from SRAM or boot from boot loader mode, a bus error
will be generated. If a program/erase operation to main flash in debug mode, boot from SRAM
or boot from boot loader mode, the WPERR bit in FMC_STAT registers will be set. Option
bytes block are accessible by all operations, which can be used to disable the security
protection. If program back to no protection level by setting SPC byte and its complement
value to 0x5AA5, a mass erase for main flash will be performed.