forked from fhoedemakers/pico-infonesPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
216 lines (197 loc) · 8.8 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
# pico-infonesPlus
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# Add new build type RELEASENODEBUG
# usage
# cmake -DCMAKE_BUILD_TYPE=RELEASENODEBUG ..
message("* Adding build types...")
SET(GCC_RELEASENODEBUG_FLAGS "-O2 -DNDEBUG")
SET(CMAKE_ASM_FLAGS_RELEASENODEBUG
"${GCC_RELEASENODEBUG_FLAGS}"
CACHE STRING "Flags used by the ASM compiler during REL_O2 builds."
FORCE )
SET(CMAKE_CXX_FLAGS_RELEASENODEBUG
"${GCC_RELEASENODEBUG_FLAGS}"
CACHE STRING "Flags used by the C++ compiler during REL_O2 builds."
FORCE )
SET(CMAKE_C_FLAGS_RELEASENODEBUG
"${GCC_RELEASENODEBUG_FLAGS}"
CACHE STRING "Flags used by the C compiler during REL_O2 builds."
FORCE )
SET(CMAKE_EXE_LINKER_FLAGS_RELEASENODEBUG
""
CACHE STRING "Flags used for linking binaries during REL_O2 builds."
FORCE )
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASENODEBUG
""
CACHE STRING "Flags used by the shared libraries linker during REL_O2 builds."
FORCE )
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_RELEASENODEBUG
CMAKE_ASM_FLAGS_RELEASENODEBUG
CMAKE_C_FLAGS_RELEASENODEBUG
CMAKE_EXE_LINKER_FLAGS_RELEASENODEBUG
CMAKE_SHARED_LINKER_FLAGS_RELEASENODEBUG )
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Debug
CACHE STRING "Choose the type of build : None Debug Release RelWithDebInfo MinSizeRel REL_O2."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
message("* Current build type is : ${CMAKE_BUILD_TYPE}")
add_definitions( -DNDEBUG )
include(pico_sdk_import.cmake)
project(piconesPlus C CXX ASM)
pico_sdk_init()
# IF(EXISTS "${PICO_SDK_PATH}/lib/mbedtls")
# message(FATAL_ERROR "\nPico SDK 1.5.0 or higher cannot be used to build this project.\n"
# "Remove build subdirectory and use SDK 1.4.0 to build this project.\n"
# "See https://github.com/fhoedemakers/pico-infonesPlus/issues/7")
# ENDIF()
add_subdirectory(drivers/fatfs)
add_subdirectory(drivers/sdcard)
if (NOT INFONES_PLUS_HW_CONFIG)
set(INFONES_PLUS_HW_CONFIG 1 CACHE STRING "Select the hardware configuration for your board")
endif()
if ( INFONES_PLUS_HW_CONFIG EQUAL 1 )
# This default Config is for Pimoroni Pico DV Demo Base
set(DVICONFIG "dviConfig_PimoroniDemoDVSock" CACHE STRING
"Select a default pin configuration from common_dvi_pin_configs.h")
set(LED_GPIO_PIN "25" CACHE STRING "Select the GPIO pin for LED")
set(SD_CS "22" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
set(SD_SCK "5" CACHE STRING "Specify de Clock GPIO pin for the SD card")
set(SD_MOSI "18" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
set(SD_MISO "19" CACHE STRING "Select the Master In Slave Out GPIO pin for the SD card")
set(NES_CLK "14" CACHE STRING "Select the Clock GPIO pin for NES controller")
set(NES_DATA "15" CACHE STRING "Select the Data GPIO pin for NES controller")
set(NES_LAT "16" CACHE STRING "Select the Latch GPIO pin for NES controller")
set(WII_SDA "-1" CACHE STRING "Select the SDA GPIO pin for Wii Classic controller")
set(WII_SCL "-1" CACHE STRING "Select the SCL GPIO pin for Wii Classic controller")
elseif ( INFONES_PLUS_HW_CONFIG EQUAL 2 )
# --------------------------------------------------------------------
# Alternate config for use with different SDcard reader and HDMI board
# --------------------------------------------------------------------
# Adafruit DVI Breakout For HDMI Source Devices https://www.adafruit.com/product/4984
set(DVICONFIG "dviConfig_PicoDVISock" CACHE STRING
"Select a default pin configuration from common_dvi_pin_configs.h")
set(LED_GPIO_PIN "25" CACHE STRING "Select the GPIO pin for LED")
# Adafruit Micro-SD breakout board+ https://www.adafruit.com/product/254
set(SD_CS "5" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
set(SD_SCK "2" CACHE STRING "Specify de Clock GPIO pin for the SD card")
set(SD_MOSI "3" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
set(SD_MISO "4" CACHE STRING "Select the Master In Slave Out GPIO pin for the SD card")
set(NES_CLK "6" CACHE STRING "Select the Clock GPIO pin for NES controller")
set(NES_DATA "7" CACHE STRING "Select the Data GPIO pin for NES controller")
set(NES_LAT "8" CACHE STRING "Select the Latch GPIO pin for NES controller")
set(WII_SDA "-1" CACHE STRING "Select the SDA GPIO pin for Wii Classic controller")
set(WII_SCL "-1" CACHE STRING "Select the SCL GPIO pin for Wii Classic controller")
elseif ( INFONES_PLUS_HW_CONFIG EQUAL 3 )
# --------------------------------------------------------------------
# Alternate config for use with Adafruit Feather RP2040 DVI + SD Wing
# --------------------------------------------------------------------
set(DVICONFIG "dviConfig_AdafruitFeatherDVI" CACHE STRING
"Select a default pin configuration from common_dvi_pin_configs.h")
set(LED_GPIO_PIN "13" CACHE STRING "Select the GPIO pin for LED")
set(SD_CS "10" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
set(SD_SCK "14" CACHE STRING "Specify de Clock GPIO pin for the SD card")
set(SD_MOSI "15" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
set(SD_MISO "8" CACHE STRING "Select the Master In Slave Out GPIO pin for the SD card")
set(NES_CLK "5" CACHE STRING "Select the Clock GPIO pin for NES controller")
set(NES_DATA "6" CACHE STRING "Select the Data GPIO pin for NES controller")
set(NES_LAT "9" CACHE STRING "Select the Latch GPIO pin for NES controller")
set(WII_SDA "2" CACHE STRING "Select the SDA GPIO pin for Wii Classic controller")
set(WII_SCL "3" CACHE STRING "Select the SCL GPIO pin for Wii Classic controller")
elseif ( INFONES_PLUS_HW_CONFIG EQUAL 4 )
# --------------------------------------------------------------------
# Alternate config for use with Waveshare RP2040-PiZero
# --------------------------------------------------------------------
set(DVICONFIG "dviConfig_WaveShareRp2040" CACHE STRING
"Select a default pin configuration from common_dvi_pin_configs.h")
set(LED_GPIO_PIN "-1" CACHE STRING "Select the GPIO pin for LED")
set(SD_CS "21" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
set(SD_SCK "18" CACHE STRING "Specify de Clock GPIO pin for the SD card")
set(SD_MOSI "19" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
set(SD_MISO "20" CACHE STRING "Select the Master In Slave Out GPIO pin for the SD card")
set(NES_CLK "5" CACHE STRING "Select the Clock GPIO pin for NES controller")
set(NES_DATA "6" CACHE STRING "Select the Data GPIO pin for NES controller")
set(NES_LAT "9" CACHE STRING "Select the Latch GPIO pin for NES controller")
set(WII_SDA "-1" CACHE STRING "Select the SDA GPIO pin for Wii Classic controller")
set(WII_SCL "-1" CACHE STRING "Select the SCL GPIO pin for Wii Classic controller")
endif ( )
# --------------------------------------------------------------------
message("HDMI board type : ${DVICONFIG}")
message("SD card CS : ${SD_CS}")
message("SD card SCK : ${SD_SCK}")
message("SD card MOSI : ${SD_MOSI}")
message("SD card MISO : ${SD_MISO}")
message("NES controller CLK : ${NES_CLK}")
message("NES controller DATA : ${NES_DATA}")
message("NES controller LAT : ${NES_LAT}")
message("Wii controller SDA : ${WII_SDA}")
message("Wii controller SCL : ${WII_SCL}")
message("LED pin : ${LED_GPIO_PIN}")
add_executable(piconesPlus
main.cpp
hid_app.cpp
gamepad.cpp
nespad.cpp
wiipad.cpp
menu.cpp
RomLister.cpp
FrensHelpers.cpp
)
pico_set_program_name(piconesPlus "piconesPlus")
pico_set_program_version(piconesPlus "0.8")
pico_enable_stdio_uart(piconesPlus 1)
pico_enable_stdio_usb(piconesPlus 0)
# tinyusb
set(FAMILY rp2040)
set(BOARD pico_sdk)
set(TINYUSB_DEBUG_LEVE 0)
include(${PICO_TINYUSB_PATH}/hw/bsp/${FAMILY}/family.cmake)
family_configure_target(piconesPlus)
target_compile_definitions(piconesPlus PRIVATE
DVICONFIG=${DVICONFIG}
SDCARD_PIN_SPI0_CS=${SD_CS}
SDCARD_PIN_SPI0_SCK=${SD_SCK}
SDCARD_PIN_SPI0_MOSI=${SD_MOSI}
SDCARD_PIN_SPI0_MISO=${SD_MISO}
SDCARD_PIO=pio1
SDCARD_PIO_SM=0
NES_PIN_CLK=${NES_CLK}
NES_PIN_DATA=${NES_DATA}
NES_PIN_LAT=${NES_LAT}
WII_PIN_SDA=${WII_SDA}
WII_PIN_SCL=${WII_SCL}
LED_GPIO_PIN=${LED_GPIO_PIN}
)
target_link_libraries(piconesPlus PRIVATE
pico_stdlib
pico_multicore
hardware_dma
hardware_pio
hardware_i2c
hardware_interp
hardware_timer
hardware_clocks
hardware_pwm
hardware_flash
dvi
util
infones
tinyusb_host
sdcard
fatfs
)
target_include_directories(piconesPlus
PRIVATE
pico_lib
infones
assets
include
.
)
add_subdirectory(pico_lib/dvi)
add_subdirectory(pico_lib/util)
add_subdirectory(infones)
pico_add_extra_outputs(piconesPlus)