-
Notifications
You must be signed in to change notification settings - Fork 322
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
107 lines (86 loc) · 2.9 KB
/
CMakeLists.txt
File metadata and controls
107 lines (86 loc) · 2.9 KB
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
cmake_minimum_required(VERSION 3.12)
include(pico_sdk_import.cmake)
set(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/freertos)
include(FreeRTOS_Kernel_import.cmake)
project(debugprobe)
pico_sdk_init()
if (${PICO_SDK_VERSION_MAJOR} LESS 2)
message(SEND_ERROR "Version 2 of the Pico SDK is required to compile this project. Please update your installation at ${PICO_SDK_PATH}")
endif ()
add_executable(debugprobe
src/probe_config.c
src/main.c
src/usb_descriptors.c
src/probe.c
src/cdc_uart.c
src/get_serial.c
src/sw_dp_pio.c
src/tusb_edpt_handler.c
src/autobaud.c
)
target_sources(debugprobe PRIVATE
CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP.c
CMSIS_DAP/CMSIS/DAP/Firmware/Source/JTAG_DP.c
CMSIS_DAP/CMSIS/DAP/Firmware/Source/DAP_vendor.c
CMSIS_DAP/CMSIS/DAP/Firmware/Source/SWO.c
#CMSIS_DAP/CMSIS/DAP/Firmware/Source/SW_DP.c
)
target_include_directories(debugprobe PRIVATE
CMSIS_DAP/CMSIS/DAP/Firmware/Include/
CMSIS_DAP/CMSIS/Core/Include/
include/
)
target_compile_options(debugprobe PRIVATE -Wall)
pico_generate_pio_header(debugprobe ${CMAKE_CURRENT_LIST_DIR}/src/probe.pio)
pico_generate_pio_header(debugprobe ${CMAKE_CURRENT_LIST_DIR}/src/probe_oen.pio)
pico_generate_pio_header(debugprobe ${CMAKE_CURRENT_LIST_DIR}/src/autobaud.pio)
target_include_directories(debugprobe PRIVATE src)
# add version
add_custom_target(version
${CMAKE_SOURCE_DIR}/get-version.sh
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
target_include_directories(debugprobe PRIVATE
${CMAKE_BINARY_DIR}/generated
)
add_dependencies(debugprobe version)
target_compile_definitions (debugprobe PRIVATE
PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1
)
set(DEBUG_PROBE_BOARD "debug_probe" CACHE STRING "Debug Probe board to build for")
option (DEBUG_ON_PICO "Compile firmware for the Pico instead of Debug Probe" OFF)
if (DEBUG_ON_PICO)
target_compile_definitions (debugprobe PRIVATE
DEBUG_ON_PICO=1
)
if (PICO_BOARD STREQUAL "pico")
set_target_properties(debugprobe PROPERTIES
OUTPUT_NAME "debugprobe_on_pico"
)
elseif (PICO_BOARD STREQUAL "pico2")
set_target_properties(debugprobe PROPERTIES
OUTPUT_NAME "debugprobe_on_pico2"
)
else ()
message(SEND_ERROR "Unsupported board ${PICO_BOARD}")
endif ()
else ()
target_compile_definitions(debugprobe PRIVATE
BOARD_CONFIG_HEADER=\"board_${DEBUG_PROBE_BOARD}_config.h\"
)
endif ()
target_link_libraries(debugprobe PRIVATE
pico_multicore
pico_stdlib
pico_unique_id
tinyusb_device
tinyusb_board
hardware_pio
hardware_dma
hardware_irq
hardware_clocks
FreeRTOS-Kernel
FreeRTOS-Kernel-Heap1
)
pico_set_binary_type(debugprobe copy_to_ram)
pico_add_extra_outputs(debugprobe)