This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
avr-lolshield/CMakeLists.txt

37 lines
1.1 KiB
Text
Raw Normal View History

cmake_minimum_required(VERSION 2.8.3)
SET(BOARD "atmega328p" CACHE STRING "AVR CPU to build for")
SET(CLOCK "16000000" CACHE STRING "CPU clock")
SET(FLASH_FLAGS "-patmega328p" "-carduino" "-P/dev/ttyUSB0" "-b57600" CACHE STRING "avrdude flags")
find_program(AVR_GCC avr-gcc)
find_program(AVRDUDE avrdude)
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_C_COMPILER ${AVR_GCC})
project(ARDKBD C)
set(CMAKE_MODULE_PATH ${ARDKDB_SOURCE_DIR})
add_executable(lolshield.elf
lolshield.c
Charliplexing.c
)
set_target_properties(lolshield.elf PROPERTIES
COMPILE_FLAGS "-Wall -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Os -mmcu=${BOARD}"
LINK_FLAGS "-Wall -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Os -mmcu=${BOARD}"
COMPILE_DEFINITIONS "F_CPU=${CLOCK}"
)
add_custom_command(OUTPUT lolshield.hex COMMAND ${CMAKE_OBJCOPY} -O ihex -R .eeprom lolshield.elf lolshield.hex DEPENDS lolshield.elf)
add_custom_target(lolshield ALL DEPENDS lolshield.hex)
add_custom_target(flash COMMAND ${AVRDUDE} ${FLASH_FLAGS} -D -Uflash:w:lolshield.hex:i DEPENDS lolshield)