I'm trying to write to the FLASH on a K20 using KSDK 2.0. My issue seems to be more of a general programming error than anything else. Here is is.
I'm using the following function:
status_t FLASH_Program(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes)
My call looks like this:
uint8_t packet; // Data starts at index 9
result = FLASH_Program(&flashDriver, address, (uint32_t*)&packet, length);
The guts of this function where I'm having the problem is here
|kFCCOBx = *src++;|
I can use a hardcoded value in place of *src++ and the value makes its way into flash. I can put *src++ on another line and that works. Trying to read *src always causes a fault. I can see in the debugger it points to the data I would expect it to point to.