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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ###| CMAKE Kiibohd Controller |###
  2. #
  3. # Jacob Alexander 2011-2013
  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. #| Compiler Binaries
  16. set( OBJCOPY "avr-objcopy" )
  17. set( OBJDUMP "avr-objdump" )
  18. set( NM "avr-nm" )
  19. set( SIZE "avr-size" )
  20. ###
  21. # Atmel Defines and Linker Options
  22. #
  23. #| MCU Name
  24. #| You _MUST_ set this to match the board you are using
  25. #| type "make clean" after changing this, so all files will be rebuilt
  26. #|
  27. #| "at90usb162" # Teensy 1.0
  28. #| "atmega32u4" # Teensy 2.0
  29. #| "at90usb646" # Teensy++ 1.0
  30. #| "at90usb1286" # Teensy++ 2.0
  31. #set( MCU "atmega32u4" )
  32. set( MCU "at90usb1286" )
  33. message( STATUS "MCU Selected:" )
  34. message( "${MCU}" )
  35. #| Extra Compiler Sources
  36. #| Mostly for convenience functions like interrupt handlers
  37. set( COMPILER_SRCS
  38. # XXX Not needed for avr-gcc
  39. )
  40. #| Compiler flag to set the C Standard level.
  41. #| c89 = "ANSI" C
  42. #| gnu89 = c89 plus GCC extensions
  43. #| c99 = ISO C99 standard (not yet fully implemented)
  44. #| gnu99 = c99 plus GCC extensions
  45. set( CSTANDARD "-std=gnu99" )
  46. #| Warning Options
  47. #| -Wall...: warning level
  48. set( WARN "-Wall -Wstrict-prototypes" )
  49. #| Tuning Options
  50. #| -f...: tuning, see GCC manual and avr-libc documentation
  51. set( TUNING "-funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums" )
  52. #| Optimization level, can be [0, 1, 2, 3, s].
  53. #| 0 = turn off optimization. s = optimize for size.
  54. #| (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
  55. set( OPT "s" )
  56. #| Output Format
  57. #| srec, ihex, binary
  58. set( FORMAT "ihex" )
  59. #| Processor frequency.
  60. #| Normally the first thing your program should do is set the clock prescaler,
  61. #| so your program will run at the correct speed. You should also set this
  62. #| variable to same clock speed. The _delay_ms() macro uses this, and many
  63. #| examples use this variable to calculate timings. Do not add a "UL" here.
  64. set( F_CPU "16000000" )
  65. #| Dependency Files
  66. #| Compiler flags to generate dependency files.
  67. set( GENDEPFLAGS "-MMD -MP" )
  68. #| Compiler Flags
  69. add_definitions( "-mmcu=${MCU} -DF_CPU=${F_CPU} -D_${MCU}_=1 -O${OPT} ${TUNING} ${WARN} ${CSTANDARD} ${GENDEPFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}" )
  70. #| Linker Flags
  71. set( LINKER_FLAGS "-mmcu=${MCU} -Wl,-Map=${TARGET}.map,--cref -Wl,--relax -Wl,--gc-sections" )
  72. #| Hex Flags (XXX, CMake seems to have issues if you quote the arguments for the custom commands...)
  73. set( HEX_FLAGS -O ${FORMAT} -R .eeprom -R .fuse -R .lock -R .signature )
  74. #| Eep Flags (XXX, I've removed this target from the builds, but keeping the set line as a note)
  75. set( EEP_FLAGS -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ${FORMAT} )
  76. #| Lss Flags
  77. set( LSS_FLAGS -h -S -z )