I use CodeWarrior 10.1 SE with ProcessorExpert 5.1 and MQX 3.7.
I am trying to clone PSP_twrk60n512 and BSP_twrk60n512_PE libraries to the new libraries needed by my new MQX-based application on my new board with the Kinetis K20 cpu.
I am following both MQX User Guide and AN4287 for my porting pourpose.
I see PSP_twrk60n512 and BSP_twrk60n512_PE libraries relay on the MK60N512VMD100.h include file.
I copied the MK20N512VMD100.h include file for K20 cpu from the {CW10.1}\MCU\ProcessorExpert\lib\Kinetis\iofiles folder to the {MQX 3.7}\mqx\source\psp\cortex folder. In this folder I modified the psp_cpudef.h in order to include the needed macroes for K20 cpu:
#define PSP_CPU_MK20N256 (PSP_CPU_NUM(PSP_CPU_ARCH_ARM, PSP_CPU_GROUP_KINETIS_K20, 0))
#define PSP_CPU_MK20X256 (PSP_CPU_NUM(PSP_CPU_ARCH_ARM, PSP_CPU_GROUP_KINETIS_K20, 1))
#define PSP_CPU_MK20N512 (PSP_CPU_NUM(PSP_CPU_ARCH_ARM, PSP_CPU_GROUP_KINETIS_K20, 2))
#define PSP_CPU_K20N512 PSP_CPU_MK20N512
because in the user_config.h include file in the {MQX 3.7}\config\MyBoard folder I have defined:
#define MQX_CPU PSP_CPU_MK20N512
With those changes I got my new PSP library builded.
For the new BSP_PE I modified the ProcessorExpert original project, adding the K20 cpu component (and activating its configuration) and all the LDD emmbedded components needed by my application and regenerating the ProcessorExpert code.
But I get errors when I try to build my new BSP_PE library.
The first error I got ("MK20DZ10 memory map: There is already included another memory map.") was caused by redefinitions in the IO_Map.h include file generated by ProcessorExpert tool. Comparing this file with the same one in the BSP_twrk60n512_PE library I realized I had to modify in the IO_Map.h include file the MCU activation macroes in the same way:
#if !defined(MCU_MK20DZ10) && !defined(MCU_MK20N512VMD100) /* Check if memory map has not been already included */
#define MCU_MK20DZ10
#define MCU_MK20N512VMD100
But then I got another error in the building: "XXX PDD library: Unsupported derivative is active."
I see that in all {embedded components}_PDD.h include file in the {CW10.1}\MCU\ProcessorExpert\lib\Kinetis\pdd\inc folder the test if supported MCU is active looks for the defined MCU_MK60DZ10 and MCU_MK60N512VMD100 macroes for K60, but only for the defined MCU_MK20DZ10 for K20.
Is this the cause of the building error?
Have I to modify all the {embedded components}_PDD.h include files to include K20 too?
Can you provide me a step-by-step procedure to port the PSP and BSP_PE libraries for TWR-K60N512 from Kinetis K60 cpu to another Kinetis cpu (K20, K10, ... ) ?