5 years, 2 months ago.

Moving code from FRDM-K22F to custom board

Hi all,

i developed a firmware on FRDM-K22F using mbed Classic libraries and now i want to port it on my custom board based on MK21DN512VLK5 processor (50 MHz version w/o FPU). An NXP employee told me that two cores share the same die so the binaries should be very similar.

I would like to know how can i edit compiler settings (i'm using Kinetis Design Studio with ARMGCC) and K22F target configuration to match requirements of my processor (clock sources and values, FPU flag etc...).

Thank you!

2 Answers

5 years, 2 months ago.

Better to use the K22F chip, the same spec as the FRDM board used on Mbed.

Almost everything will be different, Flash/RAM settings, NVIC's, clock set up and embedded peripheral set up will be different. These are set up in the Mbed libraries for that particular MCU.

An NXP field engineer told me that both MCU have the same die so, in theory, it's possible to adapt settings to run mbed starting from K22 target and creating a new target but i have no idea what files i have modify to create the new target. Can you explain me where this settings are located in mbed target structure?

Thank you!

posted by Francesco Salvatore 27 May 2016
5 years, 2 months ago.

The ones you need to modify will be (mainly) in the CMSIS/TARGET_Freescale/... folders, such as the xxx_system.c file where you can change the clock setup. But in addition to that you will at least also need to change your compiler to not make use of the FPU. But the K22F does have an FPU. Your MCU has no FPU. Maybe I am missing something, but I don't see how they could be the same die, unless they only disabled the FPU and haven't removed it, which would surprise me.

I downloaded, imported and compiled (with FPU disabled) the latest version of mbed from GitHub repository. I replaced MK22F51212_features.h, system_MK22F51212.h and .c, and MK22F51212.h with K21 ones from KSDK 1.3.0 and i tried to compile. CMSIS folders seem ok (no compilation errors) but in HAL folder, under TARGET subfolder, we have a lot of errors, especially on drivers files.

posted by Francesco Salvatore 30 May 2016