Kiibohd Controller
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.

avr.cmake 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. # avr-gcc CMake Build Configuration
  9. #
  10. ###
  11. #| Set the Compilers (must be set first)
  12. include( CMakeForceCompiler )
  13. cmake_force_c_compiler ( avr-gcc AVRCCompiler )
  14. cmake_force_cxx_compiler( avr-g++ AVRCxxCompiler )
  15. set( _CMAKE_TOOLCHAIN_PREFIX avr- )
  16. ###
  17. # Atmel Defines and Linker Options
  18. #
  19. #| MCU Name
  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. #| "at90usb162" # Teensy 1.0
  24. #| "atmega32u4" # Teensy 2.0
  25. #| "at90usb646" # Teensy++ 1.0
  26. #| "at90usb1286" # Teensy++ 2.0
  27. #set( MCU "atmega32u4" )
  28. set( MCU "at90usb1286" )
  29. message( STATUS "MCU Selected:" )
  30. message( "${MCU}" )
  31. #| Extra Compiler Sources
  32. #| Mostly for convenience functions like interrupt handlers
  33. set( COMPILER_SRCS
  34. # XXX Not needed for avr-gcc
  35. )
  36. #| CPU Type
  37. #| This is only informational for AVR microcontrollers
  38. #| The field can be determined by the microcontroller chip, but currently only one CPU type is used atm
  39. set( CPU "megaAVR" )
  40. message( STATUS "CPU Selected:" )
  41. message( "${CPU}" )
  42. #| USB Defines
  43. set( VENDOR_ID "0x16C0" )
  44. set( PRODUCT_ID "0x047D" )
  45. #| Compiler flag to set the C Standard level.
  46. #| c89 = "ANSI" C
  47. #| gnu89 = c89 plus GCC extensions
  48. #| c99 = ISO C99 standard (not yet fully implemented)
  49. #| gnu99 = c99 plus GCC extensions
  50. set( CSTANDARD "-std=gnu99" )
  51. #| Warning Options
  52. #| -Wall...: warning level
  53. set( WARN "-Wall" )
  54. #| Tuning Options
  55. #| -f...: tuning, see GCC manual and avr-libc documentation
  56. #| NOTE: -fshort-wchar is specified to allow USB strings be passed conveniently
  57. set( TUNING "-funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums" )
  58. #| Optimization level, can be [0, 1, 2, 3, s].
  59. #| 0 = turn off optimization. s = optimize for size.
  60. #| (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
  61. set( OPT "s" )
  62. #| Output Format
  63. #| srec, ihex, binary
  64. set( FORMAT "ihex" )
  65. #| Processor frequency.
  66. #| Normally the first thing your program should do is set the clock prescaler,
  67. #| so your program will run at the correct speed. You should also set this
  68. #| variable to same clock speed. The _delay_ms() macro uses this, and many
  69. #| examples use this variable to calculate timings. Do not add a "UL" here.
  70. set( F_CPU "16000000" )
  71. #| Dependency Files
  72. #| Compiler flags to generate dependency files.
  73. set( GENDEPFLAGS "-MMD -MP" )
  74. #| Compiler Flags
  75. add_definitions( "-mmcu=${MCU} -DF_CPU=${F_CPU} -D_${MCU}_=1 -O${OPT} ${TUNING} ${WARN} ${CSTANDARD} ${GENDEPFLAGS}" )
  76. #| Linker Flags
  77. set( LINKER_FLAGS "-mmcu=${MCU} -Wl,-Map=${TARGET}.map,--cref -Wl,--relax -Wl,--gc-sections" )
  78. #| Hex Flags (XXX, CMake seems to have issues if you quote the arguments for the custom commands...)
  79. set( HEX_FLAGS -O ${FORMAT} -R .eeprom -R .fuse -R .lock -R .signature )
  80. #| Eep Flags (XXX, I've removed this target from the builds, but keeping the set line as a note)
  81. set( EEP_FLAGS -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ${FORMAT} )
  82. #| Lss Flags
  83. set( LSS_FLAGS -h -S -z )