forked from DangerousPrototypes/BusPirate5-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
265 lines (221 loc) · 10.4 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
# Generated Cmake Pico project file
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# initalize pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
#set(PICO_SDK_PATH "C:/pico113/pico-sdk")
# Pull in Raspberry Pi Pico SDK (must be before project)
include(cmake/pico_sdk_import.cmake)
set(PICO_BOARD pico)
project(bus_pirate C CXX ASM)
# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()
#add_compile_definitions(BP_FIRMWARE_HASH=${BP_FIRMWARE_HASH})
#add_compile_definitions(BP5_REV=8)
# build time in UTC ISO 8601
FILE (WRITE ${CMAKE_BINARY_DIR}/timestamp.cmake "STRING(TIMESTAMP TIMEZ UTC)\n")
FILE (APPEND ${CMAKE_BINARY_DIR}/timestamp.cmake "FILE(WRITE timestamp.h \"#ifndef TIMESTAMP_H\\n\")\n")
FILE (APPEND ${CMAKE_BINARY_DIR}/timestamp.cmake "FILE(APPEND timestamp.h \"#define TIMESTAMP_H\\n\\n\")\n")
FILE (APPEND ${CMAKE_BINARY_DIR}/timestamp.cmake "FILE(APPEND timestamp.h \"#define _TIMEZ_ \\\"\${TIMEZ}\\\"\\n\\n\")\n")
FILE (APPEND ${CMAKE_BINARY_DIR}/timestamp.cmake "FILE(APPEND timestamp.h \"#endif // TIMESTAMP_H\\n\")\n")
ADD_CUSTOM_TARGET (
timestamp
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/timestamp.cmake
ADD_DEPENDENCIES ${CMAKE_BINARY_DIR}/timestamp.cmake)
# Add executable. Default name is the project name, version 0.1
set(bp5_common
# main loop and printf
pirate.c pirate.h printf-4.0.0/printf.c printf-4.0.0/printf.h
modes.c modes.h system_config.h system_config.c
system_monitor.h system_monitor.c
# pirate lib
pirate/psu.h pirate/psu.c pirate/pullup.h pirate/pullup.c
pirate/mcu.h pirate/mcu.c pirate/lsb.c pirate/lsb.h
pirate/bio.h pirate/bio.c pirate/storage.h pirate/storage.c
pirate/button.h pirate/button.c pirate/mem.c pirate/mem.h
pirate/lcd.h pirate/lcd.c pirate/shift.h pirate/shift.c
pirate/amux.h pirate/amux.c pirate/rgb.h pirate/rgb.c
# commands
commands.h commands.c
commands/global/w_psu.h commands/global/w_psu.c
commands/global/p_pullups.h commands/global/p_pullups.c
commands/global/cmd_mcu.h commands/global/cmd_mcu.c
commands/global/l_bitorder.h commands/global/l_bitorder.c
commands/global/cmd_convert.h commands/global/cmd_convert.c
commands/global/pause.h commands/global/pause.c
commands/global/h_help.h commands/global/h_help.c
commands/global/cmd_selftest.h commands/global/cmd_selftest.c
commands/global/a_auxio.h commands/global/a_auxio.c
commands/global/dummy.c commands/global/dummy.h
commands/global/disk.c commands/global/disk.h
commands/global/v_adc.c commands/global/v_adc.h
commands/global/i_info.c commands/global/i_info.h
commands/global/pwm.c commands/global/pwm.h
commands/global/freq.c commands/global/freq.h
commands/global/macro.c commands/global/macro.h
commands/global/script.c commands/global/script.h
commands/global/tutorial.c commands/global/tutorial.h
commands/global/button_scr.c commands/global/button_scr.h
# HiZ
mode/hiz.h mode/hiz.c
# 1Wire
mode/hw1wire.h mode/hw1wire.c
pirate/hw1wire_pio.h pirate/hw1wire_pio.c
commands/1wire/scan.h commands/1wire/scan.c
commands/1wire/demos.h commands/1wire/demos.c
# UART
mode/hwuart.h mode/hwuart.c
pirate/hwuart_pio.h pirate/hwuart_pio.c
commands/uart/nmea.c commands/uart/nmea.h
commands/uart/bridge.h commands/uart/bridge.c
commands/uart/simcard.h commands/uart/simcard.c
lib/minmea/minmea.h lib/minmea/minmea.c lib/minmea/gps.h lib/minmea/gps.c
# Half duplex UART
mode/hwhduart.h mode/hwhduart.c
commands/hdplxuart/bridge.c commands/hdplxuart/bridge.h
# I2C
mode/hwi2c.c mode/hwi2c.h
pirate/hwi2c_pio.c pirate/hwi2c_pio.h
commands/i2c/scan.h commands/i2c/scan.c
commands/i2c/demos.h commands/i2c/demos.c
lib/i2c_address_list/dev_i2c_addresses.h
lib/ms5611/ms5611.c lib/ms5611/ms5611.h lib/tsl2561/driver_tsl2561.c lib/tsl2561/driver_tsl2561.h
# SPI
mode/hwspi.c mode/hwspi.h
pirate/hwspi.c pirate/hwspi.h
commands/spi/flash.c commands/spi/flash.h commands/spi/spiflash.h commands/spi/spiflash.c
commands/spi/sniff.c commands/spi/sniff.h
lib/sfud/inc/sfud.h lib/sfud/inc/sfud.c lib/sfud/inc/sfud_cfg.h lib/sfud/inc/sfud_def.h
lib/sfud/inc/sfud_flash_def.h lib/sfud/inc/sfud_port.c lib/sfud/inc/sfud_sfdp.c
# 2WIRE
mode/hw2wire.h mode/hw2wire.c
pirate/hw2wire_pio.h pirate/hw2wire_pio.c
commands/2wire/sle4442.c commands/2wire/sle4442.h
# LED
mode/hwled.c mode/hwled.h
# DIO
mode/dio.h mode/dio.c
# DUMMY MODE
mode/dummy1.c mode/dummy1.h
# UI
ui/ui_button.c ui/ui_button.h
ui/ui_cmdln.c ui/ui_cmdln.h
ui/ui_process.h ui/ui_process.c
ui/ui_flags.h
ui/ui_parse.c ui/ui_parse.h
ui/ui_prompt.h ui/ui_prompt.c
ui/ui_mode.c ui/ui_mode.h
ui/ui_display.c ui/ui_display.h
ui/ui_info.h ui/ui_info.c
ui/ui_format.c ui/ui_format.c
ui/ui_init.c ui/ui_init.h
ui/ui_const.h ui/ui_const.c
ui/ui_config.h ui/ui_config.c
ui/ui_help.c ui/ui_help.h
ui/ui_term.c ui/ui_term.h
ui/ui_statusbar.c ui/ui_statusbar.h
debug.c debug.h
# JSON parser for saved settings
mjson/mjson.h mjson/mjson.c
# syntax and commands
syntax.h syntax.c syntax_struct.h
opt_args.h command_attributes.h bytecode.h
# FATfs
fatfs/diskio.c fatfs/diskio.h fatfs/ff.c fatfs/ff.h fatfs/ffconf.h fatfs/ffsystem.c fatfs/ffunicode.c
# translations
translation/base.h translation/base.c
translation/en-us.h translation/zh-cn.h translation/pl-pl.h
# binary mode
mode/binio.c mode/binio.h mode/binio_helpers.c mode/binio_helpers.h
mode/logicanalyzer.h mode/logicanalyzer.c mode/sump.c mode/sump.h
# displays
displays.c displays.h display/default.c display/default.h
ui/ui_lcd.c ui/ui_lcd.h display/scope.h display/scope.c
font/font.h font/hunter-14pt-19h15w.h font/hunter-12pt-16h13w.h font/hunter-20pt-21h21w.h
font/hunter-23pt-24h24w.h font/background.h font/background_image_v4.h
# USB
queue.c queue.h
usb_tx.c usb_tx.h usb_rx.c usb_rx.h
msc_disk.c msc_disk.h usb_descriptors.c
)
add_executable(bus_pirate5_rev8
${bp5_common}
platform/bpi-rev8.h platform/bpi-rev8.c
#tf card access control
fatfs/tf_card.c fatfs/tf_card.h
)
target_compile_definitions(bus_pirate5_rev8 PUBLIC BP5_REV=8)
add_executable(bus_pirate5_rev10
${bp5_common}
platform/bpi-rev10.h platform/bpi-rev10.c
#nand flash management and dhara
dhara/bytes.h dhara/error.c dhara/error.h dhara/journal.c dhara/journal.h dhara/map.c dhara/map.h dhara/nand.c dhara/nand.h
nand/nand_ftl_diskio.c nand/nand_ftl_diskio.h nand/spi.c nand/spi.h nand/spi_nand.c nand/spi_nand.h
nand/sys_time.c nand/sys_time.h
)
target_compile_definitions(bus_pirate5_rev10 PUBLIC BP5_REV=10)
set(stdlibs
pico_stdlib
hardware_spi
hardware_i2c
hardware_dma
hardware_pio
hardware_interp
hardware_timer
hardware_watchdog
hardware_clocks
hardware_flash
hardware_adc
hardware_uart
pico_multicore
pico_base_headers
pico_unique_id
pico_bootrom
hardware_pwm
tinyusb_device
tinyusb_board
hardware_structs
)
set(revisions
bus_pirate5_rev8
bus_pirate5_rev10
)
foreach(revision ${revisions})
ADD_DEPENDENCIES (${revision} timestamp)
pico_generate_pio_header(${revision} ${CMAKE_CURRENT_LIST_DIR}/pirate/hw2wire.pio)
pico_generate_pio_header(${revision} ${CMAKE_CURRENT_LIST_DIR}/pirate/hwi2c.pio)
pico_generate_pio_header(${revision} ${CMAKE_CURRENT_LIST_DIR}/pirate/ws2812.pio)
pico_generate_pio_header(${revision} ${CMAKE_CURRENT_LIST_DIR}/pirate/apa102.pio)
pico_generate_pio_header(${revision} ${CMAKE_CURRENT_LIST_DIR}/pirate/hw1wire.pio)
pico_generate_pio_header(${revision} ${CMAKE_CURRENT_LIST_DIR}/pirate/hwuart.pio)
pico_generate_pio_header(${revision} ${CMAKE_CURRENT_LIST_DIR}/pirate/spisnif.pio)
pico_generate_pio_header(${revision} ${CMAKE_CURRENT_LIST_DIR}/mode/logicanalyzer.pio)
pico_set_program_name(${revision} ${revision})
pico_set_program_version(${revision} "0.1.0")
pico_set_program_description(${revision} "Bus Pirate 5 Firmware for RP2040")
pico_enable_stdio_uart(${revision} 0)
pico_enable_stdio_usb(${revision} 0)
#XOSC fix?
target_compile_definitions(${revision} PUBLIC PICO_XOSC_STARTUP_DELAY_MULTIPLIER=64)
# useful for debug builds
target_compile_definitions(${revision} PUBLIC PICO_USE_STACK_GUARDS=$<CONFIG:DEBUG>)
target_compile_definitions(${revision} PUBLIC PICO_STACK_SIZE=4096)
# Add the standard library to the build
target_link_libraries(${revision} ${stdlibs} )
target_include_directories(${revision} PUBLIC ${CMAKE_CURRENT_LIST_DIR} . )
pico_add_extra_outputs(${revision})
pico_set_linker_script(${revision} ${CMAKE_CURRENT_LIST_DIR}/pirate/memmap_buspirate5.ld)
endforeach()
string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--print-memory-usage")
# by default this project uses LGPL3 libraries, if you do not want to comply
# with LGPL3 license, please set the following variable to FALSE, otherwise
# you are oblicated to distribute the resulted binaries under LGPL3 license
set(USE_LGPL3 TRUE CACHE BOOL "indicated if to include LGPL3 protected code")
include(cmake/ansi_colours_import.cmake)
if(USE_LGPL3)
if(LEGACY_ANSI_COLOURS_ENABLED)
target_link_libraries(bus_pirate5_rev10 lib_ansi_colours)
target_link_libraries(bus_pirate5_rev8 lib_ansi_colours)
endif()
endif()