Can code written for K22 controller work on K20 ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can code written for K22 controller work on K20 ?

765 Views
swapnilpendhare
Contributor III

We have been working on the product on both K22 and K20 controller. We are developing an static library (archive) for K22. Now other than controller family, functionality and every other feature are identical for K22 and K20 product. 

So the query is, 

  • If we are taking K20 with exactly same memory specs (512Kb, 128Kb ram, clock frequency) of that of K22, Can we link this static library directly to K20 device ?
  • Can we run executable created for K22 on K20 device ?
Labels (1)
Tags (2)
0 Kudos
2 Replies

667 Views
egoodii
Senior Contributor III

It depends in 'no small part' on whether you are coming from K22 or K22--A.  The 'A' part is 'much closer' to the K20, BUT virtually ALL different members of Kinetis M4-devices still contain variations from such basic things as clock-setup and vector-table, to deeper issues of peripheral-instantiation-configuration such as the FIFO-depth on the SPI ports.  To get one binary that runs 'either processor' will require code that checks WHICH it is actually on, and make at LEAST the appropriate initial setup differences.

0 Kudos

667 Views
BlackNight
NXP Employee
NXP Employee

Hello,

both the K22 and K20 are ARM Cortex-M4 devices. As long as you are only using Cortex-M4 features, the code is compatible. I assume you are using the K22 with floating point unit? In that case be aware that the K20 does not have this, and mixing libraries will be problematic if FPU is used. The other thing is: if you are using device specific peripherals (UART/SPI/etc): they are similar, but not the same.

I hope this helps,

Erich

0 Kudos