54 lines
2.0 KiB
CMake
54 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.13)
|
|
|
|
set(PICO_BOARD pico2)
|
|
|
|
include(pico_sdk_import.cmake)
|
|
|
|
project(picomap C CXX ASM)
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
pico_sdk_init()
|
|
|
|
set(LIB_SOURCES
|
|
lib/arp.cpp
|
|
lib/dispatch.cpp
|
|
lib/handlers.cpp
|
|
lib/icmp.cpp
|
|
lib/igmp.cpp
|
|
lib/ipv4.cpp
|
|
lib/net.cpp
|
|
lib/tusb_config.cpp
|
|
w6300/w6300.cpp
|
|
)
|
|
|
|
set(LIB_DEPS pico_stdlib tinyusb_device tinyusb_board hardware_pio hardware_spi hardware_dma hardware_clocks)
|
|
|
|
add_executable(picomap firmware.cpp ${LIB_SOURCES})
|
|
target_include_directories(picomap PRIVATE include w6300)
|
|
target_compile_options(picomap PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
|
pico_generate_pio_header(picomap ${CMAKE_CURRENT_LIST_DIR}/w6300/qspi.pio)
|
|
pico_enable_stdio_usb(picomap 0)
|
|
pico_enable_stdio_uart(picomap 0)
|
|
pico_set_binary_type(picomap copy_to_ram)
|
|
string(TIMESTAMP BUILD_EPOCH "%s" UTC)
|
|
math(EXPR VERSION_MAJOR "${BUILD_EPOCH} >> 16")
|
|
math(EXPR VERSION_MINOR "${BUILD_EPOCH} & 65535")
|
|
pico_set_binary_version(picomap MAJOR ${VERSION_MAJOR} MINOR ${VERSION_MINOR})
|
|
target_compile_definitions(picomap PRIVATE BUILD_EPOCH=${BUILD_EPOCH})
|
|
pico_embed_pt_in_binary(picomap ${CMAKE_CURRENT_LIST_DIR}/partition_table.json)
|
|
pico_add_extra_outputs(picomap)
|
|
target_link_libraries(picomap ${LIB_DEPS})
|
|
|
|
add_executable(picomap_test test.cpp lib/test_handlers.cpp ${LIB_SOURCES})
|
|
target_include_directories(picomap_test PRIVATE include w6300)
|
|
target_compile_options(picomap_test PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
|
pico_generate_pio_header(picomap_test ${CMAKE_CURRENT_LIST_DIR}/w6300/qspi.pio)
|
|
pico_enable_stdio_usb(picomap_test 0)
|
|
pico_enable_stdio_uart(picomap_test 0)
|
|
pico_set_binary_type(picomap_test copy_to_ram)
|
|
pico_set_binary_version(picomap_test MAJOR ${VERSION_MAJOR} MINOR ${VERSION_MINOR})
|
|
target_compile_definitions(picomap_test PRIVATE BUILD_EPOCH=${BUILD_EPOCH})
|
|
pico_embed_pt_in_binary(picomap_test ${CMAKE_CURRENT_LIST_DIR}/partition_table.json)
|
|
pico_add_extra_outputs(picomap_test)
|
|
target_link_libraries(picomap_test ${LIB_DEPS})
|