Dear Huy,
please refer to section 3.1 in the AN12523 attached. Part of the firmware flash is protected and cannot be overwritten.
Please also refer to the AN13321 in the following link.
https://www.nxp.com/docs/en/application-note/AN13321.pdf
With Best Regards,
Jozef