-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdfu.cmake
67 lines (56 loc) · 1.75 KB
/
dfu.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#**************************************************************************************************
#*
#* Copyright Zygmunt Ptak <zygmuntptak@gmail.com> All Rights Reserved.
#*
#* Reviewed
#*
#*/
include("${CMAKE_AVR_PATH}/avr.base.cmake")
set_if(DFU_BIN_PATH "/usr/bin")
set_if(DFU "dfu-programmer")
set_if(DFU_PROG "${DFU_BIN_PATH}/${DFU}")
set(DFU_DEPENDS)
if(${FLASH_HEX})
list(APPEND DFU_DEPENDS ${HEX_FILE})
endif(${FLASH_HEX})
if(${FLASH_EPP})
list(APPEND DFU_DEPENDS ${EPP_FILE})
endif(${FLASH_EPP})
if(${FLASH_HEX})
if(${FLASH_EPP})
add_custom_target(
flash
COMMAND ${DFU_PROG} ${MCU} erase
COMMAND ${DFU_PROG} ${MCU} flash ${HEX_FILE}
COMMAND ${DFU_PROG} ${MCU} flash ${EPP_FILE}
COMMAND ${DFU_PROG} ${MCU} reset
DEPENDS ${DFU_DEPENDS}
COMMENT "Flashing with dfu: ${AVRDUDE_DEPENDS}"
)
else(${FLASH_EPP})
add_custom_target(
flash
COMMAND ${DFU_PROG} ${MCU} erase
COMMAND ${DFU_PROG} ${MCU} flash ${HEX_FILE}
COMMAND ${DFU_PROG} ${MCU} reset
DEPENDS ${DFU_DEPENDS}
COMMENT "Flashing with dfu: ${AVRDUDE_DEPENDS}"
)
endif(${FLASH_EPP})
else(${FLASH_HEX})
if(${FLASH_EPP})
add_custom_target(
flash
COMMAND ${DFU_PROG} ${MCU} erase
COMMAND ${DFU_PROG} ${MCU} flash ${EPP_FILE}
COMMAND ${DFU_PROG} ${MCU} reset
DEPENDS ${DFU_DEPENDS}
COMMENT "Flashing with dfu: ${AVRDUDE_DEPENDS}"
)
else(${FLASH_EPP})
add_custom_target(
flash
COMMENT "Nothing to do in flashing..."
)
endif(${FLASH_EPP})
endif(${FLASH_HEX})