-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
301 lines (240 loc) · 8.28 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
cmake_minimum_required(VERSION 3.13)
# initialize the SDK based on PICO_SDK_PATH
# note: this must happen before project()
include(pico_sdk_import.cmake)
project(rp2040_pico_sdk_playground C CXX ASM)
# initialize the Raspberry Pi Pico SDK
pico_sdk_init()
include_directories(../include)
file(GLOB U8G2_SRCS
"external/u8g2/csrc/*.c"
)
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>)
include_directories(include external/u8g2/csrc/)
add_library(
u8g2
${U8G2_SRCS}
)
add_executable(rpi_lcd_test
src/rpi_lcd_test.c
src/u8g2_ili9486_driver.c
)
pico_generate_pio_header(rpi_lcd_test ${CMAKE_CURRENT_LIST_DIR}/src/ili9486_lcd_8bit_data.pio)
target_link_libraries(rpi_lcd_test
pico_stdlib
hardware_irq
hardware_pwm
hardware_pio
hardware_dma
u8g2)
pico_add_extra_outputs(rpi_lcd_test)
add_executable(rpi_ws2812_lamp
src/rpi_ws2812_lamp.c
src/plasma.c
)
pico_generate_pio_header(rpi_ws2812_lamp ${CMAKE_CURRENT_LIST_DIR}/src/ws2812.pio)
pico_generate_pio_header(rpi_ws2812_lamp ${CMAKE_CURRENT_LIST_DIR}/src/inmp441.pio)
target_link_libraries(rpi_ws2812_lamp
pico_stdlib
pico_rand
hardware_pio
hardware_dma
CMSISDSP
)
pico_add_extra_outputs(rpi_ws2812_lamp)
set(CMSISDSP "${CMAKE_CURRENT_LIST_DIR}/external/CMSIS-DSP" CACHE STRING "CMSIS-DSP Library")
add_subdirectory(${CMSISDSP}/Source bin_dsp)
target_compile_options(CMSISDSP PRIVATE -Ofast)
target_link_libraries(CMSISDSP PUBLIC pico_stdlib cmsis_core)
add_executable(rpi_inmp441_fft_demo
src/rpi_inmp441_fft_demo.c
)
pico_generate_pio_header(rpi_inmp441_fft_demo ${CMAKE_CURRENT_LIST_DIR}/src/inmp441.pio)
target_link_libraries(rpi_inmp441_fft_demo
pico_stdlib
pico_rand
hardware_pio
hardware_dma
CMSISDSP
)
pico_add_extra_outputs(rpi_inmp441_fft_demo)
set(CMSISNN "${CMAKE_CURRENT_LIST_DIR}/external/CMSIS-NN" CACHE STRING "CMSIS-NN Library")
add_subdirectory(${CMSISNN} bin_nn)
target_compile_options(cmsis-nn PRIVATE -Ofast)
target_link_libraries(cmsis-nn PUBLIC pico_stdlib cmsis_core)
add_library(tflitemicro STATIC IMPORTED)
set_property(TARGET tflitemicro PROPERTY
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/external/tflite-micro/\
gen/cortex_m_qemu_cortex-m0_default/lib/\
libtensorflow-microlite.a")
target_link_libraries(tflitemicro INTERFACE cmsis-nn)
set(TFLITE_MODELS_PATH "${CMAKE_CURRENT_LIST_DIR}/external/tflite-micro\
/gen/cortex_m_qemu_cortex-m0_default/genfiles\
/tensorflow/lite/micro/examples/micro_speech/models")
add_executable(rpi_tflm_micro_speech_demo
src/rpi_tflm_micro_speech_demo.cc
${TFLITE_MODELS_PATH}/audio_preprocessor_int8_model_data.cc
${TFLITE_MODELS_PATH}/micro_speech_quantized_model_data.cc
)
target_include_directories(rpi_tflm_micro_speech_demo
PRIVATE external/tflite-micro
PRIVATE external/tflite-micro/gen/cortex_m_qemu_cortex-m0_default/genfiles
PRIVATE external/tflite-micro/tensorflow/lite/micro/examples/micro_speech
PRIVATE external/tflite-micro/tensorflow/lite/micro/tools/make/downloads/flatbuffers/include
PRIVATE external/tflite-micro/tensorflow/lite/micro/tools/make/downloads/gemmlowp
PRIVATE ${TFLITE_MODELS_PATH}
)
pico_generate_pio_header(rpi_tflm_micro_speech_demo ${CMAKE_CURRENT_LIST_DIR}/src/inmp441.pio)
target_link_libraries(rpi_tflm_micro_speech_demo
pico_stdlib
pico_rand
hardware_pio
hardware_dma
CMSISDSP
cmsis-nn
tflitemicro
)
target_compile_features(rpi_tflm_micro_speech_demo PRIVATE cxx_std_17)
target_compile_definitions(rpi_tflm_micro_speech_demo PRIVATE TF_LITE_STATIC_MEMORY)
pico_add_extra_outputs(rpi_tflm_micro_speech_demo)
add_executable(rpi_inmp441_whistle_demo
src/rpi_inmp441_whistle_demo.c
src/whistle_detector.c
)
pico_generate_pio_header(rpi_inmp441_whistle_demo ${CMAKE_CURRENT_LIST_DIR}/src/inmp441.pio)
target_link_libraries(rpi_inmp441_whistle_demo
pico_stdlib
pico_rand
hardware_pio
hardware_dma
)
pico_add_extra_outputs(rpi_inmp441_whistle_demo)
add_executable(rpi_inmp441_kws
src/rpi_inmp441_kws.c
src/fbank.c
src/fast_grnn.c
)
pico_generate_pio_header(rpi_inmp441_kws ${CMAKE_CURRENT_LIST_DIR}/src/inmp441.pio)
target_link_libraries(rpi_inmp441_kws
pico_stdlib
pico_rand
pico_multicore
hardware_pio
hardware_dma
CMSISDSP
)
target_compile_definitions(rpi_inmp441_kws PRIVATE PICO_CORE1_STACK_SIZE=0x1000)
pico_add_extra_outputs(rpi_inmp441_kws)
add_executable(rpi_inmp441_kws_lcd
src/rpi_inmp441_kws_lcd.c
src/fbank.c
src/fast_grnn.c
src/u8g2_ili9486_driver.c
)
pico_generate_pio_header(rpi_inmp441_kws_lcd ${CMAKE_CURRENT_LIST_DIR}/src/inmp441.pio)
pico_generate_pio_header(rpi_inmp441_kws_lcd ${CMAKE_CURRENT_LIST_DIR}/src/ili9486_lcd_8bit_data.pio)
target_link_libraries(rpi_inmp441_kws_lcd
pico_stdlib
pico_rand
pico_multicore
hardware_pio
hardware_dma
hardware_pwm
CMSISDSP
u8g2
)
target_compile_definitions(rpi_inmp441_kws_lcd PRIVATE PICO_CORE1_STACK_SIZE=0x1000)
pico_add_extra_outputs(rpi_inmp441_kws_lcd)
set(TINYGL_SOURCES
external/tinygl_1b/src/api.c
external/tinygl_1b/src/clear.c
external/tinygl_1b/src/init.c
external/tinygl_1b/src/list.c
external/tinygl_1b/src/memory.c
external/tinygl_1b/src/msghandling.c
external/tinygl_1b/src/specbuf.c
external/tinygl_1b/src/vertex.c
external/tinygl_1b/src/zmath.c
external/tinygl_1b/src/arrays.c
external/tinygl_1b/src/clip.c
external/tinygl_1b/src/get.c
external/tinygl_1b/src/image_util.c
external/tinygl_1b/src/light.c
external/tinygl_1b/src/matrix.c
external/tinygl_1b/src/misc.c
external/tinygl_1b/src/select.c
external/tinygl_1b/src/texture.c
external/tinygl_1b/src/zbuffer.c
external/tinygl_1b/src/zline.c
external/tinygl_1b/src/ztriangle.c
external/tinygl_1b/src/zraster.c
external/tinygl_1b/src/ztext.c
)
add_library(
tinygl_1b
${TINYGL_SOURCES}
)
target_include_directories(tinygl_1b
PRIVATE external/tinygl_1b/src
PUBLIC external/tinygl_1b/include
)
target_compile_options(tinygl_1b PUBLIC -Wno-unused-function
-Wno-unused-variable
-Wno-parentheses
-Wno-unused-but-set-variable)
add_executable(rpi_lcd_3d_test
src/rpi_lcd_3d_test.c
src/u8g2_ili9486_driver.c
src/gears.c
)
pico_generate_pio_header(rpi_lcd_3d_test ${CMAKE_CURRENT_LIST_DIR}/src/ili9486_lcd_8bit_data.pio)
target_link_libraries(rpi_lcd_3d_test PRIVATE
pico_stdlib
hardware_irq
hardware_pwm
hardware_pio
hardware_dma
u8g2
tinygl_1b)
pico_add_extra_outputs(rpi_lcd_3d_test)
add_executable(rpi_lcd_3d_skull_test
src/rpi_lcd_3d_skull_test.c
src/u8g2_ili9486_driver.c
)
pico_generate_pio_header(rpi_lcd_3d_skull_test ${CMAKE_CURRENT_LIST_DIR}/src/ili9486_lcd_8bit_data.pio)
target_link_libraries(rpi_lcd_3d_skull_test PRIVATE
pico_stdlib
hardware_irq
hardware_pwm
hardware_pio
hardware_dma
u8g2
tinygl_1b)
pico_add_extra_outputs(rpi_lcd_3d_skull_test)
add_executable(rpi_oled_test
src/rpi_oled_test.c
)
target_link_libraries(rpi_oled_test
pico_stdlib
hardware_irq
hardware_pwm
hardware_pio
hardware_dma
hardware_i2c
u8g2)
pico_add_extra_outputs(rpi_oled_test)
# pico_enable_stdio_usb(rpi_oled_test 1)
# pico_enable_stdio_uart(rpi_oled_test 0)
add_executable(pitchshifter
src/pitchshifter.c
)
target_link_libraries(pitchshifter
pico_stdlib
hardware_irq
hardware_pwm
hardware_pio
hardware_dma)
pico_generate_pio_header(pitchshifter ${CMAKE_CURRENT_LIST_DIR}/src/inmp441.pio)
pico_add_extra_outputs(pitchshifter)