Kiibohd Controller
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.

arm.cmake 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. ###| CMAKE Kiibohd Controller |###
  2. #
  3. # Jacob Alexander 2011-2014
  4. # Due to this file's usefulness:
  5. #
  6. # Released into the Public Domain
  7. #
  8. # Freescale ARM CMake Build Configuration
  9. #
  10. ###
  11. #| Set the Compilers (must be set first)
  12. include( CMakeForceCompiler )
  13. cmake_force_c_compiler ( arm-none-eabi-gcc ARMCCompiler )
  14. cmake_force_cxx_compiler( arm-none-eabi-g++ ARMCxxCompiler )
  15. set( _CMAKE_TOOLCHAIN_PREFIX arm-none-eabi- )
  16. ###
  17. # ARM Defines and Linker Options
  18. #
  19. #| Chip Name (Linker)
  20. #| You _MUST_ set this to match the board you are using
  21. #| type "make clean" after changing this, so all files will be rebuilt
  22. #|
  23. #| "mk20dx128" # Teensy 3.0
  24. #| "mk20dx256" # Teensy 3.1
  25. #set( CHIP "mk20dx128" )
  26. set( CHIP "mk20dx256" )
  27. message( STATUS "Chip Selected:" )
  28. message( "${CHIP}" )
  29. set( MCU "${CHIP}" ) # For loading script compatibility
  30. #| Chip Base Type
  31. #| Automatically chosed based on the chip name.
  32. if ( "${CHIP}" MATCHES "^mk20dx.*$" )
  33. set( CHIP_FAMILY "mk20dx" )
  34. message( STATUS "Chip Family:" )
  35. message( "${CHIP_FAMILY}" )
  36. else ()
  37. message( FATAL_ERROR "Unknown chip family: ${CHIP}" )
  38. endif ()
  39. #| CPU Type
  40. #| You _MUST_ set this to match the board you are using
  41. #| type "make clean" after changing this, so all files will be rebuilt
  42. #|
  43. #| "cortex-m4" # Teensy 3.0, 3.1
  44. set( CPU "cortex-m4" )
  45. message( STATUS "CPU Selected:" )
  46. message( "${CPU}" )
  47. #| Extra Compiler Sources
  48. #| Mostly for convenience functions like interrupt handlers
  49. set( COMPILER_SRCS
  50. Lib/${CHIP_FAMILY}.c
  51. Lib/delay.c
  52. )
  53. message( STATUS "Compiler Source Files:" )
  54. message( "${COMPILER_SRCS}" )
  55. #| USB Defines
  56. set( VENDOR_ID "0x16C0" )
  57. set( PRODUCT_ID "0x0487" )
  58. #| Compiler flag to set the C Standard level.
  59. #| c89 = "ANSI" C
  60. #| gnu89 = c89 plus GCC extensions
  61. #| c99 = ISO C99 standard (not yet fully implemented)
  62. #| gnu99 = c99 plus GCC extensions
  63. set( CSTANDARD "-std=gnu99" )
  64. #| Warning Options
  65. #| -Wall...: warning level
  66. set( WARN "-Wall -g" )
  67. #| Tuning Options
  68. #| -f...: tuning, see GCC manual
  69. #| NOTE: -fshort-wchar is specified to allow USB strings be passed conveniently
  70. set( TUNING "-mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar" )
  71. #| Optimization level, can be [0, 1, 2, 3, s].
  72. #| 0 = turn off optimization. s = optimize for size.
  73. #| (Note: 3 is not always the best optimization level.)
  74. set( OPT "s" )
  75. #| Output Format
  76. #| srec, ihex, binary
  77. set( FORMAT "ihex" )
  78. #| Processor frequency.
  79. #| Normally the first thing your program should do is set the clock prescaler,
  80. #| so your program will run at the correct speed. You should also set this
  81. #| variable to same clock speed. The _delay_ms() macro uses this, and many
  82. #| examples use this variable to calculate timings. Do not add a "UL" here.
  83. set( F_CPU "48000000" )
  84. #| Dependency Files
  85. #| Compiler flags to generate dependency files.
  86. set( GENDEPFLAGS "-MMD" )
  87. #| Compiler Flags
  88. add_definitions( "-mcpu=${CPU} -DF_CPU=${F_CPU} -D_${CHIP}_=1 -O${OPT} ${TUNING} ${WARN} ${CSTANDARD} ${GENDEPFLAGS}" )
  89. #| Linker Flags
  90. set( LINKER_FLAGS "-mcpu=${CPU} -Wl,-Map=${TARGET}.map,--cref -Wl,--gc-sections -mthumb -Wl,--no-wchar-size-warning -T${CMAKE_CURRENT_SOURCE_DIR}/Lib/${CHIP}.ld" )
  91. #| Hex Flags (XXX, CMake seems to have issues if you quote the arguments for the custom commands...)
  92. set( HEX_FLAGS -O ${FORMAT} -R .eeprom )
  93. #| Lss Flags
  94. set( LSS_FLAGS -h -S -z )