From: Thomas S. <tho...@gm...> - 2015-09-30 02:43:51
|
Looking at the freescale patch that has this particular K22 working (well, partially, as resets don't work), here are a few differences I noticed that are specific to the K22: - Watchdog: It looks like the K22 needs it's watchdog disabled. The Freescale patch does this in the cortex_m.c file upon a poll. This is clearly not a good place for it. Is there a function in the kinetis.c file that gets called upon a poll of the processor? - Flash erase: The code checks the current run mode of the K22 before a erase. This might be what is going wrong that the flash in VLPR instead of RUN mode? Will investigate this tomorrow. - FCF protection: This is not K22 specific, but the freescale code protects the FCF (Flash Control Field) in the flash. It warns if the uploaded code tries to write a different FCF then is stored in the chip. You have to specifically allow the write of the FCF in order to make it work. I think this is a good idea to implement. And as reference, the Freescale patch is here: http://openocd.zylin.com/gitweb?p=openocd.git;a=commitdiff;h=9bbb98b97a2dc0f2a5f93883a885388e56381cbd - Thomas On Tue, Sep 29, 2015 at 5:35 PM, Thomas Schmid <tho...@gm...> wrote: > Tomas, > > I am trying to add the new K22s. Detecting the DIEID is easy, and I > noticed that I can't use the SECTION support to write the flash as that > needs FlexRAM. The device currently uses the LONGWORD method to program the > flash, but it doesn't seem to work. For some reason, every time I program > the device, it ends up in secured state. > > Any idea what's going on? I use the exact same binary with the PEMicro > programmer and pegdbserver without any issues, so the setting of the flash > bits inside the elf file are not the problem. Do we need a special case for > the K22 and erasing those flash bits? I remember seeing something like this > in the Freescale version of openocd. > > - Thomas > > > On Tue, Sep 29, 2015 at 4:34 PM, Thomas Schmid <tho...@gm...> > wrote: > >> Tomas, >> >> Made a review for the earlier patch. Do I need a device with flexnvm to >> test 2958? >> >> >> - Thomas >> >> >> On Tue, Sep 29, 2015 at 3:21 AM, Paul Fertser <fer...@gm...> >> wrote: >> >>> Hey Tomas :) >>> >>> On Tue, Sep 29, 2015 at 11:06:21AM +0200, Tomas Vanek wrote: >>> > And if you want to help, [2]http://openocd.zylin.com/#/c/2958/ >>> > needs a review - it is kind of trivial change and I'd like to have it >>> merged >>> > before I upload >>> > new work: I fixed FlexNVM/data flash handling in Kinetis driver. >>> >>> Please feel free to simply declare kinetis patches ready when you feel >>> like it, and I'll turn your +1s into +2s. >>> >>> -- >>> Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! >>> mailto:fer...@gm... >>> >> >> > |