summaryrefslogtreecommitdiff
path: root/pcr/neo6502/build_offline.patch
blob: 66616024f685acc79d9ad2bc501cb261187f8ff3 (plain)
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
diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt
index a347acf4..7c4e484e 100644
--- a/firmware/CMakeLists.txt
+++ b/firmware/CMakeLists.txt
@@ -3,19 +3,28 @@ cmake_minimum_required(VERSION 3.14)
 set(CMAKE_C_STANDARD 11)
 set(CMAKE_CXX_STANDARD 17)
 
-set(PICO_SDK_FETCH_FROM_GIT on)
+
+if(NOT DEFINED ENV{PICO_SDK_FETCH_FROM_GIT})
+    set(PICO_SDK_FETCH_FROM_GIT on)
+    message("Defaulting PICO_SDK_FETCH_FROM_GIT")
+endif()
 include(pico_sdk_import.cmake)
 
 project(firmware C CXX ASM)
 
 include(FetchContent)
 
-FetchContent_Declare(
-    tinyusb
-    GIT_REPOSITORY https://github.com/hathach/tinyusb.git
-    GIT_TAG        0.16.0
-)
-FetchContent_MakeAvailable(tinyusb)
+# if((NOT DEFINED ENV{PICO_TINYUSB_FETCH_FROM_GIT}) OR ENV{PICO_TINYUSB_FETCH_FROM_GIT})
+if(DEFINED ENV{PICO_TINYUSB_PATH})
+    set(tinyusb_SOURCE_DIR $ENV{PICO_TINYUSB_PATH})
+else()
+    FetchContent_Declare(
+        tinyusb
+        GIT_REPOSITORY https://github.com/hathach/tinyusb.git
+        GIT_TAG        0.16.0
+    )
+    FetchContent_MakeAvailable(tinyusb)
+endif()
 set(PICO_TINYUSB_PATH ${tinyusb_SOURCE_DIR})
 
 pico_sdk_init()
@@ -34,13 +43,18 @@ include_directories(
     common/include
 )
 
-FetchContent_Declare(
-    PicoDVI
-    GIT_REPOSITORY https://github.com/Wren6991/PicoDVI
-    GIT_TAG        a248d72b8cc95a08b43ef4307cd954eb801272b2 # just the latest on 11/12/2023
-)
-FetchContent_MakeAvailable(PicoDVI)
-
+# if ((NOT DEFINED ENV{PICO_DVI_FETCH_FROM_GIT}) OR ENV{PICO_DVI_FETCH_FROM_GIT})
+if(DEFINED ENV{PICO_DVI_PATH})
+    set(picodvi_SOURCE_DIR $ENV{PICO_DVI_PATH})
+    set(picodvi_BINARY_DIR "_deps/picodvi-build")
+else()
+    FetchContent_Declare(
+        PicoDVI
+        GIT_REPOSITORY https://github.com/Wren6991/PicoDVI
+        GIT_TAG        a248d72b8cc95a08b43ef4307cd954eb801272b2 # just the latest on 11/12/2023
+    )
+    FetchContent_MakeAvailable(PicoDVI)
+endif()
 add_subdirectory(${picodvi_SOURCE_DIR}/software/libdvi ${picodvi_BINARY_DIR})
 
 add_library(fatfs INTERFACE)
@@ -54,4 +68,4 @@ target_include_directories(fatfs INTERFACE ${tinyusb_SOURCE_DIR}/lib/fatfs/sourc
 add_subdirectory(sources)
 
 pico_enable_stdio_usb(firmware 0)
-pico_enable_stdio_uart(firmware 0)
\ No newline at end of file
+pico_enable_stdio_uart(firmware 0)
diff --git a/firmware/sources/CMakeLists.txt b/firmware/sources/CMakeLists.txt
index a767fc49..1dd8f093 100644
--- a/firmware/sources/CMakeLists.txt
+++ b/firmware/sources/CMakeLists.txt
@@ -1,11 +1,16 @@
 add_executable(firmware)
 
-FetchContent_Declare(
-    no-OS-FatFS-SD-SPI-RPi-Pico
-    GIT_REPOSITORY https://github.com/carlk3/no-OS-FatFS-SD-SPI-RPi-Pico.git
-    GIT_TAG        bbccc5d2deea09e128e2576ef35f72b473c5ba5f # just the latest on 30/01/2024
-)
-FetchContent_MakeAvailable(no-OS-FatFS-SD-SPI-RPi-Pico)
+if (DEFINED ENV{PICO_FATFS_PATH})
+    set(no-os-fatfs-sd-spi-rpi-pico_SOURCE_DIR $ENV{PICO_FATFS_PATH})
+    set(no-os-fatfs-sd-spi-rpi-pico_BINARY_DIR "_deps/no-os-fatfs-sd-spi-rpi-pico-build")
+else()
+    FetchContent_Declare(
+        no-OS-FatFS-SD-SPI-RPi-Pico
+        GIT_REPOSITORY https://github.com/carlk3/no-OS-FatFS-SD-SPI-RPi-Pico.git
+        GIT_TAG        bbccc5d2deea09e128e2576ef35f72b473c5ba5f # just the latest on 30/01/2024
+    )
+    FetchContent_MakeAvailable(no-OS-FatFS-SD-SPI-RPi-Pico)
+endif()
 
 pico_generate_pio_header(firmware ${CMAKE_CURRENT_LIST_DIR}/system/sm0_memory_emulation_with_clock.pio)
 
@@ -13,26 +18,26 @@ add_definitions(-Wno-error=unused-variable)
 
 set(COMMONSRC "../common/sources/interface")
 
-target_sources(firmware PRIVATE main.cpp  
+target_sources(firmware PRIVATE main.cpp
     #
     #       Common ${COMMONSRC} routines
     #
-    ${COMMONSRC}/graphics.cpp  ${COMMONSRC}/console.cpp  ${COMMONSRC}/keyboard.cpp  ${COMMONSRC}/memory.cpp  
-    ${COMMONSRC}/dispatch.cpp  ${COMMONSRC}/maths.cpp  ${COMMONSRC}/config.cpp  ${COMMONSRC}/efla.cpp 
-    ${COMMONSRC}/gfxcommands.cpp  ${COMMONSRC}/ellipse.cpp  ${COMMONSRC}/fileinterface.cpp  
+    ${COMMONSRC}/graphics.cpp  ${COMMONSRC}/console.cpp  ${COMMONSRC}/keyboard.cpp  ${COMMONSRC}/memory.cpp
+    ${COMMONSRC}/dispatch.cpp  ${COMMONSRC}/maths.cpp  ${COMMONSRC}/config.cpp  ${COMMONSRC}/efla.cpp
+    ${COMMONSRC}/gfxcommands.cpp  ${COMMONSRC}/ellipse.cpp  ${COMMONSRC}/fileinterface.cpp
     ${COMMONSRC}/sprites.cpp  ${COMMONSRC}/logo.cpp  ${COMMONSRC}/sprites_xor.cpp  ${COMMONSRC}/tilemap.cpp
     ${COMMONSRC}/sndmanager.cpp  ${COMMONSRC}/sfxmanager.cpp ${COMMONSRC}/tick.cpp ${COMMONSRC}/serialmanager.cpp
     ${COMMONSRC}/turtle.cpp ${COMMONSRC}/locale.cpp ${COMMONSRC}/pininterface.cpp
     #
     #       Hardware sources
     #
-    hardware/dvi_320x240x256.cpp  hardware/usbdriver.cpp  hardware/timer.cpp  hardware/sound.cpp  
+    hardware/dvi_320x240x256.cpp  hardware/usbdriver.cpp  hardware/timer.cpp  hardware/sound.cpp
     hardware/fileimplementation.cpp hardware/tick.cpp hardware/serial.cpp hardware/ports.cpp
     #
     #       CPU type (pretty much permanently PIO now)
     #
-    system/processor_pio.cpp 
-    #system/processor_bitbang.cpp 
+    system/processor_pio.cpp
+    #system/processor_bitbang.cpp
 )
 
 #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")