Hi Jing,
Thank you.
Now I see it more clear but I have managed to do it in a different way. The key is the BOOTPIN_OPT that It has to be set to 1 in order tho boot from BOOTSRC_SEL configuration. If BOOTSRC_SEL = 00 the device will boot from flash as in most cases.
In summary, now it works correctly with the following configuration:
FOPT[NMI_DIS]=0
FOPT[BOOTPIN_OPT]=1
FOPT[BOOTSRC_SEL]=00
__attribute__ ((used,section(".FlashConfig"))) const struct {
unsigned int word1;
unsigned int word2;
unsigned int word3;
unsigned int word4;
//} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3DFE};
//} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF39FE}; // NMI disabled
} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3BFE}; // NMI disabled & BOOTPIN_OPT = 1
regards,
gaston