]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboard/infinity/mbed-infinity/README
[Erez & Jack] Optimizes shift_interrupted array
[qmk_firmware.git] / keyboard / infinity / mbed-infinity / README
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
6
7 mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
8     Fix SystemInit: clock setup for internal clock. Inifinity has no external Xtal.
9
10 mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/cmsis_nvic.c
11     Fix NVIC vector address of firmware 0x1000 instead of 0x0
12
13 mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld
14     Fix memory map for Infinity bootloader
15         Flash starts at 0x1000
16         No flash config bytes sector
17
18 USBDevice/USBDevice/USBHAL_KL25Z.cpp
19     Fix USB clock setup, see below.
20
21
22 2015/01/04  Based on mbed-sdk @2f63fa7d78a26.
23
24
25
26 Kinetis USB config
27 ==================
28 Clock source: Internal reference clock wth FLL
29     SIM_SOPT[USBSRC] = 1(MCGPLLCLK/MCGFLLCLK)
30     SIM_SOPT[PLLSEL] = 0(MCGFLLCLK)
31
32 Clock dividor:
33     SIM_CLKDIV2[USBDIV] = 0
34     SIM_CLKDIV2[USBFAC] = 0
35
36 Clock enable:
37     SIM_SCGC4[USBOTG] = 1
38
39
40
41 Infinity bootloader change
42 ==========================
43 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.
44
45 We have to do that in earlier phase of mbed startup sequence.
46
47
48 mbed starup sequence files:
49 mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_M20D5.s
50 mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
51
52 Infinity booloader change commit:
53 https://github.com/kiibohd/controller/commit/2c7542e2e7f0b8a99edf563dc53164fe1a439483
54
55 discussion:
56 https://geekhack.org/index.php?topic=41989.msg1686616#msg1686616
57
58
59 WORKAROUND
60 ----------
61 Call SystemInit early in Reset_Handler.
62
63 $ diff -u ../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.s mbed-infinity
64 --- ../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.s      2015-03-22 10:33:22.779866000 +0900
65 +++ mbed-infinity/startup_MK20D5.s      2015-03-22 10:32:56.483866000 +0900
66 @@ -147,6 +147,8 @@
67   *      __etext: End of code section, i.e., begin of data sections to copy from.
68   *      __data_start__/__data_end__: RAM address range that data should be
69   *      copied to. Both must be aligned to 4 bytes boundary.  */
70 +    ldr    r0, =SystemInit
71 +    blx    r0
72
73      ldr    r1, =__etext
74      ldr    r2, =__data_start__
75 @@ -161,8 +163,6 @@
76
77  .Lflash_to_ram_loop_end:
78
79 -    ldr    r0, =SystemInit
80 -    blx    r0
81      ldr    r0, =_start
82      bx    r0
83      .pool