-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
84 lines (69 loc) · 2.36 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
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Toolchain Settings
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/toolchain.cmake)
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON" FORCE)
cmake_minimum_required(VERSION 3.27.8)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true)
project(Proteus LANGUAGES C CXX ASM)
add_executable(${PROJECT_NAME}.elf
Startup/startup_mk60d10.cpp
FreeRTOS/Source/croutine.c
FreeRTOS/Source/event_groups.c
FreeRTOS/Source/list.c
FreeRTOS/Source/queue.c
FreeRTOS/Source/tasks.c
FreeRTOS/Source/portable/GCC/ARM_CM3/port.c
FreeRTOS/Source/portable/GCC/ARM_CM3/fsl_tickless_systick.c
Drivers/mcg.cpp
Drivers/i2c.cpp
Drivers/spi.cpp
Drivers/uart.cpp
Drivers/ff.cpp
Drivers/SDHC.cpp
Drivers/lptmr.cpp
Drivers/adc16.cpp
Drivers/FEHXBee.cpp
Drivers/FEHPropeller.cpp
Drivers/FEHProteus.cpp
Drivers/exception_handler.cpp
Drivers/exception_handler.s
Libraries/FEHMotor.cpp
Libraries/FEHUtility.cpp
Libraries/FEHIO.cpp
Libraries/FEHBuzzer.cpp
Libraries/FEHServo.cpp
Libraries/FEHLCD.cpp
Libraries/FastLCD.cpp
Libraries/FEHAccel.cpp
Libraries/FEHBattery.cpp
Libraries/FEHRCS.cpp
Libraries/FEHSD.cpp
Libraries/FEHRandom.cpp
main.cpp
)
# Compiler flags
target_compile_options(${PROJECT_NAME}.elf PRIVATE -Wall -Os)
# Add includes
include_directories(.
Libraries/
Drivers/
Startup/
FreeRTOS
FreeRTOS/Source/include
FreeRTOS/Source/portable/GCC/ARM_CM3
)
# Add linker script
target_link_options(${PROJECT_NAME}.elf PRIVATE
-Wl,--print-memory-usage,--gc-sections,-Map,${PROJECT_NAME}.map
-T${CMAKE_CURRENT_SOURCE_DIR}/Linker/MK60DN512Z_flash.ld
)
# Add FEH scripts
file(COPY Tools/copyS19 Tools/copyS19.bat Tools/sizeGet Tools/sizeGet.bat DESTINATION Tools/)
# Create S19 file from Proteus.elf and invoke the script to copy it to the SD card.
add_custom_target(${PROJECT_NAME}.s19 ALL
DEPENDS ${PROJECT_NAME}.elf
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND arm-none-eabi-size ${PROJECT_NAME}.elf > size.txt
COMMAND ${CMAKE_OBJCOPY} -O srec --srec-len=40 --srec-forceS3 ${PROJECT_NAME}.elf ${PROJECT_NAME}.s19
COMMAND Tools/copyS19
)