Skip to content

Commit 9b0f9f6

Browse files
committed
Prepare CMakeLists for onboard emulator
1 parent c69287a commit 9b0f9f6

1 file changed

Lines changed: 33 additions & 10 deletions

File tree

CMakeLists.txt

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ if(NOT DEFINED $ENV{DISABLE_DEBUGGING}) # MATCHES
4949
set(SIDWRITES_DEBUGGING 0) # Enable logging of SID writes one core 2
5050
endif()
5151

52+
### Enable / Disable build with embedded cRSID emulator for SID playing
53+
## Due to the memory footprint only available for Pico2 only at the moment
54+
set(ONBOARD_EMULATOR 0)
55+
5256

5357
#######################################
5458
#### You no touchy after this line ####
@@ -192,6 +196,9 @@ set(COMPILE_OPTS PRIVATE
192196
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
193197
-Wno-unused-function # extra check to verify no unused lingering code is present
194198
-Wno-maybe-uninitialized
199+
-Wno-unused
200+
-Wno-misleading-indentation
201+
-Wno-implicit-fallthrough
195202
-save-temps
196203
${C_OPT}
197204
-fverbose-asm
@@ -253,7 +260,6 @@ if(${PICO_BOARD} STREQUAL "pico")
253260
)
254261
endif()
255262

256-
257263
### Source files to compile
258264
set(SOURCEFILES
259265
${CMAKE_CURRENT_LIST_DIR}/src/usbsid_doubletap.c
@@ -277,6 +283,31 @@ set(SOURCEFILES
277283
${CMAKE_CURRENT_LIST_DIR}/src/usb_descriptors.c
278284
)
279285

286+
### Header folders to include
287+
set(TARGET_INCLUDE_DIRS PRIVATE
288+
${CMAKE_CURRENT_LIST_DIR}
289+
${CMAKE_CURRENT_LIST_DIR}/src
290+
${TINYUSB_PATH}/hw
291+
${TINYUSB_PATH}/src
292+
)
293+
294+
### Emulator compilation additions
295+
if(ONBOARD_EMULATOR EQUAL 1)
296+
if(${PICO_BOARD} STREQUAL "pico2")
297+
add_compile_definitions(ONBOARD_EMULATOR=1)
298+
set(SOURCEFILES
299+
${SOURCEFILES}
300+
${CMAKE_CURRENT_LIST_DIR}/src/sidplayer.c
301+
${CMAKE_CURRENT_LIST_DIR}/src/cRSID/libcRSID.c
302+
)
303+
set(TARGET_INCLUDE_DIRS PRIVATE
304+
${TARGET_INCLUDE_DIRS}
305+
${CMAKE_CURRENT_LIST_DIR}/src/cRSID
306+
${CMAKE_CURRENT_LIST_DIR}/src/sidtunes
307+
)
308+
endif()
309+
endif()
310+
280311
### Libraries to link
281312
set(TARGET_LL
282313
hardware_clocks
@@ -292,6 +323,7 @@ set(TARGET_LL
292323
pico_flash
293324
pico_mem_ops
294325
pico_mem_ops_compiler
326+
pico_malloc
295327
pico_multicore
296328
pico_stdlib
297329
pico_unique_id
@@ -307,14 +339,6 @@ set(PIO_CLOCK ${CMAKE_CURRENT_LIST_DIR}/src/pio/clock.pio)
307339
set(PIO_VU ${CMAKE_CURRENT_LIST_DIR}/src/pio/vu.pio)
308340
set(PIO_RGB ${CMAKE_CURRENT_LIST_DIR}/src/pio/vu_rgb.pio)
309341

310-
### Header folders to include
311-
set(TARGET_INCLUDE_DIRS PRIVATE
312-
.
313-
src
314-
${TINYUSB_PATH}/hw
315-
${TINYUSB_PATH}/src
316-
)
317-
318342
### Pico sdk path
319343
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
320344

@@ -380,7 +404,6 @@ foreach(FILENAME PICOTYPE PCBVERSION IN ZIP_LISTS FILENAMES PICOTYPES PCBVERSION
380404
message("Set USB manufacturer: ${USBSID_MANUFACTURER}")
381405
message("Set USB product: ${BUILD_VERSION}")
382406
# executable
383-
# add_executable(${BUILD} ${SOURCEFILES} ${LIBSOURCEFILES})
384407
add_executable(${BUILD} ${SOURCEFILES})
385408
# BUILD TYPES
386409
if(PICOTYPE STREQUAL "RGB")

0 commit comments

Comments
 (0)