Hello,
First, you have to reserve some Flash pages for data storage. Do that in the CPU Build Options, Reduce the Flash for code, for example :

Then, configure those pages to be used by Flash component:

Then, enable the Flash methods you need:

Now, you can save the data in the code:
Read:
FLASH1_Read(FLASH1Pointer,0x1F000, &savedData.red, sizeof(savedData));
do {
FLASH1_Main(FLASH1Pointer);
OpStatus = FLASH1_GetOperationStatus(FLASH1Pointer);
} while (!((OpStatus == LDD_FLASH_IDLE) | (OpStatus == LDD_FLASH_FAILED)));
Erase one page, in case is not 0xFF the locations to write:
FLASH1_Erase(FLASH1Pointer, 0x1F000, 1024);
do {
FLASH1_Main(FLASH1Pointer);
OpStatus = FLASH1_GetOperationStatus(FLASH1Pointer);
} while (!((OpStatus == LDD_FLASH_IDLE) | (OpStatus == LDD_FLASH_FAILED)));
And then write the data in Flash:
FLASH1_Write(FLASH1Pointer, FromPtr, 0x1F000, Size);
do {
FLASH1_Main(FLASH1Pointer);
OpStatus = FLASH1_GetOperationStatus(FLASH1Pointer);
} while (!((OpStatus == LDD_FLASH_IDLE) | (OpStatus == LDD_FLASH_FAILED)));
I hope this helps,
Luis