The Freescale K20DX128 MCU was one of the first ARM Cortex-M devices of that company (now NXP) back in 2012, and the FRDM-K20D50M board was the first ‘FRDM‘ board of a long and successful series of boards, starting back in 2013. I still have the K20 present in many of my designs. The challenge with ‘early’ or ‘legacy’ devices is that after a while, they are ‘not recommended’ any more, and it is hard to get support for them. So for example in newer tooling and software from NXP, there is no support for the K20.

So if you still have the K20 around, and need some newer tooling, then I have good news for you: It is possible to add that good-old-Kinetis to the list of supported LinkServer devices, so you are not stuck and can use newer debugging solutions for the K20.
Outline
To add support for the K20 is possible now, because NXP recently released the LinkServer package and debug solution as gdb server and command line tool. The supported devices are now available with JSON files. So with looking at the existing JSON files, one can add new device support. You can find my new device descriptions on GitHub.
💡 as of writing this article, a new LinkServer V1.2.45 has been released.
JSON Files
The JSON device/board files are located inside <linkserver installation>\devices folder. Copy the file(s) from GitHub into that location. The files describe the device with memory areas and the needed flash driver. Below is an example for the K20DX128 on the FRDM-K20D50M board:
{
"version": "0.0.1",
"vendor": "NXP",
"devices": [
{
"board": "FRDM-K20D50M",
"device": {
"name": "MK20DX128VLH5",
"family": "K2x",
"memory": [
{
"location": "0x00000000",
"size": "0x00020000",
"type": "Flash",
"flash-driver": "FTFA_1K.cfx"
},
{
"location": "0x20000000",
"size": "0x00002000",
"type": "RAM"
},
{
"location": "0x1ffff000",
"size": "0x00002000",
"type": "RAM"
}
],
"cores": [
{
"type": "cm4",
"name": "cm4"
}
]
},
"debug": {
"protocol": "swd",
"swo": false,
"connect-script": "kinetisconnect.scp",
"masserase-script": "kinetismasserase.scp"
}
}
]
}
About the flash drivers (FTFA_1K, 2K, …) I missed first the fact that there is a description about it in the MCUXpresso IDE User Manual, section “17.3 Kinetis Flash Drivers”. The number (1, 2, 4, …) identifies the flash sector size used erasing and for programming.
Usage
To use it for example for the FRDM-K20 or the K20DX128 device:
Erase the flash:
linkserver flash K20:FRDM-K20 erase
Load a ELF/Dwarf file:
linkserver flash K20:FRDM-K20 load FRDM-K20_Blinky.elf
Load a binary file (Linkserer only supports bin files) at address 0x0 (see MCUXpresso IDE: S-Record, Intel Hex and Binary Files):
linkserver flash K20:FRDM-K20 load c:\tmp\FRDM-K20_BlinkyRed.bin --addr 0
Starting a gdb debug server:
linkServer gdbserver K20:FRDM-K20
Summary
One can add new device support to the LinkServer debugger with adding new JSON device description files. After that, new devices can be used with LinkServer or with a gdb connection to it. That way even ‘old’ and ‘legacy’ devices still can be used in the Year 2023. If one is lucky enough to get Kinetis devices at all.
Happy legacing 🙂
Links
- Created and added LinkServer devices: https://github.com/ErichStyger/mcuoneclipse/tree/master/MCU-Link/devices
- A new Freedom Board: FRDM-K20D50M with ARM Cortex M4
- LinkServer Scripting, and how to Recover MCUs with a Script
- LinkServer for Microcontrollers
- USB MSD Host for the FRDM-K20D50M Board
- Comparing CodeWarrior with Kinetis Design Studio
- NXP Kinetis Design Studio v3.2.0
greetings Mr Erich
i’m trying to flash an nxp RT1176 custom board using linkserver , when i flash the EVK it’s working just fine but on the custom one i’m putting a flash NOR on flexSPI2 addr 0x60000000 , so i had to change the flash driver in the linkserver cmd with –override to use the MIMXRT1170_FlexSPI2_A_SFDP_QSPI.cfx , also i modified the .json File like you said , weirdly it start discovering using the MIMXRT1170_FlexSPI2_A_SFDP_QSPI , then it defaults to MIMXRT1170_SFDP_QSPI.cfx ,
any idea why might cause that ??
Thank you so much in advance
LikeLike
Hi Yosri,
Does not ring a bell for me, why it is not handled correctly. could you share your JSON entry? Otherwise that might be something for the NXP forum, so the engineers could have a look at this problem.
Erich
LikeLike