-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
115 lines (95 loc) · 3.04 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
# Set minimum required version of CMake
cmake_minimum_required(VERSION 3.16)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (DEFINED ENV{FIRMWARE_VERSION})
set(WN_FIRMWARE_VERSION $ENV{FIRMWARE_VERSION})
message("Using FIRMWARE_VERSION from environment ('${WN_FIRMWARE_VERSION}')")
endif ()
# Include build functions from Pico SDK
include(pico_sdk_import.cmake)
#include(pico_extras_import.cmake)
# Set name of project (as PROJECT_NAME) and C/C++ standards
project(NeuronWired C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(PICO_CXX_ENABLE_EXCEPTIONS 1)
set(PICO_CXX_ENABLE_RTTI 1)
# Creates a pico-sdk subdirectory in our project for the libraries
pico_sdk_init()
# Add subdirectories to the project
add_subdirectory(lib)
# Tell CMake where to find the executable source file
set(NEURONWIRED NeuronWired)
add_executable(${NEURONWIRED}
src/DefyFirmwareVersion.cpp
src/EEPROMPadding.cpp
src/EEPROMUpgrade.cpp
src/IntegrationTest.cpp
src/LED-CapsLockLight.cpp
src/main.cpp
)
pico_set_program_name(${NEURONWIRED} "NeuronWired")
pico_set_program_version(${NEURONWIRED} "0.1")
# Enable usb output, disable uart output
pico_enable_stdio_uart(${NEURONWIRED} 0)
pico_enable_stdio_usb(${NEURONWIRED} 0)
# Link to pico_stdlib (gpio, time, etc. functions)
target_link_libraries(${NEURONWIRED}
pico_stdlib
pico_multicore
pico_unique_id
hardware_i2c
hardware_exception
hardware_dma
hardware_flash
hardware_pio
# hardware_sleep
hardware_spi
)
# Add any user requested libraries
target_link_libraries(${NEURONWIRED}
Arduino
Communications
CRC
EEPROM
kaleidoscope
KeyboardioHID
PluginLedLibrary
PluginUpgrade
SPISlave
)
# Create map/bin/hex/uf2 files
pico_add_extra_outputs(${NEURONWIRED})
target_compile_definitions(${NEURONWIRED} PUBLIC
-DF_CPU=133000000L
-D__RP2040__
-DNEURON_WIRED
-DBOARD_VENDORID=0x35EF
-DBOARD_PRODUCTID=0x0010
-DBOARD_MANUFACTURER="DYGMA"
-DBOARD_PRODUCT="DEFY"
-DUSB_PRODUCT="DEFY"
-DARDUINO_RASPBERRY_PI_PICO
-DARDUINO_ARCH_RP2040
-DARDUINO=10804
-DCFG_DEBUG=0
-DLFS_NO_ASSERT
-DUSE_LFXO
-DUSBCON
-DUSE_TINYUSB
-DEEPROM_EMULATION_SIZE=8192
-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Dygma-DefyWN.h"
-DKALEIDOSCOPE_LED_CONTROL_H="kaleidoscope/plugin/LEDControl.h"
)
if (DEFINED WN_FIRMWARE_VERSION)
target_compile_definitions(${NEURONWIRED} PUBLIC
-DFIRMWARE_VERSION=\"${WN_FIRMWARE_VERSION}\"
)
endif ()
if (CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_options(${NEURONWIRED} PRIVATE -O0)
else (CMAKE_BUILD_TYPE MATCHES Release)
endif ()
configure_file(memmap_mainProgram.ld memmap_mainProgram.ld @ONLY)
pico_set_linker_script(${NEURONWIRED} ${CMAKE_CURRENT_BINARY_DIR}/memmap_mainProgram.ld)
add_custom_target(${PROJECT} ALL DEPENDS ${NEURONWIRED})