Kinetis flash support in OpenOCD

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

Kinetis flash support in OpenOCD

3,757 Views
tomasvanek
Contributor III

I started a project with a MK22FN1M0VLL12 recently. I tried to use OpenOCD for programing a flash. Unfortunately it failed. As I'm involved in OpenOCD development I was able to make a change in a OpenOCD Kinetis flash driver and programming worked.

I went further and made a quick research of compatibility of the Kinetis flash driver with new families of Kinetis MCUs. The result is quite disappointing: All these families are potentially unsupported:

SF4: K11_M50 K12_M50
        KL16_M48 KL26_M48
SF5: K21_M50 K21_M120 K22_M50 K22_M120 K24_M120 K63 K64
        KL16_M48 KL26_M48
SF6: KL17_M48 KL27_M48
SF7: KV31_M120
SF8: KV31_M120
SF9: K22_M100 KV31_M100
SFA: K02_M100 KV30_M100

Moreover, flashing other series like KE are not supported by OpenOCD at all.


The main problem for an open-source project like OpenOCD is really overwhelming number of Freescale MCUs. It is not possible to improve flash driver and broaden its compatibility without having right hardware to test.


My question or entreaty is: Could Freescale support OpenOCD better?

Thanks

     Tomas

Tags (1)
4 Replies

1,947 Views
tomasvanek
Contributor III

Nobody replied for long time so there is an update from OpenOCD team:

We worked hard on Kinetis flash driver lately. We added support for flashing of K02, K24, K26, K63, K64, K66 series and corrected support for K21 and K22 variants. New code handles also NVM erasing, writing and partitioning to data flash and EEPROM backup parts.

We made lot of improvements like better handling of clean (erased) chip, invalidating of flash cache, watchdog disabling and so one.

New code is not yet available, it is waiting for test and review. The problem we have is lack of testers. If you have some Freescale FRDM or TWRK kit, you have at least basic knowledge of C language and you know what is git, please help us. Please go to OpenOCD-devel Info Page, subscribe OpenOCD-devel mailing list and introduce yourself there. I'll give you detailed instructions by mail.

We would highly appreciate if Freescale can give away a couple of FRDM board to motivate OpenOCD testers. Please be aware that we write the software that Freescale distributes as a component of Kinetis Design Studio.

1,947 Views
tomasvanek
Contributor III

An update: recently released OpenOCD 0.10.0 made a substantial progress in Kinetis support.

  • all members of K02, K21, K22, K24, K26, K63, K64, K66 subfamilies are supported
  • KL series support is extended to dual bank flash devices.
  • KE0x family is supported
  • KV1x, KV3x and KV4x families are supported
  • working FlexNVM handling
  • flash protection setting with prevention of unintentional write to FCF
  • improved handling of secured and erased devices

Please do not use the old customized OpenOCD version distributed with Kinetis Design Studio, it is really obsolete now.

There are also some new features not yet released:

  • support for KE1xF and KE1xZ families
  • support for KL8x family
  • support for KV5x family
  • automatic flash bank configuration based on device probe

We appreciate any help with testing of new features. See previous post how to do so.

1,947 Views
tvarghese
Contributor I

Hi Tomas,

I've been trying to use OpenOCD with a MK20DX256VLH7 and experiencing problems.  Perhaps you can give me some pointers.

A couple of questions:

1) How do I clear the security bit, or is that automatic now?

2) How do I erase the entire flash before programming, is that automatic as well?

3) Should I be using the SWD or the JTAG?  (I don't have the 470 ohm on the TDI line), I have TMS, TDI, TDO and TCK connected up along with the nRESET.

Using the "kx.cfg" file  with "olimex-arm-usb-ocd.cfg" interface configuration.  

Everything seems like it works, except that it finds a couple of bytes that don't verify and the program does not work.  I was able to use a friend's P&E Micro Multilink and his P&E Micro flash programming software, that works and the hardware works fine.  So I"m fairly sure its not the hardware.  I do believe the P&E was using SWD though.

-T

1,947 Views
tomasvanek
Contributor III