This is an automated email from Gerrit.

Mateusz Kaduk (mateusz.ka...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/1889

-- gerrit

commit 7af69af61c2cfb7fa673b9833043a7e011ee77b4
Author: Mateusz Kaduk <mateusz.ka...@gmail.com>
Date:   Tue Jan 21 17:26:50 2014 +0100

    Added support for flashing Kinetis K20 such as one on mchck.org board.
    
    Change-Id: I55a818c235c5eacc283e164bbec8c382829b1612
    Signed-off-by: Mateusz Kaduk <mateusz.ka...@gmail.com>

diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index 5e192c0..af25169 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -153,6 +153,7 @@ const struct {
 #define KINETIS_K_SDID_K11  0x00000220
 #define KINETIS_K_SDID_K12  0x00000200
 #define KINETIS_K_SDID_K20  0x00000290
+#define KINETIS_K_SDID_K20_mchck 0x00000010
 #define KINETIS_K_SDID_K21  0x00000230
 #define KINETIS_K_SDID_K22  0x00000210
 #define KINETIS_K_SDID_K30  0x00000120
@@ -783,6 +784,8 @@ static int kinetis_read_part_info(struct flash_bank *bank)
 
        kinfo->klxx = 0;
 
+       LOG_DEBUG("sim_sdid: %d, mcu_type: %d", kinfo->sim_sdid, 
kinfo->sim_sdid & KINETIS_K_SDID_TYPE_MASK);
+
        /* K-series MCU? */
        if ((kinfo->sim_sdid & (~KINETIS_SDID_K_SERIES_MASK)) == 0) {
                uint32_t mcu_type = kinfo->sim_sdid & KINETIS_K_SDID_TYPE_MASK;
@@ -792,6 +795,9 @@ static int kinetis_read_part_info(struct flash_bank *bank)
                        /* 1kB sectors */
                        granularity = 0;
                        break;
+               case KINETIS_K_SDID_K20_mchck:
+                       granularity = 0;
+                       break;
                case KINETIS_K_SDID_K30:
                case KINETIS_K_SDID_K40:
                case KINETIS_K_SDID_K50:
diff --git a/tcl/target/k20.cfg b/tcl/target/k20.cfg
new file mode 100644
index 0000000..c078704
--- /dev/null
+++ b/tcl/target/k20.cfg
@@ -0,0 +1,52 @@
+#
+# Freescale Kinetis K40 devices
+#
+
+#
+# K40 devices support both JTAG and SWD transports.
+#
+source [find target/swj-dp.tcl]
+
+if { [info exists CHIPNAME] } {
+    set _CHIPNAME $CHIPNAME
+} else {
+    set _CHIPNAME k20
+}
+
+# Work-area is a space in RAM used for flash programming
+if { [info exists WORKAREASIZE] } {
+    set _WORKAREASIZE $WORKAREASIZE
+} else {
+    set _WORKAREASIZE 0x1000
+}
+
+if { [info exists ENDIAN] } {
+    set _ENDIAN $ENDIAN
+} else {
+    set _ENDIAN little
+}
+
+if { [info exists CPUTAPID] } {
+    set _CPUTAPID $CPUTAPID
+} else {
+     set _CPUTAPID 0x4ba00477
+}
+
+set _TARGETNAME $_CHIPNAME.cpu
+
+swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 
$_CPUTAPID
+
+target create $_TARGETNAME cortex_m -chain-position $_CHIPNAME.cpu
+
+$_CHIPNAME.cpu configure -event examine-start { puts "START..." ; }
+$_CHIPNAME.cpu configure -event examine-end { puts "END..." ; }
+
+$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 
$_WORKAREASIZE -work-area-backup 0
+
+# Flash Settings
+flash bank $_CHIPNAME.pflash kinetis 0x00000000 $_WORKAREASIZE 0 4 $_TARGETNAME
+
+# if srst is not fitted use SYSRESETREQ to
+# perform a soft reset
+cortex_m reset_config sysresetreq
+

-- 

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to