Hi,
I have new section defined in linker file
cfgdata (RW) : ORIGIN = 0x00016000, LENGTH = 0x00001000
.cfgdata :
{
. = ALIGN(4);
*(.cfgdata)
. = ALIGN (0x4);
} > cfgdata
in sourcecode:
uint8_t tmpdata[8] __attribute__((section(".cfgdata"))) ={7,6,5,4,3,2,1,0} ;
after startup I call this function:
void test_write()
{
uint8_t data[8]={0,1,2,3,4,5,6,7};
uint8_t newdata[8];
uint32_t addr=0x16000;
uint32_t ret = FLASH_DRV_Init(&Flash1_InitConfig0, &flashSSDConfig2);
ret = FLASH_DRV_EraseSector(&flashSSDConfig2, addr, 4096u);
ret = FLASH_DRV_Program(&flashSSDConfig2, addr, 8, data);
memcpy(newdata,tmpdata,8);
}
when I check memory map , I see 76543210 at addr 0x16000 at startup
when I do FLASH_DRV_EraseSector, it's still there, EraseSector function returns 0, that is success, so why is it not erased?
when I do FLASH_DRV_Program, which also returns 0/success , still old data there ..
BUT!
when I do memcpy(newdata,tmpdata,8); then I have 01234567 bytes in newdata variable ...
BUT - after program reset, I still only see old 76543210 in memory map at tmpdata location ...
When I define tmpdata without specific location (or force it into another location I have configured),
uint8_t tmpdata[8] ={7,6,5,4,3,2,1,0} ;
then erase/flash write is working fine, I can see data at 0x16000 being erased, then written
Does anybody have any idea why this is happening?