You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

MEMO.txt 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. mbed patch for Infinity
  2. -----------------------
  3. Without ld script patch vector table it doesn't place vector table in binary file.
  4. And clock setting is changed as Infinity uses internal oscillator instead of exteranl crystal.
  5. diff --git a/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld b/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld
  6. index 600751c..55c3393 100644
  7. --- a/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld
  8. +++ b/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld
  9. @@ -43,7 +43,7 @@ SECTIONS
  10. .isr_vector :
  11. {
  12. __vector_table = .;
  13. - KEEP(*(.vector_table))
  14. + KEEP(*(.isr_vector))
  15. *(.text.Reset_Handler)
  16. *(.text.System_Init)
  17. . = ALIGN(4);
  18. diff --git a/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c b/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
  19. index 393d1f0..b78b71a 100644
  20. --- a/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
  21. +++ b/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
  22. @@ -44,7 +44,7 @@
  23. #define DISABLE_WDOG 1
  24. -#define CLOCK_SETUP 1
  25. +#define CLOCK_SETUP 0
  26. /* Predefined clock setups
  27. 0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
  28. Reference clock source for MCG module is the slow internal clock source 32.768kHz
  29. CMSIS/mbed HAL
  30. ==============
  31. http://developer.mbed.org/users/MACRUM/notebook/mbed-library-internals/
  32. api/ mbed API
  33. ├── AnalogIn.h
  34. ├── AnalogOut.h
  35. ├── BusIn.h
  36. ├── BusInOut.h
  37. ├── BusOut.h
  38. ├── CallChain.h
  39. ├── CAN.h
  40. ├── can_helper.h
  41. ├── DigitalIn.h
  42. ├── DigitalInOut.h
  43. ├── DigitalOut.h
  44. ├── DirHandle.h
  45. ├── Ethernet.h
  46. ├── FileBase.h
  47. ├── FileHandle.h
  48. ├── FileLike.h
  49. ├── FilePath.h
  50. ├── FileSystemLike.h
  51. ├── FunctionPointer.h
  52. ├── I2C.h
  53. ├── I2CSlave.h
  54. ├── InterruptIn.h
  55. ├── InterruptManager.h
  56. ├── LocalFileSystem.h
  57. ├── mbed_assert.h
  58. ├── mbed_debug.h
  59. ├── mbed_error.h
  60. ├── mbed.h
  61. ├── mbed_interface.h
  62. ├── platform.h
  63. ├── PortIn.h
  64. ├── PortInOut.h
  65. ├── PortOut.h
  66. ├── PwmOut.h
  67. ├── RawSerial.h
  68. ├── rtc_time.h
  69. ├── semihost_api.h
  70. ├── SerialBase.h
  71. ├── Serial.h
  72. ├── SPI.h
  73. ├── SPISlave.h
  74. ├── Stream.h
  75. ├── Ticker.h
  76. ├── Timeout.h
  77. ├── TimerEvent.h
  78. ├── Timer.h
  79. ├── toolchain.h
  80. └── wait_api.h
  81. common/ mbed API implementation
  82. hal/ mbed HAL implementation interface
  83. ├── analogin_api.h
  84. ├── analogout_api.h
  85. ├── can_api.h
  86. ├── ethernet_api.h
  87. ├── gpio_api.h
  88. ├── gpio_irq_api.h
  89. ├── i2c_api.h
  90. ├── pinmap.h
  91. ├── port_api.h
  92. ├── pwmout_api.h
  93. ├── rtc_api.h
  94. ├── serial_api.h
  95. ├── sleep_api.h
  96. ├── spi_api.h
  97. └── us_ticker_api.h
  98. targets/hal/TARGET_<vendor>/TARGET_<board>/
  99. mbed HAL implementation
  100. targets/cmsis/ CMSIS interface
  101. core_caInstr.h
  102. core_ca9.h
  103. core_cmFunc.h
  104. core_caFunc.h
  105. core_cmInstr.h
  106. core_cm4_simd.h
  107. core_ca_mmu.h
  108. core_cm0.h
  109. core_cm0plus.h
  110. core_cm3.h
  111. core_cm4.h
  112. targets/cmsis/TARGET_<vendor>/TARGET_<chip>/
  113. <chip>.h
  114. system_<chip>.[ch]
  115. cmsis.h 
  116. cmsis_nvic.[ch]
  117. targets/cmsis/TARGET_<vendor>/TARGET_<chip>/TOOLSCHAIN_<tool>/
  118. startup_<chip>.s
  119. linker-script
  120. Infinity
  121. ========
  122. Massdrop Infinity Keyboard:
  123. https://www.massdrop.com/buy/infinity-keyboard-kit
  124. Freescale MK20DX128VLF5 48-QFP:
  125. http://cache.freescale.com/files/32bit/doc/data_sheet/K20P48M50SF0.pdf
  126. kiibohd controller(MD1):
  127. https://github.com/kiibohd/controller
  128. DFU bootloader:
  129. https://github.com/kiibohd/controller/tree/master/Bootloader
  130. Program with bootloader:
  131. $ dfu-util -D kiibohd.dfu.bin
  132. Pinout:
  133. https://github.com/kiibohd/controller/blob/master/Scan/MD1/pinout
  134. Pin Usage
  135. =========
  136. mk20dx128vlf5
  137. ----
  138. |Keys|
  139. ----
  140. * Strobe (Columns)
  141. PTB0
  142. PTB1
  143. PTB2
  144. PTB3
  145. PTB16
  146. PTB17
  147. PTC4
  148. PTC5
  149. PTD0
  150. * Sense (Rows)
  151. PTD1
  152. PTD2
  153. PTD3
  154. PTD4
  155. PTD5
  156. PTD6
  157. PTD7
  158. -----
  159. |Debug|
  160. -----
  161. * SWD
  162. PTA0 (Pull-down)
  163. PTA3 (Pull-up)
  164. * LEDs
  165. PTA19 (LED only for PCB, not McHCK) (XTAL)
  166. * UARTs
  167. PTA1 - RX0
  168. PTA2 - TX0
  169. ------
  170. |Unused|
  171. ------
  172. * GPIO
  173. PTA1 (Not broken out on PCB, available on McHCK) (Pull-up)
  174. PTA2 (")
  175. PTA4 (Pull-up)
  176. PTA18 (EXTAL)
  177. PTC0
  178. PTC1
  179. PTC2
  180. PTC3
  181. PTC6
  182. PTC7
  183. * Analog
  184. ADC0_DP0
  185. ADC0_DM0
  186. Freescale kinetis MK20DX128
  187. ===========================
  188. If FSEC of flash config at 0x400-40F is changed accidentally SWD/JTAG debug access will be lost and very difficult to get back.
  189. For example, high level adapter like stlink cannot work to get access back after FSEC is changed. To regain the chip to be programmable low level DAP inteface like JTAG, CMSIS-DAP or OpenSAD.
  190. Memory map
  191. ==========
  192. kiibohd bootloader: Lib/mk20dx128vlf5.bootloader.ld
  193. 0x0000_0000 +-------------------+ -----------------+---------------+
  194. | .vectors | ---------. | StackPointer0 |
  195. | .startup | \ | ResetHandler1 |
  196. | .rodata | \ | ... |
  197. 0x0000_0400 | .flashconfig | 0x10 \ | ... |
  198. | .text | \ | ... 61 | 0xF7
  199. | .init | `--+---------------+ 0xF8
  200. 0x0000_1000 +-------------------+ 4KB
  201. | _app_rom |
  202. ~ ~
  203. ~ ~
  204. | |
  205. 0x07FF_FFFF +-------------------+ 128KB
  206. 0x1FFF_E000 +-------------------+
  207. | |
  208. | RAM |
  209. | 8KB|
  210. 0x2000_0000 +-------------------+
  211. | |
  212. | RAM |
  213. | 8KB|
  214. 0x2000_2000 +-------------------+ _estack
  215. OpenOCD
  216. ========
  217. Synopsis of SWD, JTAG and SWJ-DP transport:
  218. https://fedcsis.org/proceedings/2012/pliks/279.pdf
  219. OpenSDA Freescale: Mass storage bootloader & serial port; part of CMSIS-DAP?
  220. http://cache.freescale.com/files/32bit/doc/user_guide/OPENSDAUG.pdf
  221. interface_list:
  222. 1: ftdi
  223. 2: usb_blaster
  224. 3: usbprog
  225. 4: jlink
  226. 5: vsllink
  227. 6: rlink
  228. 7: ulink
  229. 8: arm-jtag-ew
  230. 9: hla
  231. 10: osbdm
  232. 11: opendous
  233. 12: aice
  234. 13: cmsis-dap
  235. transport list:
  236. stlink_swim
  237. hla_jtag
  238. hla_swd
  239. aice_jtag
  240. swd
  241. cmsis-dap
  242. jtag
  243. target types:
  244. arm7tdmi
  245. arm9tdmi
  246. arm920t
  247. arm720t
  248. arm966e
  249. arm946e
  250. arm926ejs
  251. fa526
  252. feroceon
  253. dragonite
  254. xscale
  255. cortex_m
  256. cortex_a
  257. cortex_r4
  258. arm11
  259. mips_m4k
  260. avr
  261. dsp563xx
  262. dsp5680xx
  263. testee
  264. avr32_ap7k
  265. hla_target
  266. nds32_v2
  267. nds32_v3
  268. nds32_v3m
  269. or1k
  270. quark_x10xx
  271. TAP
  272. ---
  273. http://openocd.sourceforge.net/doc/html/TAP-Declaration.html#TAP-Declaration
  274. jtag newtap chipname tapname configparams...
  275. hla newtap chipname tapname configparams...
  276. swd newtap chipname tapname configparams...
  277. cmsis-dap newtap chipname tapname configparams...
  278. The tapname reflects the role of that TAP, and should follow this convention:
  279. bs – For boundary scan if this is a separate TAP;
  280. cpu – The main CPU of the chip, alternatively arm and dsp on chips with both ARM and DSP CPUs, arm1 and arm2 on chips with two ARMs, and so forth;
  281. etb – For an embedded trace buffer (example: an ARM ETB11);
  282. flash – If the chip has a flash TAP, like the str912;
  283. jrc – For JTAG route controller (example: the ICEPick modules on many Texas Instruments chips, like the OMAP3530 on Beagleboards);
  284. tap – Should be used only for FPGA- or CPLD-like devices with a single TAP;
  285. unknownN – If you have no idea what the TAP is for (N is a number);
  286. when in doubt – Use the chip maker's name in their data sheet. For example, the Freescale i.MX31 has a SDMA (Smart DMA) with a JTAG TAP; that TAP should be named sdma.
  287. -irlen NUMBER
  288. The length in bits of the instruction register, such as 4 or 5 bits.
  289. Target
  290. ------
  291. http://openocd.sourceforge.net/doc/html/CPU-Configuration.html#CPU-Configuration
  292. target create target_name type configparams...
  293. $target_name configure configparams...
  294. -chain-position dotted.name – names the TAP used to access this target.
  295. -endian (big|little) – specifies whether the CPU uses big or little endian conventions
  296. -event event_name event_body – See Target Events. Note that this updates a list of named event handlers. Calling this twice with two different event names assigns two different handlers, but calling it twice with the same event name assigns only one handler.
  297. -work-area-backup (0|1) – says whether the work area gets backed up; by default, it is not backed up. When possible, use a working_area that doesn't need to be backed up, since performing a backup slows down operations. For example, the beginning of an SRAM block is likely to be used by most build systems, but the end is often unused.
  298. -work-area-size size – specify work are size, in bytes. The same size applies regardless of whether its physical or virtual address is being used.
  299. -work-area-phys address – set the work area base address to be used when no MMU is active.
  300. -work-area-virt address – set the work area base address to be used when an MMU is active. Do not specify a value for this except on targets with an MMU. The value should normally correspond to a static mapping for the -work-area-phys address, set up by the current operating system.
  301. -rtos rtos_type – enable rtos support for target, rtos_type can be one of auto|eCos|ThreadX| FreeRTOS|linux|ChibiOS|embKernel See RTOS Support.
  302. Flash
  303. -----
  304. http://openocd.sourceforge.net/doc/html/Flash-Commands.html#norconfiguration
  305. flash bank name driver base size chip_width bus_width target [driver_options]
  306. name ... may be used to reference the flash bank in other flash commands. A number is also available.
  307. driver ... identifies the controller driver associated with the flash bank being declared. This is usually cfi for external flash, or else the name of a microcontroller with embedded flash memory. See Flash Driver List.
  308. base ... Base address of the flash chip.
  309. size ... Size of the chip, in bytes. For some drivers, this value is detected from the hardware.
  310. chip_width ... Width of the flash chip, in bytes; ignored for most microcontroller drivers.
  311. bus_width ... Width of the data bus used to access the chip, in bytes; ignored for most microcontroller drivers.
  312. target ... Names the target used to issue commands to the flash controller.
  313. driver_options ... drivers may support, or require, additional parameters. See the driver-specific documentation for more information.
  314. flash write_image [erase] [unlock] filename [offset] [type]
  315. Memory Access
  316. -------------
  317. http://openocd.sourceforge.net/doc/html/General-Commands.html#imageaccess
  318. {mdw,mdh,mdb} addr [count]
  319. dump {word, half-word, byte} data
  320. {mww,mwh,mwb} addr data
  321. write data