Commit Graph

21 Commits

Author SHA1 Message Date
Spencer Oliver 32c4c18045 flash: declare fixed arrays const
Change-Id: Id06b8b53ec59a7b3182f60f51dde5b16563aaeef
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1887
Tested-by: jenkins
2014-02-06 22:17:51 +00:00
Nemui Trinomius 3feac9a740 kinetis : improve kinetis flash driver.
Kinetis K-series have different guranuarity for each frequency model.
This patch adding more minute guranuarity detection.
And adopted mass erase command not only L-series but also K-series.
Tested on MK20DX32VLF5,MK10DX32VLF5,and MKL25Z128VLK4.

Change-Id: Iffef850d4b388463756a13faf02c3890bfc19acf
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/1894
Tested-by: jenkins
Reviewed-by: Per Ekman <pekenator@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mateusz Kaduk <mateusz.kaduk@gmail.com>
2014-02-04 13:17:31 +00:00
Per Ekman 1ab86419d7 kinetis : Detect MCU flash parameters based on the SDID register.
Try to detect the flash parameters based on the MCU SDID register. The hope
is that this works for K and KL series MCUs but it has only been tested on
a K21. YMMV.

Change-Id: Idfe71383a449065267f393b09ee3c3b24ac6a803
Signed-off-by: Per Ekman <pekenator@gmail.com>
Reviewed-on: http://openocd.zylin.com/1823
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-22 20:24:42 +00:00
Per Ekman 30fb9dd438 kinetis : Add flash sector size detection for K21 MCU.
The current way of detecting the sector size of the internal
flash does not work for all Kinetis MCUs. Add support for the
K21 flash by detecting the specific model from the SDID register
and picking the correct sector size based on that.

Change-Id: I41f678353e45a44561af8a3398bdd4479dfeea4f
Signed-off-by: Per Ekman <pekenator@gmail.com>
Reviewed-on: http://openocd.zylin.com/1764
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-08 15:09:26 +00:00
Per Ekman b5d7889f51 kinetis : Add flash read support to the kinetis nor flash driver.
The default_flash_read() function seems to work ok.

Change-Id: Ia34c4642405f669ff63310fa8c641098b771a401
Signed-off-by: Per Ekman <pekenator@gmail.com>
Reviewed-on: http://openocd.zylin.com/1763
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-08 15:09:13 +00:00
Paul Fertser f132fcf636 Clean up many C99 integer types format specifiers
This eliminates most of the warnings reported when building for
arm-none-eabi (newlib).

Hsiangkai, there're many similar warnings left in your nds32 files, I
didn't have the nerve to clean them all, probably you could pick it
up.

Change-Id: Id3bbe2ed2e3f1396290e55bea4c45068165a4810
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1674
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31 20:40:03 +00:00
Spencer Oliver 1c41362aea kinetis: add kl flash support
Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391
depends on http://openocd.zylin.com/1602

Change-Id: Ib846be48500a28d515c6dbd3ca2a5c1719cd74d4
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1508
Tested-by: jenkins
Reviewed-by: Chris Fryer <chrisf1874@gmail.com>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
2013-09-08 15:38:51 +00:00
Spencer Oliver 08d4411b59 update files to correct FSF address
Change-Id: I429f7fd51f77b0e7c86d7a7f110ca31afd76c173
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1426
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2013-06-05 19:52:42 +00:00
Christopher Kilgour 392fe70927 kinetis: fix "SF1" parts to limit FlexRAM usage
Ensure FlexRAM usage is limited to half the FlexRAM size when programming.
Assume the FlexNVM sector size is equal to half the FlexRAM.
Fix sector erase checking which had an error introduced when the
  kinetis_ftfx_command( ) signature was changed.

Change-Id: I88edd9c7d4a4ba474cad7b00052feaeedfa8ced8
Signed-off-by: Christopher Kilgour <techie@whiterocker.com>
Reviewed-on: http://openocd.zylin.com/1358
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2013-04-28 07:37:03 +00:00
Alex Austin 3533ce0106 Kinetis: Flash command function matches datasheet
The kinetis datasheets specify the flash registers as bytes rather
than as words, as the previous implementation did.  This also makes
a few code sections slightly less endian-magical.

Change-Id: If8f4adfc7f4341085ae5b6eacbf7d74bbd74cf08
Signed-off-by: Alex Austin <alex.austin@spectrumdsi.com>
Reviewed-on: http://openocd.zylin.com/1192
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-13 12:29:17 +00:00
Alex Austin aa3f7887ea Kinetis: Symbolic names for Addresses and Commands
Change-Id: I2165b66c37bd1608139b5dd00f48124161e13ef0
Signed-off-by: Alex Austin <alex.austin@spectrumdsi.com>
Reviewed-on: http://openocd.zylin.com/1191
Tested-by: jenkins
Reviewed-by: Christopher Kilgour <techie@whiterocker.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-13 12:28:31 +00:00
Andreas Fritiofson 73d87c6210 kinetis: bugfix in kinetis_write() fallback path
Offset calculation into buffer was wrong and code would read outside buffer
if count was not a multiple of four.

Change-Id: Ied625b10221423d5a5f25d27ce1edd8c2c3eca8a
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/749
Reviewed-by: Peter Stuge <peter@stuge.se>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:26:02 +00:00
Christopher Kilgour 4c3972c1df kinetis: ensure flash writes are not truncated
The number if longwords or "sections" (Freescale term) written for a Kinetis
flash write (4, 8, or 16 bytes depending on the part density/granularity) are
now rounded up to ensure there are no truncations when the desired write is
not a multiple of the minimum write size.

Change-Id: I8db40a8769d8ac5393a46cbf4e5ff0df82faf916
Signed-off-by: Christopher Kilgour <techie@whiterocker.com>
Reviewed-on: http://openocd.zylin.com/738
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:25:41 +00:00
Spencer Oliver fb525cdd76 flash: fix FC_FLEX_RAM class code path
If the flash class was defined as FC_FLEX_RAM then this would always drop
through to the default handler.

This bug was found by clang, so untested.

Change-Id: I2d9fe6415dd216728a145519400f7b9ef1bd3c3a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/773
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
2012-08-24 16:49:43 +00:00
Christopher Kilgour aeb3c4f37e kinetis: update support for all program flash granularities
Updates the Kinetis NOR flash support to handle all known block and sector
sizes.  Previously only 2kiB sectors were hard-coded, now all four known
combinations non-volatile sector sizes are supported.

The premise of separating Kinetis Program Flash (PFLASH) from FlexNVM is
also introduced.  This means each "block" of flash (in Freescale terms) is
treated as a bank in OpenOCD.  Correspondingly, the existing board
configuration for the TWR-K60M512 eval system is updated to recognize two
banks instead of one.

A board config for the TWR-K60F120M is also added.

Bank and sector erase and programming has been checked with both of the
mentioned eval boards.

Change-Id: Iae2d10ebf8f548d0a3698df5430bbbe1ccadc58a
Signed-off-by: Christopher Kilgour <techie@whiterocker.com>
Reviewed-on: http://openocd.zylin.com/663
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Jan Dakinevich <jan.dakinevich@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 11:53:37 +00:00
Mathias K 6f5b9e9304 flash: Fix flash write algorithm on pflash only devices.
This patch fix the slow flash write issue on pflash only devices.
The Family Reference Manual says:

For devices with FlexNVM: FlexRAM
For devices with program flash only: Programming acceleration RAM

So the acceleration RAM is available for the flash section command on
this device.

Change-Id: If6541a23a4457c5ed8858848a145f35cac63138b
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/509
Tested-by: jenkins
Reviewed-by: Tomas Frydrych <tf+openocd@r-finger.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14 20:33:23 +00:00
Spencer Oliver 9f0cba528a build: cleanup src/flash/nor directory
Change-Id: Ic299de969ce566282c055ba4dd8b94892c4c4311
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/420
Tested-by: jenkins
2012-02-06 10:54:14 +00:00
Mathias K 16b6b5e7a8 Change return value on error.
On wrong parameters a error is signalized to the calling function.

Change-Id: I484443fdb39938e20382edc9246d5ec546a5c960
Signed-off-by: Mathias K <kesmtp@freenet.de>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/282
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-04 17:56:46 +00:00
Tomas Frydrych a17907d106 kinetis flash: use longword write when writing into pflash
Check whether the destination is in the program flash or NVM regions,
in the former case, use the normal longword mechanism, not the fast NVM
write.

Change-Id: I7366b7c8919928ee690252df83b99701776aee82
Signed-off-by: Tomas Frydrych <tomas@sleepfive.com>
Reviewed-on: http://openocd.zylin.com/194
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-15 20:56:17 +00:00
Øyvind Harboe d5b5f9f4fd kinetis: fix warning about malloc(0) w/assert
Change-Id: Ib40204675bfc5429c744f9ed7e2f7098384b753d
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/47
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-23 13:26:53 +00:00
Mathias K bfe634aa91 kinetis cpu flash driver
Initial release of the freescale kinetis cpu flash driver.
2011-09-17 14:20:37 +02:00