blob: a42dd2561e607388d961ae7b68f03b323a4e84b5 (
plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
INCLUDE(CMakeForceCompiler)
# CROSS COMPILER SETTING
SET(CMAKE_SYSTEM_NAME Generic)
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
# THE VERSION NUMBER
SET (Tutorial_VERSION_MAJOR 1)
SET (Tutorial_VERSION_MINOR 0)
# ENABLE ASM
ENABLE_LANGUAGE(ASM)
SET(CMAKE_STATIC_LIBRARY_PREFIX)
SET(CMAKE_STATIC_LIBRARY_SUFFIX)
SET(CMAKE_EXECUTABLE_LIBRARY_PREFIX)
SET(CMAKE_EXECUTABLE_LIBRARY_SUFFIX)
# CURRENT DIRECTORY
SET(ProjDirPath ${CMAKE_CURRENT_SOURCE_DIR})
# DEBUG LINK FILE
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -T../KSDK_1.2.0/platform/devices/MKL27Z4/linker/gcc/MKL27Z256xxx4_flash.ld -static")
# RELEASE LINK FILE
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -T../KSDK_1.2.0/platform/devices/MKL27Z4/linker/gcc/MKL27Z256xxx4_flash.ld -static")
# DEBUG ASM FLAGS
SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -g -mcpu=cortex-m0plus -mthumb -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99")
# DEBUG C FLAGS
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -mcpu=cortex-m0plus -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99")
# DEBUG LD FLAGS
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g --specs=nano.specs -lm -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker --defsym=__stack_size__=0x300 -Xlinker --defsym=__heap_size__=0x200 -Xlinker --defsym=__ram_vector_table__=1")
# RELEASE ASM FLAGS
SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -mcpu=cortex-m0plus -mthumb -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99")
# RELEASE C FLAGS
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mcpu=cortex-m0plus -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99")
# RELEASE LD FLAGS
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} --specs=nano.specs -lm -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker --defsym=__stack_size__=0x300 -Xlinker --defsym=__heap_size__=0x200 -Xlinker --defsym=__ram_vector_table__=1")
# ASM MACRO
SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -DDEBUG")
# C MACRO
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DFRDM_KL27Z")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DFREEDOM")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DFRDM_KL27Z")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DFREEDOM")
option(BADGE_V "Badge Hardware Version" "1")
if(BADGE_V EQUAL "1")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCPU_MKL27Z256VLH4")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DCPU_MKL27Z256VLH4")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DBADGE_V1")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DBADGE_V1")
endif()
if(BADGE_V EQUAL "2")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCPU_MKL27Z256VFT4")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DCPU_MKL27Z256VFT4")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DBADGE_V2")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DBADGE_V2")
endif()
# CXX MACRO
# INCLUDE_DIRECTORIES
IF(CMAKE_BUILD_TYPE MATCHES Debug)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/osa/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/utilities/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/CMSIS/Include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/devices)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/devices/MKL27Z4/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/devices/MKL27Z4/startup)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/adapter/sources)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/adapter/sources/sdk)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/include/frdmkl27z)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/classes/common)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/classes/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/classes/include/config)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/classes/msd)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/controller/khci)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/controller)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/hal)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/hal/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/drivers/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/system/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/utilities/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/.)
ELSEIF(CMAKE_BUILD_TYPE MATCHES Release)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/osa/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/utilities/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/CMSIS/Include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/devices)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/devices/MKL27Z4/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/devices/MKL27Z4/startup)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/adapter/sources)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/adapter/sources/sdk)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/include/frdmkl27z)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/classes/common)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/classes/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/classes/include/config)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/classes/msd)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/controller/khci)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/sources/controller)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/hal)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/hal/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/drivers/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/system/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/utilities/inc)
INCLUDE_DIRECTORIES(${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/include)
INCLUDE_DIRECTORIES(${ProjDirPath}/.)
ENDIF()
# ADD_EXECUTABLE
ADD_EXECUTABLE(hello_world
"${ProjDirPath}/../KSDK_1.2.0/platform/utilities/src/fsl_debug_console.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/utilities/inc/fsl_debug_console.h"
"${ProjDirPath}/../KSDK_1.2.0/platform/utilities/src/print_scan.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/utilities/src/print_scan.h"
"${ProjDirPath}/../KSDK_1.2.0/platform/devices/MKL27Z4/startup/gcc/startup_MKL27Z4.S"
"${ProjDirPath}/../KSDK_1.2.0/platform/devices/MKL27Z4/startup/system_MKL27Z4.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/devices/startup.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/devices/startup.h"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/dma/fsl_dma_irq.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flexio/fsl_flexio_irq.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/lptmr/fsl_lptmr_irq.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/lpuart/fsl_lpuart_irq.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/spi/fsl_spi_irq.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/CopyToRam.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/DEFlashPartition.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/DFlashGetProtection.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/DFlashSetProtection.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/EEEWrite.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/EERAMGetProtection.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/EERAMSetProtection.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashCheckSum.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashCommandSequence.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashEraseAllBlock.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashEraseBlock.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashEraseResume.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashEraseSector.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashEraseSuspend.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashGetSecurityState.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashInit.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashProgram.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashProgramCheck.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashProgramOnce.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashProgramSection.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashReadOnce.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashReadResource.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashSecurityBypass.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashVerifyAllBlock.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashVerifyBlock.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/FlashVerifySection.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/PFlashGetProtection.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/PFlashSetProtection.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/PFlashSwap.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/PFlashSwapCtl.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/source/SetEEEEnable.c"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/include/FTFx_KX_flash_config.h"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/include/SSD_FTFx.h"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/include/SSD_FTFx_Common.h"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/include/SSD_FTFx_Internal.h"
"${ProjDirPath}/../KSDK_1.2.0/platform/drivers/src/flash/C90TFS/drvsrc/include/SSD_Types.h"
"${ProjDirPath}/main.c"
"${ProjDirPath}/lptmr.c"
"${ProjDirPath}/lptmr.h"
"${ProjDirPath}/epaper.c"
"${ProjDirPath}/epaper.h"
"${ProjDirPath}/disk.c"
"${ProjDirPath}/disk.h"
"${ProjDirPath}/usb_descriptor.c"
"${ProjDirPath}/usb_descriptor.h"
"${ProjDirPath}/flash.c"
"${ProjDirPath}/flash.h"
)
SET_TARGET_PROPERTIES(hello_world PROPERTIES OUTPUT_NAME "hello_world.elf")
TARGET_LINK_LIBRARIES(hello_world -Wl,--start-group)
# LIBRARIES
IF(CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES(hello_world ${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/build/armgcc/usbd_sdk_frdmkl27z_bm/debug/libusbd_bm.a)
TARGET_LINK_LIBRARIES(hello_world ${ProjDirPath}/../KSDK_1.2.0/lib/ksdk_platform_lib/armgcc/KL27Z4/debug/libksdk_platform.a)
ELSEIF(CMAKE_BUILD_TYPE MATCHES Release)
TARGET_LINK_LIBRARIES(hello_world ${ProjDirPath}/../KSDK_1.2.0/usb/usb_core/device/build/armgcc/usbd_sdk_frdmkl27z_bm/release/libusbd_bm.a)
TARGET_LINK_LIBRARIES(hello_world ${ProjDirPath}/../KSDK_1.2.0/lib/ksdk_platform_lib/armgcc/KL27Z4/release/libksdk_platform.a)
ENDIF()
# SYSTEM LIBRARIES
TARGET_LINK_LIBRARIES(hello_world m)
TARGET_LINK_LIBRARIES(hello_world c)
TARGET_LINK_LIBRARIES(hello_world gcc)
TARGET_LINK_LIBRARIES(hello_world nosys)
TARGET_LINK_LIBRARIES(hello_world -Wl,--end-group)
# MAP FILE
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Xlinker -Map=debug/hello_world.map")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Xlinker -Map=release/hello_world.map")
# BIN AND HEX
ADD_CUSTOM_COMMAND(TARGET hello_world POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Oihex ${EXECUTABLE_OUTPUT_PATH}/hello_world.elf ${EXECUTABLE_OUTPUT_PATH}/hello_world.hex)
ADD_CUSTOM_COMMAND(TARGET hello_world POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Obinary ${EXECUTABLE_OUTPUT_PATH}/hello_world.elf ${EXECUTABLE_OUTPUT_PATH}/hello_world.bin)
# vim: set expandtab ts=4 sw=4:
|