AnsweredAssumed Answered

flash memory

Question asked by Mr.Cscn on Jan 29, 2016
Latest reply on Jan 29, 2016 by Mr.Cscn
I'm trying to flash memory using stm32f10x_flash library. here the code:

/*in the arm-gcc-link.ld file i added this lines to allocate rom memory for my data*/

.dataconf 0x0807F000:
    {
        KEEP(*(.ROMDATA))
        *(.dataconf*)
        
    } > rom

/*I declared this in the main.c to allocate rom memory */

const uint16_t Pat __attribute__((section (".ROMDATA")));

/* finally the function to flash memory (always in main.c) */

void FlashMemory(void)
{
     uint16_t IDPat = 1; 
     FLASH_Status FlashStat;
     FLASH_Unlock();
     FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
     FlashStat = FLASH_ProgramHalfWord(0x0807F000, IDPat);
     FLASH_Lock();
}

FlashStat is FLASH_ERROR_PG.
can you tell me what it means and where is the error?

Outcomes