I am using MK20DX256VLK7. The code I am using to partition it, which I described in my original post, follows:
bool reinitEEPROM = FALSE;
// Partition memory if it has not yet been partitioned
// (based on k40 flexmem example)
if ((SIM_FCFG1 & SIM_FCFG1_DEPART(0xF)) == 0x00000F00) {
reinitEEPROM = TRUE;
FTFL_FCCOB0 = FTFL_FCCOB0_CCOBn(0x80); // Selects the PGMPART command
FTFL_FCCOB1 = 0x00;
FTFL_FCCOB2 = 0x00;
FTFL_FCCOB3 = 0x00;
FTFL_FCCOB4 = EEPROM_256_256;
FTFL_FCCOB5 = DFLASH_SIZE_128;
ExecuteFlashFromRAM();
}
// Wait for EEE memory to be ready
while ((FTFL_FCNFG & FTFL_FCNFG_EEERDY_MASK) == 0) ;
This references the following definitions:
#define __relocate_code__ __attribute__((section(".data"), long_call))
#define EEPROM_256_256 0x35 // subsystem A = 256 bytes, subsystem B = 256 bytes
#define DFLASH_SIZE_128 0x05
// Based on Freescale AN4695 and k40 flexmem example
void __relocate_code__ ExecuteFlashFromRAM(void)
{
FTFL_FSTAT = FTFL_FSTAT_CCIF_MASK;
while(!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK)) ;
}
I did try adjusting the FCCOB4 and FCCOB5 values without success.