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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. mbed fix for Infinity
  2. =====================
  3. Without linker script patch it doesn't place vector table in final binary.
  4. And clock is configured to 48MHz using internal clock reference and FLL multiplication.
  5. mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
  6. Fix SystemInit: clock setup for internal clock. Inifinity has no external Xtal.
  7. mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/cmsis_nvic.c
  8. Fix NVIC vector address of firmware 0x1000 instead of 0x0
  9. mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld
  10. Fix memory map for Infinity bootloader
  11. Flash starts at 0x1000
  12. No flash config bytes sector
  13. USBDevice/USBDevice/USBHAL_KL25Z.cpp
  14. Fix USB clock setup, see below.
  15. 2015/01/04 Based on mbed-sdk @2f63fa7d78a26.
  16. Kinetis USB config
  17. ==================
  18. Clock source: Internal reference clock wth FLL
  19. SIM_SOPT[USBSRC] = 1(MCGPLLCLK/MCGFLLCLK)
  20. SIM_SOPT[PLLSEL] = 0(MCGFLLCLK)
  21. Clock dividor:
  22. SIM_CLKDIV2[USBDIV] = 0
  23. SIM_CLKDIV2[USBFAC] = 0
  24. Clock enable:
  25. SIM_SCGC4[USBOTG] = 1
  26. Infinity bootloader change
  27. ==========================
  28. After @2c7542e(2015/01) Infinity bootloader doesn't disable watchdog timer and keyboard firmware has to do it itself. mbed disables watchdog in startup sequence but unfortunately timer is timed out bofore that.
  29. We have to do that in earlier phase of mbed startup sequence.
  30. mbed starup sequence files:
  31. mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_M20D5.s
  32. mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
  33. Infinity booloader change commit:
  34. https://github.com/kiibohd/controller/commit/2c7542e2e7f0b8a99edf563dc53164fe1a439483
  35. discussion:
  36. https://geekhack.org/index.php?topic=41989.msg1686616#msg1686616
  37. WORKAROUND
  38. ----------
  39. Call SystemInit early in Reset_Handler.
  40. $ diff -u ../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.s mbed-infinity
  41. --- ../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.s 2015-03-22 10:33:22.779866000 +0900
  42. +++ mbed-infinity/startup_MK20D5.s 2015-03-22 10:32:56.483866000 +0900
  43. @@ -147,6 +147,8 @@
  44. * __etext: End of code section, i.e., begin of data sections to copy from.
  45. * __data_start__/__data_end__: RAM address range that data should be
  46. * copied to. Both must be aligned to 4 bytes boundary. */
  47. + ldr r0, =SystemInit
  48. + blx r0
  49. ldr r1, =__etext
  50. ldr r2, =__data_start__
  51. @@ -161,8 +163,6 @@
  52. .Lflash_to_ram_loop_end:
  53. - ldr r0, =SystemInit
  54. - blx r0
  55. ldr r0, =_start
  56. bx r0
  57. .pool