-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
220 lines (206 loc) · 8.55 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
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
# This file was automagically generated by mbed.org.
# If you would like to add your own targets, create a
# project.cmake file locally in your project directory.
CMAKE_MINIMUM_REQUIRED(VERSION 3.7.2)
SET(CMAKE_SYSTEM_NAME Generic)
#SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_CROSSCOMPILING TRUE)
# force compiler settings
SET(CMAKE_C_COMPILER_WORKS TRUE)
SET(CMAKE_CXX_COMPILER_WORKS TRUE)
# force cmake compilers
SET(CMAKE_ASM_COMPILER "arm-none-eabi-gcc")
SET(CMAKE_C_COMPILER "arm-none-eabi-gcc")
SET(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
SET(ELF2BIN "arm-none-eabi-objcopy")
# if the environment does not specify build type, set to Debug
IF(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug"
CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF()
# here starts the project
PROJECT(my_NBoard C CXX ASM)
# uncomment below to have a verbose build process
#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(LD_SYS_LIBS "-Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -lmbed -Wl,--end-group")
SET(CMAKE_C_FLAGS "-std=gnu99 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -O0 -g -DMBED_RTOS_SINGLE_THREAD -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -include mbed_config.h")
SET(CMAKE_CXX_FLAGS "-std=gnu++14 -fno-rtti -Wvla -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -O0 -g -DMBED_RTOS_SINGLE_THREAD -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -include mbed_config.h")
SET(CMAKE_ASM_FLAGS "-x assembler-with-cpp -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -O0 -g -DMBED_RTOS_SINGLE_THREAD -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -include mbed_config.h")
SET(CMAKE_CXX_LINK_FLAGS "-Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,__malloc_r -Wl,--wrap,__free_r -Wl,--wrap,__realloc_r -Wl,--wrap,__memalign_r -Wl,--wrap,__calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n --specs=nano.specs -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -L${CMAKE_CURRENT_SOURCE_DIR}/mbed/TARGET_NUCLEO_F303K8/TOOLCHAIN_GCC_ARM ")
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${LD_SYS_LIBS} -T ${CMAKE_BINARY_DIR}/my_NBoard_pp.link_script.ld")
ADD_DEFINITIONS(
-DARM_MATH_CM4
-DDEVICE_ANALOGIN=1
-DDEVICE_ANALOGOUT=1
-DDEVICE_CAN=1
-DDEVICE_I2C=1
-DDEVICE_I2CSLAVE=1
-DDEVICE_I2C_ASYNCH=1
-DDEVICE_INTERRUPTIN=1
-DDEVICE_LOWPOWERTIMER=1
-DDEVICE_PORTIN=1
-DDEVICE_PORTINOUT=1
-DDEVICE_PORTOUT=1
-DDEVICE_PWMOUT=1
-DDEVICE_RTC=1
-DDEVICE_SERIAL=1
-DDEVICE_SERIAL_FC=1
-DDEVICE_SLEEP=1
-DDEVICE_SPI=1
-DDEVICE_SPISLAVE=1
-DDEVICE_SPI_ASYNCH=1
-DDEVICE_STDIO_MESSAGES=1
-DMBED_BUILD_TIMESTAMP=1544917849.56
-DTARGET_CORTEX
-DTARGET_CORTEX_M
-DTARGET_FAMILY_STM32
-DTARGET_FF_ARDUINO
-DTARGET_LIKE_CORTEX_M4
-DTARGET_LIKE_MBED
-DTARGET_M4
-DTARGET_NUCLEO_F303K8
-DTARGET_RELEASE
-DTARGET_RTOS_M4_M7
-DTARGET_STM
-DTARGET_STM32F3
-DTARGET_STM32F303K8
-DTARGET_STM32F303x8
-DTOOLCHAIN_GCC
-DTOOLCHAIN_GCC_ARM
-DTRANSACTION_QUEUE_SIZE_SPI=2
-D__CMSIS_RTOS
-D__CORTEX_M4
-D__FPU_PRESENT=1
-D__MBED_CMSIS_RTOS_CM
-D__MBED__=1
)
INCLUDE_DIRECTORIES(
mbed/platform
mbed/hal
mbed/drivers
mbed/TARGET_NUCLEO_F303K8/TOOLCHAIN_GCC_ARM
mbed
IHM
include
.
)
SET(MBED_OBJ_DIR mbed/TARGET_NUCLEO_F303K8/TOOLCHAIN_GCC_ARM)
FILE(GLOB_RECURSE sources ${CMAKE_SOURCE_DIR}/src/*.cpp)
# executable my_NBoard
ADD_EXECUTABLE(my_NBoard
${sources}
IHM/IHM.cpp
${MBED_OBJ_DIR}/PeripheralPins.o
${MBED_OBJ_DIR}/analogin_api.o
${MBED_OBJ_DIR}/analogin_device.o
${MBED_OBJ_DIR}/analogout_api.o
${MBED_OBJ_DIR}/analogout_device.o
${MBED_OBJ_DIR}/can_api.o
${MBED_OBJ_DIR}/flash_api.o
${MBED_OBJ_DIR}/gpio_api.o
${MBED_OBJ_DIR}/gpio_irq_api.o
${MBED_OBJ_DIR}/gpio_irq_device.o
${MBED_OBJ_DIR}/hal_tick_overrides.o
${MBED_OBJ_DIR}/i2c_api.o
${MBED_OBJ_DIR}/lp_ticker.o
${MBED_OBJ_DIR}/mbed_board.o
${MBED_OBJ_DIR}/mbed_crc_api.o
${MBED_OBJ_DIR}/mbed_overrides.o
${MBED_OBJ_DIR}/mbed_retarget.o
${MBED_OBJ_DIR}/mbed_sdk_boot.o
${MBED_OBJ_DIR}/mbed_tz_context.o
${MBED_OBJ_DIR}/pinmap.o
${MBED_OBJ_DIR}/port_api.o
${MBED_OBJ_DIR}/pwmout_api.o
${MBED_OBJ_DIR}/pwmout_device.o
${MBED_OBJ_DIR}/qspi_api.o
${MBED_OBJ_DIR}/rtc_api.o
${MBED_OBJ_DIR}/serial_api.o
${MBED_OBJ_DIR}/serial_device.o
${MBED_OBJ_DIR}/sleep.o
${MBED_OBJ_DIR}/spi_api.o
${MBED_OBJ_DIR}/startup_stm32f303x8.o
${MBED_OBJ_DIR}/stm32f3xx_hal.o
${MBED_OBJ_DIR}/stm32f3xx_hal_adc.o
${MBED_OBJ_DIR}/stm32f3xx_hal_adc_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_can.o
${MBED_OBJ_DIR}/stm32f3xx_hal_cec.o
${MBED_OBJ_DIR}/stm32f3xx_hal_comp.o
${MBED_OBJ_DIR}/stm32f3xx_hal_cortex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_crc.o
${MBED_OBJ_DIR}/stm32f3xx_hal_crc_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_dac.o
${MBED_OBJ_DIR}/stm32f3xx_hal_dac_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_dma.o
${MBED_OBJ_DIR}/stm32f3xx_hal_flash.o
${MBED_OBJ_DIR}/stm32f3xx_hal_flash_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_gpio.o
${MBED_OBJ_DIR}/stm32f3xx_hal_hrtim.o
${MBED_OBJ_DIR}/stm32f3xx_hal_i2c.o
${MBED_OBJ_DIR}/stm32f3xx_hal_i2c_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_i2s.o
${MBED_OBJ_DIR}/stm32f3xx_hal_i2s_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_irda.o
${MBED_OBJ_DIR}/stm32f3xx_hal_iwdg.o
${MBED_OBJ_DIR}/stm32f3xx_hal_nand.o
${MBED_OBJ_DIR}/stm32f3xx_hal_nor.o
${MBED_OBJ_DIR}/stm32f3xx_hal_opamp.o
${MBED_OBJ_DIR}/stm32f3xx_hal_opamp_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_pccard.o
${MBED_OBJ_DIR}/stm32f3xx_hal_pcd.o
${MBED_OBJ_DIR}/stm32f3xx_hal_pcd_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_pwr.o
${MBED_OBJ_DIR}/stm32f3xx_hal_pwr_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_rcc.o
${MBED_OBJ_DIR}/stm32f3xx_hal_rcc_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_rtc.o
${MBED_OBJ_DIR}/stm32f3xx_hal_rtc_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_sdadc.o
${MBED_OBJ_DIR}/stm32f3xx_hal_smartcard.o
${MBED_OBJ_DIR}/stm32f3xx_hal_smartcard_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_smbus.o
${MBED_OBJ_DIR}/stm32f3xx_hal_spi.o
${MBED_OBJ_DIR}/stm32f3xx_hal_spi_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_sram.o
${MBED_OBJ_DIR}/stm32f3xx_hal_tim.o
${MBED_OBJ_DIR}/stm32f3xx_hal_tim_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_tsc.o
${MBED_OBJ_DIR}/stm32f3xx_hal_uart.o
${MBED_OBJ_DIR}/stm32f3xx_hal_uart_ex.o
${MBED_OBJ_DIR}/stm32f3xx_hal_usart.o
${MBED_OBJ_DIR}/stm32f3xx_hal_wwdg.o
${MBED_OBJ_DIR}/stm32f3xx_ll_adc.o
${MBED_OBJ_DIR}/stm32f3xx_ll_comp.o
${MBED_OBJ_DIR}/stm32f3xx_ll_crc.o
${MBED_OBJ_DIR}/stm32f3xx_ll_dac.o
${MBED_OBJ_DIR}/stm32f3xx_ll_dma.o
${MBED_OBJ_DIR}/stm32f3xx_ll_exti.o
${MBED_OBJ_DIR}/stm32f3xx_ll_fmc.o
${MBED_OBJ_DIR}/stm32f3xx_ll_gpio.o
${MBED_OBJ_DIR}/stm32f3xx_ll_hrtim.o
${MBED_OBJ_DIR}/stm32f3xx_ll_i2c.o
${MBED_OBJ_DIR}/stm32f3xx_ll_opamp.o
${MBED_OBJ_DIR}/stm32f3xx_ll_pwr.o
${MBED_OBJ_DIR}/stm32f3xx_ll_rcc.o
${MBED_OBJ_DIR}/stm32f3xx_ll_rtc.o
${MBED_OBJ_DIR}/stm32f3xx_ll_spi.o
${MBED_OBJ_DIR}/stm32f3xx_ll_tim.o
${MBED_OBJ_DIR}/stm32f3xx_ll_usart.o
${MBED_OBJ_DIR}/stm32f3xx_ll_utils.o
${MBED_OBJ_DIR}/stm_spi_api.o
${MBED_OBJ_DIR}/system_clock.o
${MBED_OBJ_DIR}/system_stm32f3xx.o
${MBED_OBJ_DIR}/trng_api.o
${MBED_OBJ_DIR}/us_ticker.o
)
SET_TARGET_PROPERTIES(my_NBoard PROPERTIES ENABLE_EXPORTS 1)
LINK_DIRECTORIES(mbed/TARGET_NUCLEO_F303K8/TOOLCHAIN_GCC_ARM)
TARGET_LINK_LIBRARIES(my_NBoard mbed)
# add syslibs dependencies to create the correct linker order
TARGET_LINK_LIBRARIES(my_NBoard -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys)
add_custom_command(TARGET my_NBoard PRE_LINK
COMMAND "arm-none-eabi-cpp" -E -P -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n --specs=nano.specs -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp mbed/TARGET_NUCLEO_F303K8/TOOLCHAIN_GCC_ARM/STM32F303X8.ld -o ${CMAKE_CURRENT_BINARY_DIR}/my_NBoard_pp.link_script.ld
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/my_NBoard_pp.link_script.ld"
)