105 lines
4.6 KiB
CMake
105 lines
4.6 KiB
CMake
# use directory name for project id
|
|
set(FAMILY "rp2040" CACHE STRING "Board/MCU family, decides which drivers to use. Set to RP2040 by default.")
|
|
set(BOARD "raspberry_pi_pico" CACHE STRING "Board used, determines the pinout. Defaults to the Raspberry Pi Pico.")
|
|
|
|
set(PROJECT "430prog")
|
|
#set(PROJECT ${BOARD}-${PROJECT})
|
|
|
|
# TOP is absolute path to root directory of TinyUSB git repo
|
|
|
|
# Check for -DFAMILY=
|
|
if(FAMILY STREQUAL "rp2040")
|
|
option(PICO_NO_FLASH "Disable writing the compiled program to flash, and only load it to RAM. Useful for testing, but not much else (OFF by default)." ON)
|
|
option(PICO_COPY_TO_RAM "Run all code in RAM, while the program is also stored on flash. On bootup, everything will be copied to RAM (OFF by default)." OFF)
|
|
|
|
cmake_minimum_required(VERSION 3.12)
|
|
#set(TOP "$ENV{PICO_SDK_PATH}/lib/tinyusb")
|
|
#get_filename_component(TOP "${TOP}" REALPATH)
|
|
include(cmake/pico_sdk_import.cmake)
|
|
|
|
#include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
|
|
|
|
#family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
|
|
project(${PROJECT})
|
|
#family_initialize_project(PROJECT ${CMAKE_CURRENT_LIST_DIR}) # calls pico_sdk_init()
|
|
pico_sdk_init()
|
|
|
|
add_executable(${PROJECT})
|
|
|
|
pico_enable_stdio_uart(${PROJECT} 0)
|
|
pico_enable_stdio_usb(${PROJECT} 1)
|
|
# Example source
|
|
target_sources(${PROJECT} PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/msp430/pio_sbw.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/msp430/tap.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/msp430/msp430dbg.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/swim/swim_hw.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/swim/swim_cmd.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_helpers.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_test_uart2.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_78k0_spi.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_78k0_uart2.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_78k0_uart2_extclk.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_78k0r_uart1.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_rl78_uart1.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_rl78_uart2.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_cmds.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/test/piotest.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/test/delaytest.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/test/piodump.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/glitch/glitch_param.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/glitch/glitch.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/cli.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/msp430.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/swim.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/78k0.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/rl78.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/rl78-glitch.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/dragonzap.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/zap/zap_adc.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/zap/zap_crowbar.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/zap/zap_dac.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/zap/zap_gpio.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/zap/zap_max4619.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/zap/zap_picoemp.c
|
|
)
|
|
|
|
# Example include
|
|
target_include_directories(${PROJECT} PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/bsp/
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/msp430/
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/swim/
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/test/
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/glitch/
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/zap/
|
|
)
|
|
|
|
# Example defines
|
|
target_compile_definitions(${PROJECT} PUBLIC
|
|
)
|
|
|
|
target_link_libraries(${PROJECT} pico_stdlib pico_unique_id hardware_adc
|
|
hardware_pio hardware_dma hardware_pwm cmsis_core pico_multicore
|
|
hardware_spi)
|
|
|
|
pico_generate_pio_header(${PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/src/msp430/sbw.pio)
|
|
pico_generate_pio_header(${PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/src/swim/swim.pio)
|
|
pico_generate_pio_header(${PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78.pio)
|
|
pico_generate_pio_header(${PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/src/glitch/trigctl.pio)
|
|
pico_generate_pio_header(${PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test.pio)
|
|
pico_generate_pio_header(${PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/src/test/delay.pio)
|
|
|
|
pico_add_extra_outputs(${PROJECT})
|
|
else()
|
|
message(FATAL_ERROR "Invalid FAMILY specified")
|
|
endif()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror=implicit-function-declaration -Werror=return-type -Werror=maybe-uninitialized")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--cref")
|
|
|