-
Notifications
You must be signed in to change notification settings - Fork 41
/
CMakeLists.txt
194 lines (172 loc) · 6.17 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
cmake_minimum_required(VERSION 3.12)
include(pico_sdk_import.cmake)
set(CMAKE_C_STANDARD 11)
add_compile_options(-Wall -Werror -fdata-sections -ffunction-sections)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>)
project(picorx)
pico_sdk_init()
file(GLOB U8G2_SRCS
"external/u8g2/csrc/*.c"
)
include_directories(include external/u8g2/csrc/)
add_library(
u8g2
${U8G2_SRCS}
)
target_compile_options(u8g2 PRIVATE -Wno-unused-function -Wno-unused-variable)
if(PICO_BOARD STREQUAL "pico")
#main application
add_executable(picorx
ssd1306.c
picorx.cpp
nco.cpp
rx.cpp
rx_dsp.cpp
fft.cpp
fft_filter.cpp
cic_corrections.cpp
ui.cpp
utils.cpp
ili934x.cpp
waterfall.cpp
button.cpp
cat.cpp
usb_descriptors.c
usb_audio_device.c
ring_buffer_lib.c
)
pico_generate_pio_header(picorx ${CMAKE_CURRENT_LIST_DIR}/nco.pio)
pico_generate_pio_header(picorx ${CMAKE_CURRENT_LIST_DIR}/quadrature_encoder.pio)
pico_add_extra_outputs(picorx)
# enable usb output, disable uart output
pico_enable_stdio_usb(picorx 1)
pico_enable_stdio_uart(picorx 0)
target_include_directories(picorx PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(picorx PRIVATE pico_stdlib
pico_multicore
hardware_clocks
hardware_flash
hardware_pio
hardware_adc
hardware_pwm
hardware_dma
hardware_i2c
hardware_spi
tinyusb_device
tinyusb_board
u8g2)
target_compile_definitions(picorx PUBLIC PICO_XOSC_STARTUP_DELAY_MULTIPLIER=128)
#battery check utility
project(battery_check)
add_executable(battery_check
battery_check.cpp
)
pico_add_extra_outputs(battery_check)
pico_enable_stdio_usb(battery_check 1)
pico_enable_stdio_uart(battery_check 0)
target_link_libraries(battery_check pico_stdlib hardware_adc)
elseif(PICO_BOARD STREQUAL "pico2")
if(PICO_PLATFORM STREQUAL "rp2350-riscv")
#main application
add_executable(pico2rx-riscv
ssd1306.c
picorx.cpp
nco.cpp
rx.cpp
rx_dsp.cpp
fft.cpp
fft_filter.cpp
cic_corrections.cpp
ui.cpp
utils.cpp
ili934x.cpp
waterfall.cpp
button.cpp
cat.cpp
usb_descriptors.c
usb_audio_device.c
ring_buffer_lib.c
)
pico_generate_pio_header(pico2rx-riscv ${CMAKE_CURRENT_LIST_DIR}/nco.pio)
pico_generate_pio_header(pico2rx-riscv ${CMAKE_CURRENT_LIST_DIR}/quadrature_encoder.pio)
pico_add_extra_outputs(pico2rx-riscv)
# enable usb output, disable uart output
pico_enable_stdio_usb(pico2rx-riscv 1)
pico_enable_stdio_uart(pico2rx-riscv 0)
target_include_directories(pico2rx-riscv PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(pico2rx-riscv PRIVATE pico_stdlib
pico_multicore
hardware_clocks
hardware_flash
hardware_pio
hardware_adc
hardware_pwm
hardware_dma
hardware_i2c
hardware_spi
tinyusb_device
tinyusb_board
u8g2)
target_compile_definitions(pico2rx-riscv PUBLIC PICO_XOSC_STARTUP_DELAY_MULTIPLIER=128)
#battery check utility
project(battery_check_pico2-riscv)
add_executable(battery_check_pico2-riscv
battery_check.cpp
)
pico_add_extra_outputs(battery_check_pico2-riscv)
pico_enable_stdio_usb(battery_check_pico2-riscv 1)
pico_enable_stdio_uart(battery_check_pico2-riscv 0)
target_link_libraries(battery_check_pico2-riscv pico_stdlib hardware_adc)
else()
#main application
add_executable(pico2rx
ssd1306.c
picorx.cpp
nco.cpp
rx.cpp
rx_dsp.cpp
fft.cpp
fft_filter.cpp
cic_corrections.cpp
ui.cpp
utils.cpp
ili934x.cpp
waterfall.cpp
button.cpp
cat.cpp
usb_descriptors.c
usb_audio_device.c
ring_buffer_lib.c
)
pico_generate_pio_header(pico2rx ${CMAKE_CURRENT_LIST_DIR}/nco.pio)
pico_generate_pio_header(pico2rx ${CMAKE_CURRENT_LIST_DIR}/quadrature_encoder.pio)
pico_add_extra_outputs(pico2rx)
pico_enable_stdio_usb(pico2rx 1)
pico_enable_stdio_uart(pico2rx 0)
target_include_directories(pico2rx PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(pico2rx PRIVATE pico_stdlib
pico_multicore
hardware_clocks
hardware_flash
hardware_pio
hardware_adc
hardware_pwm
hardware_dma
hardware_i2c
hardware_spi
tinyusb_device
tinyusb_board
u8g2)
target_compile_definitions(pico2rx PUBLIC PICO_XOSC_STARTUP_DELAY_MULTIPLIER=128)
#battery check utility
project(battery_check_pico2)
add_executable(battery_check_pico2
battery_check.cpp
)
pico_add_extra_outputs(battery_check_pico2)
pico_enable_stdio_usb(battery_check_pico2 1)
pico_enable_stdio_uart(battery_check_pico2 0)
target_link_libraries(battery_check_pico2 pico_stdlib hardware_adc)
endif()
endif()