Thank you Jingjing.
The reason why i want to write at 0x0000410 is just practice for bootload.
Can i ask one?
Could you explain this function? It is from AN2295SW file.
LWord FLASH_FlashCommandSequenceStart(Byte index)
{
Byte* ptrFccobReg = (Byte*)&FLASH_BASE_PTR->FCCOB3;
Byte* ptrCommandObj = (Byte*)&CommandObj;
/* wait till CCIF bit is set */
while(!(FLASH_FSTAT & FLASH_FSTAT_CCIF_MASK)){};
/* clear RDCOLERR & ACCERR & FPVIOL flag in flash status register */
FLASH_FSTAT = FLASH_FSTAT_ACCERR_MASK | FLASH_FSTAT_FPVIOL_MASK | FLASH_FSTAT_RDCOLERR_MASK;
/* load FCCOB registers */
while(index--)
*ptrFccobReg++ = *ptrCommandObj++;
// launch a command
FLASH_FSTAT |= FLASH_FSTAT_CCIF_MASK;
// waiting for the finishing of the command
while(!(FLASH_FSTAT & FLASH_FSTAT_CCIF_MASK)){};
/* Check error bits */
/* Get flash status register value */
return (FLASH_FSTAT & (FLASH_FSTAT_ACCERR_MASK | FLASH_FSTAT_FPVIOL_MASK | FLASH_FSTAT_MGSTAT0_MASK));
}
One more question.
In AN2295SW file, they defined some indexes.
#define ERASE_BLOCK_INDEX 4
#define PROGRAM_LONGWORD_INDEX 8
#define PROGRAM_PHRASE_INDEX 12
Why ERASE BLOCK INDEX is 4 and why LONGWORD is 8 and phrase is 12?
Could you help me?
BR
Eunseok.