Dave
You could look at the uTasker serial loader project - it includes SREC, USB, SD-card and Ethernet loading - it is documented and includes tools for converting and encrpyting files for loading as well as containing projects for CW, KDS, IAR, Keil, Rowley, GCC, CooCox and Atollic.
However... it supports all L and K parts but not E parts. So these are my questions:
- I have looked at the E parts and they have some quite different peripherals to the K and L parts. These look to be more from the 8 bit world, for easing 8 bit users over to the Cortex m0+. I am not sure of demand for these parts (are they automotive type users with small project count but then large unit quantity)? Presently no further development was made for these parts because they didn't look to have large followers. How do you see it and why are you using E rather than L, for example (if not the obvious 5V operating range).
- You talk about loading programs to RAM but the KE02 has maximum 4k RAM so I don't understand this strategy
- I believe that the E parts use the same Flash configuration as K and L parts so you can probably just set the protect bits on the sectors containing the loader (see below for example)
Back to the uTasker serial loader project: It is missing KE peripheral support (sopme may be already be compatible as the Flash driver looks to be) but apart from that it includes all general setups and linker scripts etc., that are needed for the loader. If you have peripheral code to drop in it may already work (without much extra effort).
The flash configuration (including security and sector protection) is a project configuration (example for a KL part below but presumably the same or almost identical for E parts - essentially 0 is set for the protection bit belonging to each sector you want to protect)
// FLASH configuration settings
//
#define BACKDOOR_KEY_0 0
#define BACKDOOR_KEY_1 0
#define BACKDOOR_KEY_2 0
#define BACKDOOR_KEY_3 0
#define BACKDOOR_KEY_4 0
#define BACKDOOR_KEY_5 0
#define BACKDOOR_KEY_6 0
#define BACKDOOR_KEY_7 0
#define PROTECTION_0 0xff // not protected
#define PROTECTION_1 0xff
#define PROTECTION_2 0xff
#define PROTECTION_3 0xff
#define KINETIS_FLASH_CONFIGURATION_BACKDOOR_KEY {BACKDOOR_KEY_0, BACKDOOR_KEY_1, BACKDOOR_KEY_2, BACKDOOR_KEY_3, BACKDOOR_KEY_4, BACKDOOR_KEY_5, BACKDOOR_KEY_6, BACKDOOR_KEY_7}
#define KINETIS_FLASH_CONFIGURATION_PROGRAM_PROTECTION {PROTECTION_0, PROTECTION_1, PROTECTION_2, PROTECTION_3}
#define KINETIS_FLASH_CONFIGURATION_SECURITY (FTFL_FSEC_SEC_UNSECURE | FTFL_FSEC_FSLACC_GRANTED | FTFL_FSEC_MEEN_ENABLED | FTFL_FSEC_KEYEN_ENABLED)
#define KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION (FTFL_FOPT_LPBOOT_CLK_DIV_8 | FTFL_FOPT_RESET_PIN_ENABLED)
#define KINETIS_FLASH_CONFIGURATION_EEPROM_PROT 0xff
#define KINETIS_FLASH_CONFIGURATION_DATAFLASH_PROT 0xff
Regards
Mark
µTasker Kinetis support