pico430prog/CMakeLists.txt

99 lines
4.3 KiB
CMake
Raw Normal View History

2021-09-26 22:45:46 +00:00
# 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})
2022-02-23 16:14:25 +00:00
pico_enable_stdio_uart(${PROJECT} 0)
pico_enable_stdio_usb(${PROJECT} 1)
2021-09-26 22:45:46 +00:00
# Example source
target_sources(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
2021-11-02 22:06:01 +00:00
${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/tool78/tool78_hw_helpers.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_test_uart2.c
2021-11-04 21:40:36 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/tool78_hw_78k0_spi.c
2021-11-02 23:58:52 +00:00
${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
2021-11-02 22:06:01 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/test/piotest.c
2021-12-04 21:20:35 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/test/delaytest.c
2022-02-23 16:14:25 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/test/piodump.c
2021-12-07 03:16:01 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/glitch/glitch.c
2022-02-23 16:14:25 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/cli.c
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/msp430.c
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/rl78.c
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/rl78-glitch.c
2022-04-02 01:45:47 +00:00
${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
2021-09-26 22:45:46 +00:00
)
2021-11-02 22:06:01 +00:00
# Example include
2021-09-26 22:45:46 +00:00
target_include_directories(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src/
2021-11-02 22:06:01 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/msp430/
${CMAKE_CURRENT_SOURCE_DIR}/src/swim/
${CMAKE_CURRENT_SOURCE_DIR}/src/tool78/
2021-12-04 21:20:35 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/test/
2021-12-07 03:16:01 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/glitch/
2022-02-23 16:14:25 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/cli/
2022-04-02 01:45:47 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/src/zap/
2021-09-26 22:45:46 +00:00
)
# Example defines
target_compile_definitions(${PROJECT} PUBLIC
)
2022-02-23 16:14:25 +00:00
target_link_libraries(${PROJECT} pico_stdlib pico_unique_id hardware_adc
2022-04-02 01:45:47 +00:00
hardware_pio hardware_dma hardware_pwm cmsis_core pico_multicore
hardware_spi)
2021-09-26 22:45:46 +00:00
2021-11-02 22:06:01 +00:00
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/test/test.pio)
2021-12-04 21:20:35 +00:00
pico_generate_pio_header(${PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/src/test/delay.pio)
2021-09-26 22:45:46 +00:00
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")