-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
51 lines (41 loc) · 1.05 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
cmake_minimum_required(VERSION 3.13)
project(HelloWorld)
set(HAL_STM32_MCU stm32f103xb)
add_subdirectory(hal-stm32)
add_executable(HelloWorld
src/main.c
src/retarget.c
)
target_link_libraries(HelloWorld
PRIVATE
HalStm32::HalStm32
)
target_link_options(HelloWorld
PRIVATE
LINKER:-Map=output.map
)
target_link_options(HelloWorld
PRIVATE
--specs=nano.specs
--specs=nosys.specs
)
set_target_properties(HelloWorld
PROPERTIES
SUFFIX ".elf"
)
add_custom_command(TARGET HelloWorld POST_BUILD
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:HelloWorld>
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Print the size of HelloWorld"
USES_TERMINAL
)
add_custom_target(renode
renode
-e "$$bin=@$<TARGET_FILE_NAME:HelloWorld>"
-e "include @scripts/single-node/stm32f103.resc"
-e "machine StartGdbServer 3333"
DEPENDS HelloWorld
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Run the HelloWorld in renode and start a gdb server on ::3333"
USES_TERMINAL
)