|
| 1 | +########################################################################## |
| 2 | +# "THE ANY BEVERAGE-WARE LICENSE" (Revision 42 - based on beer-ware |
| 3 | +# license): |
| 4 | +# <dev@layer128.net> wrote this file. As long as you retain this notice |
| 5 | +# you can do whatever you want with this stuff. If we meet some day, and |
| 6 | +# you think this stuff is worth it, you can buy me a be(ve)er(age) in |
| 7 | +# return. (I don't like beer much.) |
| 8 | +# |
| 9 | +# Matthias Kleemann |
| 10 | +########################################################################## |
| 11 | + |
| 12 | +cmake_minimum_required(VERSION 2.8) |
| 13 | + |
| 14 | +### TOOLCHAIN SETUP AREA ################################################# |
| 15 | +# Set any variables used in the toolchain prior project() call. In that |
| 16 | +# case they are already set and used. |
| 17 | +########################################################################## |
| 18 | + |
| 19 | +########################################################################## |
| 20 | +# tools to beused for programming the AVR |
| 21 | +########################################################################## |
| 22 | +set(AVR_UPLOADTOOL avrdude) |
| 23 | +#set(AVR_PROGRAMMER avrispmkII) |
| 24 | +#set(AVR_UPLOADTOOL_PORT usb) |
| 25 | +set(AVR_PROGRAMMER stk500v2) |
| 26 | +set(AVR_UPLOADTOOL_PORT /dev/ttyACM0) |
| 27 | + |
| 28 | +########################################################################## |
| 29 | +# AVR and fuses needs to be set |
| 30 | +########################################################################## |
| 31 | +set(AVR_MCU atmega2560) |
| 32 | +set(AVR_H_FUSE 0xd9) |
| 33 | +set(AVR_L_FUSE 0xc3) |
| 34 | +set(MCU_SPEED "16000000UL") |
| 35 | + |
| 36 | +### END TOOLCHAIN SETUP AREA ############################################# |
| 37 | + |
| 38 | +# Intentionally left blank, due to a different approach of using the |
| 39 | +# toolchain file via -DCMAKE_TOOLCHAIN_FILE=path/to/generic-gcc-avr.cmake |
| 40 | +# at the cmake command line call |
| 41 | +# |
| 42 | +include(AVRhal/generic-gcc-avr.cmake) |
| 43 | + |
| 44 | +########################################################################## |
| 45 | +# name your project |
| 46 | +########################################################################## |
| 47 | +project(EPROM) |
| 48 | + |
| 49 | +########################################################################## |
| 50 | +# status messages |
| 51 | +########################################################################## |
| 52 | +message(STATUS "Current uploadtool is: ${AVR_UPLOADTOOL}") |
| 53 | +message(STATUS "Current programmer is: ${AVR_PROGRAMMER}") |
| 54 | +message(STATUS "Current upload port is: ${AVR_UPLOADTOOL_PORT}") |
| 55 | +message(STATUS "Current uploadtool options are: ${AVR_UPLOADTOOL_OPTIONS}") |
| 56 | +message(STATUS "Current MCU is set to: ${AVR_MCU}") |
| 57 | +message(STATUS "Current H_FUSE is set to: ${AVR_H_FUSE}") |
| 58 | +message(STATUS "Current L_FUSE is set to: ${AVR_L_FUSE}") |
| 59 | + |
| 60 | +########################################################################## |
| 61 | +# set build type |
| 62 | +########################################################################## |
| 63 | +if(NOT CMAKE_BUILD_TYPE) |
| 64 | + set(CMAKE_BUILD_TYPE Release) |
| 65 | +endif(NOT CMAKE_BUILD_TYPE) |
| 66 | + |
| 67 | +########################################################################## |
| 68 | +# include search paths |
| 69 | +########################################################################## |
| 70 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/AVRhal/include) |
| 71 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/AVRhal/driver) |
| 72 | + |
| 73 | +########################################################################## |
| 74 | +# building library and application in their subdirectories |
| 75 | +########################################################################## |
| 76 | + |
| 77 | +add_subdirectory(AVRhal) |
| 78 | +add_subdirectory(src) |
| 79 | + |
| 80 | + |
0 commit comments