#If there is no errors, system console prints 0x00000080
read_flag_status_reg
#Attempt to write data on protected sector
write_memory 0x40000000 0xabcd1234
#Bit 0 and Bit 4 of flag status register will set to 1 indicates program
#operation has failed and program operation has attempted to modify the
#protected array respectively
read_flag_status_reg
#set bit 0 and bit 4 to 0 to clear the error bit
clear_flag_status_reg 0x00000080
#read back flag status register to confirm the error bits are cleared
read_flag_status_reg