-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
65 lines (53 loc) · 1.61 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
cmake_minimum_required(VERSION 3.13...3.27)
include(vendor/pico_sdk_import.cmake)
project(littlefs-usb C CXX ASM)
set(FAMILY rp2040)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
add_executable(littlefs-usb
main.c
littlefs_driver.c
usb_msc_driver.c
usb_descriptors.c
mimic_fat.c
unicode.c
)
target_link_libraries(littlefs-usb PRIVATE
hardware_flash
hardware_sync
littlefs
pico_stdlib
tinyusb_additions
tinyusb_board
tinyusb_device
)
target_include_directories(littlefs-usb
PRIVATE
vendor/littlefs
${CMAKE_CURRENT_LIST_DIR}/include
)
target_compile_options(littlefs-usb PRIVATE -Werror -Wall -Wextra -Wnull-dereference)
target_link_options(littlefs-usb PRIVATE -Wl,--print-memory-usage)
add_library(littlefs INTERFACE)
target_sources(littlefs INTERFACE
vendor/littlefs/lfs.c
vendor/littlefs/lfs_util.c
)
target_include_directories(littlefs INTERFACE
vendor/littlefs
)
target_compile_options(littlefs INTERFACE -Wno-unused-function -Wno-null-dereference)
target_link_libraries(littlefs INTERFACE hardware_flash)
pico_enable_stdio_usb(littlefs-usb 1)
pico_add_extra_outputs(littlefs-usb)
target_compile_options(littlefs-usb PRIVATE -DENABLE_TRACE)
find_program(OPENOCD openocd)
if(OPENOCD)
add_custom_target(flash
COMMAND ${OPENOCD} -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program ${CMAKE_PROJECT_NAME}.elf verify reset exit"
DEPENDS ${CMAKE_PROJECT_NAME}
)
add_custom_target(reset COMMAND ${OPENOCD} -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c init -c reset -c exit)
add_subdirectory(tests EXCLUDE_FROM_ALL)
endif()