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
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / m a i n . c
2021-11-02 22:06:01 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / m s p 4 3 0 / p i o _ s b w . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / m s p 4 3 0 / t a p . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / m s p 4 3 0 / m s p 4 3 0 d b g . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / s w i m / s w i m _ h w . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ h w _ h e l p e r s . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ h w _ t e s t _ u a r t 2 . c
2021-11-04 21:40:36 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ h w _ 7 8 k 0 _ s p i . c
2021-11-02 23:58:52 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ h w _ 7 8 k 0 _ u a r t 2 . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ h w _ 7 8 k 0 _ u a r t 2 _ e x t c l k . c
2021-11-03 20:33:18 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ h w _ 7 8 k 0 r _ u a r t 1 . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ h w _ r l 7 8 _ u a r t 1 . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ h w _ r l 7 8 _ u a r t 2 . c
2021-11-07 20:07:37 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 / t o o l 7 8 _ c m d s . c
2021-11-02 22:06:01 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t e s t / p i o t e s t . c
2021-12-04 21:20:35 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t e s t / d e l a y t e s t . c
2022-02-23 16:14:25 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t e s t / p i o d u m p . c
2021-12-07 03:16:01 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / g l i t c h / g l i t c h . c
2022-02-23 16:14:25 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / c l i / c l i . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / c l i / m s p 4 3 0 . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / c l i / r l 7 8 . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / c l i / r l 7 8 - g l i t c h . c
2022-04-02 01:45:47 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / c l i / d r a g o n z a p . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / z a p / z a p _ a d c . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / z a p / z a p _ c r o w b a r . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / z a p / z a p _ d a c . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / z a p / z a p _ g p i o . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / z a p / z a p _ m a x 4 6 1 9 . c
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / z a p / z a p _ p i c o e m p . 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
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c /
2021-11-02 22:06:01 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / m s p 4 3 0 /
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / s w i m /
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t o o l 7 8 /
2021-12-04 21:20:35 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / t e s t /
2021-12-07 03:16:01 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / g l i t c h /
2022-02-23 16:14:25 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / c l i /
2022-04-02 01:45:47 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s r c / z a p /
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
h a r d w a r e _ p i o h a r d w a r e _ d m a h a r d w a r e _ p w m c m s i s _ c o r e p i c o _ m u l t i c o r e
h a r d w a r e _ s p i )
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" )