Other Parts Discussed in Thread: CONTROLSUITE
I'm getting an error code returned when I attempt to copy data into flash. An absurd lack of an cohesive documentation prevents me from figuring out what exactly is going wrong.
I am calling memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (Uint32)&RamfuncsLoadSize); before attempting the copy, so it's not because I'm attempting to write to flash while running out of flash.
relevant .cmd file parts:
FLASH_UNUSED : origin = 0x3D8000, length = 0x1BFFF
FLASHA : origin = 0x3F4000, length = 0x3F80
ramfuncs : LOAD = FLASHA,
RUN = RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
LOAD_SIZE(_RamfuncsLoadSize),
RUN_START(_RamfuncsRunStart),
PAGE = 0
code:
#pragma CODE_SECTION("ramfuncs");
void mycopy( void )
{
Uint16* dst_ptr = (Uint16*)0x3F0010;
Uint16 srcBuffer[10];
for (int i=0; i<10; i++)
{
srcBuffer[i] = i+200;
}
DINT;
g_status = Flash_Program( dst_ptr, srcBuffer, 10, &g_flashStatus);
EINT;
}
result:
FLASH_ST values after flash_program():
FirstFailAddr: 0x3f0010
ExpectedData: 200
ActualData: 65535 (0xFFFF)
g_status, the return value of Flash_Program() ends up being 0x1E

