-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
69 lines (51 loc) · 2.01 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
cmake_minimum_required(VERSION 3.15)
set(CMAKE_C_STANDARD 11)
set(PICO_BARE_METAL 1)
set(CMAKE_BUILD_TYPE Debug)
set(PICO_DEOPTIMIZED_DEBUG 1)
set(PICO_SDK_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/pico-sdk)
set(PICO_BOARD pico_w)
set(PICO_PLATFORM rp2040)
# Pull in SDK (must be before project)
include(cmake/pico_sdk_import.cmake)
include(cmake/pico_extras_import.cmake)
project(firmware C CXX ASM)
include_directories(${PROJECT_NAME} PUBLIC include)
file(GLOB_RECURSE SRC_FILES src/*.c)
file(GLOB_RECURSE SRC_ASM_FILES src/*.S)
# Initialize the SDK
pico_sdk_init()
set(TRUE_BAREMETAL FALSE)
include(cmake/baremetal.cmake)
include(config/wifi_config.cmake)
add_compile_options(-Wall
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
-Wno-unused-function # we have some for the docs that aren't called
)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-maybe-uninitialized)
endif()
add_compile_definitions(PICO_HEAP_SIZE=0)
add_compile_definitions(PICO_STACK_SIZE=0x1000)
add_executable(${PROJECT_NAME} ${SRC_FILES} ${SRC_ASM_FILES})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
# pull in common dependencies
target_link_libraries(${PROJECT_NAME}
pico_standard_link
hardware_uart
cmsis_core
pico_cyw43_arch_lwip_threadsafe_background
pico_time
)
if(WIFI_CONFIG)
target_compile_definitions(${PROJECT_NAME} PUBLIC
CYW43_CUSTOM_CONFIG="${WIFI_CONFIG}"
USE_PRIV_THREADS)
endif()
target_link_options(${PROJECT_NAME} PUBLIC "--specs=nosys.specs")
target_link_options(${PROJECT_NAME} PUBLIC "LINKER:--wrap=malloc")
# create map/bin/hex/uf2 file etc.
pico_add_extra_outputs(${PROJECT_NAME})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_OBJDUMP} -t ${PROJECT_NAME}.elf > ${PROJECT_NAME}.sym
)