diff options
| author | Jun Wako <wakojun@gmail.com> | 2015-01-02 23:19:26 +0900 |
|---|---|---|
| committer | Jun Wako <wakojun@gmail.com> | 2015-01-04 17:21:43 +0900 |
| commit | d5e5dbd0aa28477884940ce045da09a9168859d8 (patch) | |
| tree | 3d58787c97a818414cc91d8eb7e21e2abd7a28d5 /keyboard/infinity | |
| parent | e259a722e7e8abcb97606b6cfbcce99667a66277 (diff) | |
| download | qmk_firmware-d5e5dbd0aa28477884940ce045da09a9168859d8.tar.gz qmk_firmware-d5e5dbd0aa28477884940ce045da09a9168859d8.zip | |
Add openocd config files for K20
Diffstat (limited to 'keyboard/infinity')
| -rw-r--r-- | keyboard/infinity/k20dx32_flash.cfg | 124 | ||||
| -rw-r--r-- | keyboard/infinity/openocd.cfg | 13 |
2 files changed, 137 insertions, 0 deletions
diff --git a/keyboard/infinity/k20dx32_flash.cfg b/keyboard/infinity/k20dx32_flash.cfg new file mode 100644 index 000000000..714d9991f --- /dev/null +++ b/keyboard/infinity/k20dx32_flash.cfg | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | # FreeScale Kinetis K20 devices with 32kB Flash and 8kB Local On-Chip SRAM, | ||
| 2 | # Nemuisan's Special for MK20DN32VFT5,MK20DX32VFT5,MK10DN32VFT5,MK10DX32VFT5 | ||
| 3 | |||
| 4 | |||
| 5 | source [find target/swj-dp.tcl] | ||
| 6 | |||
| 7 | if { [info exists CHIPNAME] } { | ||
| 8 | set _CHIPNAME $CHIPNAME | ||
| 9 | } else { | ||
| 10 | set _CHIPNAME k20 | ||
| 11 | } | ||
| 12 | |||
| 13 | if { [info exists ENDIAN] } { | ||
| 14 | set _ENDIAN $ENDIAN | ||
| 15 | } else { | ||
| 16 | set _ENDIAN little | ||
| 17 | } | ||
| 18 | |||
| 19 | if { [info exists CPUTAPID] } { | ||
| 20 | set _CPUTAPID $CPUTAPID | ||
| 21 | } else { | ||
| 22 | if { [using_jtag] } { | ||
| 23 | set _CPUTAPID 0x4BA00477 | ||
| 24 | } { | ||
| 25 | # this is the SW-DP tap id not the jtag tap id | ||
| 26 | set _CPUTAPID 0x2BA01477 | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | # Work-area is a space in RAM used for flash programming | ||
| 31 | # By default use 8kB | ||
| 32 | if { [info exists WORKAREASIZE] == 0 } { | ||
| 33 | set _WORKAREASIZE 0x2000 | ||
| 34 | } | ||
| 35 | |||
| 36 | # Select "srst_only", Nemuisan said so! | ||
| 37 | echo "Kinetis MUST need Hardware SRST Control to Recover Secure-State!" | ||
| 38 | adapter_nsrst_delay 200 | ||
| 39 | reset_config srst_only | ||
| 40 | |||
| 41 | swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID | ||
| 42 | set _TARGETNAME $_CHIPNAME.cpu | ||
| 43 | target create $_TARGETNAME cortex_m -chain-position $_TARGETNAME | ||
| 44 | |||
| 45 | # It is important that "kinetis mdm check_security" is called for | ||
| 46 | # 'examine-end' event and not 'eximine-start'. Calling it in 'examine-start' | ||
| 47 | # causes "kinetis mdm check_security" to fail the first time openocd | ||
| 48 | # calls it when it tries to connect after the CPU has been power-cycled. | ||
| 49 | $_CHIPNAME.cpu configure -event examine-end { | ||
| 50 | kinetis mdm check_security | ||
| 51 | # Uncomment when gone into s*ck'n secured state! | ||
| 52 | # kinetis mdm mass_erase | ||
| 53 | } | ||
| 54 | |||
| 55 | # K20 has minimun 8kB of SRAM and starts at 1FFFF000. | ||
| 56 | $_TARGETNAME configure -work-area-phys 0x1FFFF000 -work-area-size $_WORKAREASIZE -work-area-backup 0 -rtos auto | ||
| 57 | |||
| 58 | # MK20DN32VFT5,MK20DX32VFT5,MK10DN32VFT5,MK10DX32VFT5 has 32kB of flash memory. | ||
| 59 | flash bank $_CHIPNAME.pflash kinetis 0x00000000 0x8000 0 4 $_TARGETNAME | ||
| 60 | |||
| 61 | |||
| 62 | proc mt_flash {IMGFILE} { | ||
| 63 | flash write_image erase $IMGFILE | ||
| 64 | reset run | ||
| 65 | halt | ||
| 66 | verify_image $IMGFILE | ||
| 67 | reset run | ||
| 68 | shutdown | ||
| 69 | } | ||
| 70 | |||
| 71 | proc mt_flash_bin {IMGFILE OFFSET} { | ||
| 72 | flash write_image erase $IMGFILE $OFFSET bin | ||
| 73 | reset run | ||
| 74 | halt | ||
| 75 | verify_image $IMGFILE $OFFSET bin | ||
| 76 | reset run | ||
| 77 | shutdown | ||
| 78 | } | ||
| 79 | |||
| 80 | proc mt_flash_hex {IMGFILE} { | ||
| 81 | flash write_image erase $IMGFILE 0 ihex | ||
| 82 | reset run | ||
| 83 | halt | ||
| 84 | verify_image $IMGFILE 0 ihex | ||
| 85 | reset run | ||
| 86 | shutdown | ||
| 87 | } | ||
| 88 | |||
| 89 | proc mt_flash_srec {IMGFILE} { | ||
| 90 | flash write_image erase $IMGFILE 0 s19 | ||
| 91 | reset run | ||
| 92 | halt | ||
| 93 | verify_image $IMGFILE 0 s19 | ||
| 94 | reset run | ||
| 95 | shutdown | ||
| 96 | } | ||
| 97 | |||
| 98 | proc mass_erase {} { | ||
| 99 | kinetis mdm mass_erase | ||
| 100 | } | ||
| 101 | |||
| 102 | proc eraser {} { | ||
| 103 | # Verbose procedure confirmed erase routine | ||
| 104 | flash info 0 | ||
| 105 | # CAUTION! "flash erase_sector 0 0 last" goes into secure state!!! | ||
| 106 | # USE "mass_erase" command instead of | ||
| 107 | # flash erase_sector 0 0 last | ||
| 108 | mass_erase | ||
| 109 | shutdown | ||
| 110 | } | ||
| 111 | |||
| 112 | |||
| 113 | #debug_level 3 | ||
| 114 | # HLA doesn't have cortex_m commands | ||
| 115 | if {![using_hla]} { | ||
| 116 | # if srst is not fitted use SYSRESETREQ to | ||
| 117 | # perform a soft reset | ||
| 118 | cortex_m reset_config sysresetreq | ||
| 119 | } | ||
| 120 | adapter_khz 1000 | ||
| 121 | reset_config srst_only srst_nogate connect_assert_srst | ||
| 122 | gdb_target_description disable | ||
| 123 | init | ||
| 124 | reset init | ||
diff --git a/keyboard/infinity/openocd.cfg b/keyboard/infinity/openocd.cfg new file mode 100644 index 000000000..2b0a63b93 --- /dev/null +++ b/keyboard/infinity/openocd.cfg | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | # mchack openocd | ||
| 2 | # https://github.com/mchck/mchck/wiki/Openocd | ||
| 3 | # | ||
| 4 | # adapter: frdm-kl05z with cmsis-dap firmware | ||
| 5 | # inteface: cmsis-dap | ||
| 6 | # transport: hla_swd | ||
| 7 | # target: MK20DX128VLF5 Freescale Kinetis | ||
| 8 | |||
| 9 | # adapter/interface | ||
| 10 | source [find interface/cmsis-dap.cfg] | ||
| 11 | |||
| 12 | # CPU | ||
| 13 | source [find k20dx32_flash.cfg] | ||
