-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
30 lines (28 loc) · 1.45 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.16)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/debug)
message(" output should be at: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
set(PRJ_NAME FWD-Hardware)
project(${PRJ_NAME})
set(SRC_FILES
main.c
app/app.c
mcal/gpio/gpio.c
mcal/uart/uart.c
mcal/interrupt/interrupt.c
mcal/timer/timer.c)
add_executable(${PRJ_NAME} ${SRC_FILES})
target_include_directories(${PRJ_NAME} PUBLIC mcal/
ecual/
app/)
set_target_properties(${PRJ_NAME} PROPERTIES OUTPUT_NAME "${PRJ_NAME}.elf")
add_custom_target( Bin_Hex ALL
DEPENDS ${PRJ_NAME}
COMMAND cd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && ${CMAKE_OBJCOPY} "${PRJ_NAME}.elf" -O binary "${PRJ_NAME}.bin"
COMMAND cd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && ${CMAKE_OBJCOPY} "${PRJ_NAME}.elf" -O ihex "${PRJ_NAME}.hex")
add_custom_target( asmInstructions_HeadersDetails ALL
DEPENDS ${PRJ_NAME}
COMMAND cd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && ${CMAKE_OBJDUMP} -D "${PROJECT_NAME}.elf" >> Instructions_${PROJECT_NAME}.asm
COMMAND cd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && ${CMAKE_OBJDUMP} -x "${PROJECT_NAME}.elf" >> HeadersDetails_${PROJECT_NAME})
add_custom_target( SymbolTable ALL
DEPENDS ${PRJ_NAME}
COMMAND cd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && ${CMAKE_NM} "${PROJECT_NAME}.elf" >> SymbolTable_${PROJECT_NAME})