Keyboard firmwares for Atmel AVR and Cortex-M
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.

mcuconf.h 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. ChibiOS - (C) 2015-2016 flabbergast <[email protected]>
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #ifndef _MCUCONF_H_
  14. #define _MCUCONF_H_
  15. #define KL2x_MCUCONF
  16. /*
  17. * HAL driver system settings.
  18. */
  19. #if 1
  20. /* High-frequency internal RC, 48MHz, possible USB clock recovery */
  21. #define KINETIS_MCGLITE_MODE KINETIS_MCGLITE_MODE_HIRC
  22. #define KINETIS_SYSCLK_FREQUENCY 48000000UL
  23. #define KINETIS_CLKDIV1_OUTDIV1 1
  24. #endif
  25. #if 0
  26. /* Low-frequency internal RC, 8 MHz mode */
  27. #define KINETIS_MCGLITE_MODE KINETIS_MCGLITE_MODE_LIRC8M
  28. #define KINETIS_SYSCLK_FREQUENCY 8000000UL
  29. #define KINETIS_CLKDIV1_OUTDIV1 1
  30. #endif
  31. /*
  32. * SERIAL driver system settings.
  33. */
  34. #define KINETIS_SERIAL_USE_UART0 TRUE
  35. /*
  36. * USB driver settings
  37. */
  38. #define KINETIS_USB_USE_USB0 TRUE
  39. /* need to redefine this, since the default is for K20x */
  40. #define KINETIS_USB_USB0_IRQ_PRIORITY 2
  41. /*
  42. * Kinetis FOPT configuration byte
  43. */
  44. /* for KL27: */
  45. #define KINETIS_NV_FOPT_BYTE 0x39
  46. #define KINETIS_NV_FSEC_BYTE 0x7E
  47. /* NV_FOPT: bit7-6/BOOTSRC_SEL=0b00 (11=from ROM; 00=from FLASH)
  48. bit5/FAST_INIT=1, bit4/LPBOOT1=1,
  49. bit3/RESET_PIN_CFG=1, bit2/NMI_DIS=1,
  50. bit1/BOOTPIN_OPT=0, bit0/LPBOOT0=1 */
  51. /* BOOTPIN_OPT: 1=boot depends on BOOTSRC_SEL
  52. 0=boot samples BOOTCFG0=NMI pin */
  53. /* Boot sequence, page 88 of manual:
  54. * - If the NMI/BOOTCFG0 input is high or the NMI function is disabled in FTFA_FOPT, the CPU begins execution at the PC location.
  55. * - If the NMI/BOOTCFG0 input is low, the NMI function is enabled in FTFA_FOPT, and FTFA_FOPT[BOOTPIN_OPT] = 1, this results in an NMI interrupt. The processor executes an Exception Entry and reads the NMI interrupt handler address from vector-table offset 8. The CPU begins execution at the NMI interrupt handler.
  56. * - When FTFA_FOPT[BOOTPIN_OPT] = 0, it forces boot from ROM if NMI/BOOTCFG0 pin set to 0.
  57. *
  58. * Observed behaviour:
  59. * - when BOOTPIN_OPT=0, BOOTSRC_SEL still matters:
  60. * - if 0b11 (from ROM), it still boots from ROM, even if BOOTCFG0 pin
  61. * is high/floating, but leaves ROM and runs user app after
  62. * 5 seconds delay.
  63. * - if 0b00 (from FLASH), reset/powerup jumps to user app unless
  64. * BOOTCFG0 pin is asserted.
  65. * - in any case, reset when in bootloader induces the 5 second delay
  66. * before starting the user app.
  67. *
  68. */
  69. #endif /* _MCUCONF_H_ */