Skip to content

Commit 6e31579

Browse files
authored
Add script to extract CMake function descriptions (#2422)
1 parent 333944a commit 6e31579

File tree

12 files changed

+407
-53
lines changed

12 files changed

+407
-53
lines changed

src/cmake/on_device.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,22 @@ function(pico_get_runtime_output_directory TARGET output_path_name)
1515
set(${output_path_name} ${output_path} PARENT_SCOPE)
1616
endfunction()
1717

18+
# pico_add_hex_output(TARGET)
19+
# \brief\ Generate a hex file for the target
1820
function(pico_add_hex_output TARGET)
1921
pico_get_runtime_output_directory(${TARGET} output_path)
2022
add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${TARGET}> ${output_path}$<IF:$<BOOL:$<TARGET_PROPERTY:${TARGET},OUTPUT_NAME>>,$<TARGET_PROPERTY:${TARGET},OUTPUT_NAME>,$<TARGET_PROPERTY:${TARGET},NAME>>.hex VERBATIM)
2123
endfunction()
2224

25+
# pico_add_bin_output(TARGET)
26+
# \brief\ Generate a bin file for the target
2327
function(pico_add_bin_output TARGET)
2428
pico_get_runtime_output_directory(${TARGET} output_path)
2529
add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${TARGET}> ${output_path}$<IF:$<BOOL:$<TARGET_PROPERTY:${TARGET},OUTPUT_NAME>>,$<TARGET_PROPERTY:${TARGET},OUTPUT_NAME>,$<TARGET_PROPERTY:${TARGET},NAME>>.bin VERBATIM)
2630
endfunction()
2731

32+
# pico_add_dis_output(TARGET)
33+
# \brief\ Generate a disassembly file for the target
2834
function(pico_add_dis_output TARGET)
2935
pico_get_runtime_output_directory(${TARGET} output_path)
3036

@@ -45,6 +51,10 @@ function(pico_add_dis_output TARGET)
4551
)
4652
endfunction()
4753

54+
# pico_add_extra_outputs(TARGET)
55+
# \brief_nodesc\ Perform post-build actions for the target
56+
#
57+
# Perform picotool processing and add disassembly, hex, bin, map, and uf2 outputs for the target
4858
function(pico_add_extra_outputs TARGET)
4959
# Disassembly will be nonsense for encrypted binaries,
5060
# so disassemble before picotool processing

src/common/pico_binary_info/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ endif()
99

1010
target_link_libraries(pico_binary_info INTERFACE pico_binary_info_headers)
1111

12+
# pico_set_program_name(TARGET name)
13+
# \brief\ Set the program name for the target
14+
#
15+
# \param\ name The program name to set
1216
function(pico_set_program_name TARGET name)
1317
# PICO_BUILD_DEFINE: PICO_PROGRAM_NAME, value passed to pico_set_program_name, type=string, group=pico_binary_info
1418
target_compile_definitions(${TARGET} PRIVATE -DPICO_PROGRAM_NAME="${name}")
1519
endfunction()
1620

21+
# pico_set_program_description(TARGET description)
22+
# \brief\ Set the program description for the target
23+
#
24+
# \param\ description The program description to set
1725
function(pico_set_program_description TARGET description)
1826
# since this is the command line, we will remove newlines
1927
string(REPLACE "\n" " " description ${description})
@@ -22,11 +30,19 @@ function(pico_set_program_description TARGET description)
2230
target_compile_definitions(${TARGET} PRIVATE -DPICO_PROGRAM_DESCRIPTION="${description}")
2331
endfunction()
2432

33+
# pico_set_program_url(TARGET url)
34+
# \brief\ Set the program URL for the target
35+
#
36+
# \param\ url The program URL to set
2537
function(pico_set_program_url TARGET url)
2638
# PICO_BUILD_DEFINE: PICO_PROGRAM_URL, value passed to pico_set_program_url, type=string, group=pico_binary_info
2739
target_compile_definitions(${TARGET} PRIVATE -DPICO_PROGRAM_URL="${url}")
2840
endfunction()
2941

42+
# pico_set_program_version(TARGET version)
43+
# \brief\ Set the program version for the target
44+
#
45+
# \param\ version The program version to set
3046
function(pico_set_program_version TARGET version)
3147
# PICO_BUILD_DEFINE: PICO_PROGRAM_VERSION_STRING, value passed to pico_set_program_version, type=string, group=pico_binary_info
3248
target_compile_definitions(${TARGET} PRIVATE -DPICO_PROGRAM_VERSION_STRING="${version}")

src/rp2040/boot_stage2/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ set(PICO_BOOT_STAGE2_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
3333
pico_add_library(boot_stage2_headers)
3434
target_include_directories(boot_stage2_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
3535

36-
# by convention the first source file name without extension is used for the binary info name
36+
# pico_define_boot_stage2(NAME SOURCES)
37+
# \brief\ Define a boot stage 2 target.
38+
#
39+
# By convention the first source file name without extension is used for the binary info name
40+
#
41+
# \param\ NAME The name of the boot stage 2 target
42+
# \param\ SOURCES The source files to link into the boot stage 2
3743
function(pico_define_boot_stage2 NAME SOURCES)
3844
add_executable(${NAME}
3945
${SOURCES}
@@ -97,7 +103,12 @@ endmacro()
97103

98104
pico_define_boot_stage2(bs2_default ${PICO_DEFAULT_BOOT_STAGE2_FILE})
99105

106+
# pico_clone_default_boot_stage2(NAME)
107+
# \brief_nodesc\ Clone the default boot stage 2 target.
108+
#
100109
# Create a new boot stage 2 target using the default implementation for the current build (PICO_BOARD derived)
110+
#
111+
# \param\ NAME The name of the new boot stage 2 target
101112
function(pico_clone_default_boot_stage2 NAME)
102113
pico_define_boot_stage2(${NAME} ${PICO_DEFAULT_BOOT_STAGE2_FILE})
103114
endfunction()

src/rp2350/boot_stage2/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ set(PICO_BOOT_STAGE2_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
3333
pico_add_library(boot_stage2_headers)
3434
target_include_directories(boot_stage2_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
3535

36-
# by convention the first source file name without extension is used for the binary info name
36+
# pico_define_boot_stage2(NAME SOURCES)
37+
# \brief\ Define a boot stage 2 target.
38+
#
39+
# By convention the first source file name without extension is used for the binary info name
40+
#
41+
# \param\ NAME The name of the boot stage 2 target
42+
# \param\ SOURCES The source files to link into the boot stage 2
3743
function(pico_define_boot_stage2 NAME SOURCES)
3844
add_executable(${NAME}
3945
${SOURCES}
@@ -97,7 +103,12 @@ endmacro()
97103

98104
pico_define_boot_stage2(bs2_default ${PICO_DEFAULT_BOOT_STAGE2_FILE})
99105

106+
# pico_clone_default_boot_stage2(NAME)
107+
# \brief_nodesc\ Clone the default boot stage 2 target.
108+
#
100109
# Create a new boot stage 2 target using the default implementation for the current build (PICO_BOARD derived)
110+
#
111+
# \param\ NAME The name of the new boot stage 2 target
101112
function(pico_clone_default_boot_stage2 NAME)
102113
pico_define_boot_stage2(${NAME} ${PICO_DEFAULT_BOOT_STAGE2_FILE})
103114
endfunction()

src/rp2_common/pico_btstack/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,15 @@ if (EXISTS ${PICO_BTSTACK_PATH}/${BTSTACK_TEST_PATH})
302302

303303
pico_promote_common_scope_vars()
304304

305-
# Make a GATT header file from a BTstack GATT file
306-
# Pass the target library name library type and path to the GATT input file
307-
# To add additional directories to the gatt #import path, add them to the end of the argument list.
305+
# pico_btstack_make_gatt_header(TARGET_LIB TARGET_TYPE GATT_FILE)
306+
# \brief\ Make a GATT header file from a BTstack GATT file.
307+
#
308+
# Pass the target library name, library type, and path to the GATT input file.
309+
# To add additional directories to the gatt import path, add them to the end of the argument list.
310+
#
311+
# \param\ TARGET_LIB The target library name
312+
# \param\ TARGET_TYPE The target library type
313+
# \param\ GATT_FILE The path to the GATT input file
308314
function(pico_btstack_make_gatt_header TARGET_LIB TARGET_TYPE GATT_FILE)
309315
find_package (Python3 REQUIRED COMPONENTS Interpreter)
310316
get_filename_component(GATT_NAME "${GATT_FILE}" NAME_WE)

src/rp2_common/pico_cyw43_driver/CMakeLists.txt

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,22 @@ if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE})
131131
)
132132
endif()
133133

134-
# Set an ip address in a compile definition
135-
# target name, target type, compile definition name to set then address in a string
136-
# This can be used to set the following compile definitions
137-
# CYW43_DEFAULT_IP_STA_ADDRESS
138-
# CYW43_DEFAULT_IP_STA_GATEWAY
139-
# CYW43_DEFAULT_IP_AP_ADDRESS
140-
# CYW43_DEFAULT_IP_AP_GATEWAY
141-
# CYW43_DEFAULT_IP_MASK
142-
# CYW43_DEFAULT_IP_DNS
134+
# pico_configure_ip4_address(TARGET_LIB TARGET_TYPE DEF_NAME IP_ADDRESS_STR)
135+
# \brief\ Set an ip address in a compile definition
136+
#
137+
# This can be used to set the following compile definitions;
138+
# CYW43_DEFAULT_IP_STA_ADDRESS;
139+
# CYW43_DEFAULT_IP_STA_GATEWAY;
140+
# CYW43_DEFAULT_IP_AP_ADDRESS;
141+
# CYW43_DEFAULT_IP_AP_GATEWAY;
142+
# CYW43_DEFAULT_IP_MASK;
143+
# CYW43_DEFAULT_IP_DNS;
143144
# e.g. pico_configure_ip4_address(picow_tcpip_server_background PRIVATE CYW43_DEFAULT_IP_STA_ADDRESS "10.3.15.204")
145+
#
146+
# \param\ TARGET_LIB The target library to set the ip address for
147+
# \param\ TARGET_TYPE The type of target library
148+
# \param\ DEF_NAME The name of the compile definition to set
149+
# \param\ IP_ADDRESS_STR The ip address to set
144150
function(pico_configure_ip4_address TARGET_LIB TARGET_TYPE DEF_NAME IP_ADDRESS_STR)
145151
string(REGEX MATCHALL "[0-9]+" IP_ADDRESS_LIST ${IP_ADDRESS_STR})
146152
list(LENGTH IP_ADDRESS_LIST IP_ADDRESS_COMPONENT_COUNT)

src/rp2_common/pico_lwip/tools/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# Compile the http content into a source file "pico_fsdata.inc" in a format suitable for the lwip httpd server
2-
# Pass the target library name library type and the list of httpd content
1+
# pico_set_lwip_httpd_content(TARGET_LIB TARGET_TYPE HTTPD_FILES...)
2+
# \ingroup\ pico_lwip
3+
# \brief_nodesc\ Compile the http content into a source file for lwip.
4+
#
5+
# Compile the http content into a source file "pico_fsdata.inc" in a format suitable for the lwip httpd server.
6+
# Pass the target library name, library type, and the list of httpd content files to compile.
7+
#
8+
# \param\ TARGET_LIB The target library name
9+
# \param\ TARGET_TYPE The type of the target library
10+
# \param\ HTTPD_FILES The list of httpd content files to compile
311
function(pico_set_lwip_httpd_content TARGET_LIB TARGET_TYPE)
412
find_package (Python3 REQUIRED COMPONENTS Interpreter)
513
set(HTTPD_CONTENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")

src/rp2_common/pico_runtime/CMakeLists.txt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,26 @@ elseif (PICO_C_COMPILER_IS_CLANG)
5151
# target_link_options(pico_runtime INTERFACE "-nostdlib")
5252
endif()
5353

54-
# pico_minimize_runtime((INCLUDE ...) (EXCLUDE ...))
54+
# pico_minimize_runtime(TARGET [INCLUDE ...] [EXCLUDE ...])
55+
# \brief\ Minimize the runtime components for the target
5556
#
5657
# INCLUDE/EXCLUDE can contain any of the following (all defaulting to not included)
5758
#
58-
# DEFAULT_ALARM_POOL - default alarm pool setup
59-
# PRINTF - full printf support
60-
# PRINTF_MINIMAL - printf support without the following
61-
# PRINTF_FLOAT - to control float support if printf is enabled
62-
# PRINTF_EXPONENTIAL
63-
# PRINTF_LONG_LONG
64-
# PRINTF_PTRDIFF_T
65-
# FLOAT - support for single-precision floating point
66-
# DOUBLE - support for double-precision floating point
67-
# FPGA_CHECK - checks for FPGA which allows Raspberry Pi to run your binary on FPGA
68-
# PANIC - default panic impl which brings in stdio
69-
# AUTO_INIT_MUTEX - auto init mutexes; without this you get no printf mutex either -
59+
# DEFAULT_ALARM_POOL - default alarm pool setup;
60+
# PRINTF - full printf support;
61+
# PRINTF_MINIMAL - printf support without the following;
62+
# PRINTF_FLOAT - to control float support if printf is enabled;
63+
# PRINTF_EXPONENTIAL - to control exponential support if printf is enabled;
64+
# PRINTF_LONG_LONG - to control long long support if printf is enabled;
65+
# PRINTF_PTRDIFF_T - to control ptrdiff_t support if printf is enabled;
66+
# FLOAT - support for single-precision floating point;
67+
# DOUBLE - support for double-precision floating point;
68+
# FPGA_CHECK - checks for FPGA which allows Raspberry Pi to run your binary on FPGA;
69+
# PANIC - default panic impl which brings in stdio;
70+
# AUTO_INIT_MUTEX - auto init mutexes, without this you get no printf mutex either;
71+
#
72+
# \param\ INCLUDE The items to include
73+
# \param\ EXCLUDE The items to exclude
7074
function(pico_minimize_runtime TARGET)
7175
set(ALL_ITEMS
7276
DEFAULT_ALARM_POOL

src/rp2_common/pico_standard_link/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ if (NOT TARGET pico_standard_link)
55
target_link_libraries(pico_standard_link INTERFACE boot_stage2_headers)
66
endif()
77

8+
# pico_add_link_depend(TARGET dependency)
9+
# \brief\ Add a link time dependency to the target
10+
#
11+
# \param\ dependency The dependency to add
812
function(pico_add_link_depend TARGET dependency)
913
get_target_property(target_type ${TARGET} TYPE)
1014
if (${target_type} STREQUAL "INTERFACE_LIBRARY")
@@ -21,11 +25,18 @@ if (NOT TARGET pico_standard_link)
2125
set_target_properties(${TARGET} PROPERTIES ${PROP} "${_LINK_DEPENDS}")
2226
endfunction()
2327

24-
# need this because cmake does not appear to have a way to override an INTERFACE variable
28+
# pico_set_linker_script(TARGET LDSCRIPT)
29+
# \brief\ Set the linker script for the target
30+
#
31+
# \param\ LDSCRIPT Full path to the linker script to set
2532
function(pico_set_linker_script TARGET LDSCRIPT)
2633
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_LINKER_SCRIPT ${LDSCRIPT})
2734
endfunction()
2835

36+
# pico_set_binary_type(TARGET TYPE)
37+
# \brief\ Set the binary type for the target
38+
#
39+
# \param\ TYPE The binary type to set
2940
function(pico_set_binary_type TARGET TYPE)
3041
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_BINARY_TYPE ${TYPE})
3142
endfunction()

src/rp2_common/pico_stdio/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,34 @@ if (NOT TARGET pico_stdio)
2626
pico_mirrored_target_link_libraries(pico_stdio INTERFACE pico_printf)
2727
endif()
2828

29+
# pico_enable_stdio_uart(TARGET ENABLED)
30+
# \brief\ Enable stdio UART for the target
31+
#
32+
# \param\ ENABLED Whether to enable stdio UART
2933
function(pico_enable_stdio_uart TARGET ENABLED)
3034
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_STDIO_UART ${ENABLED})
3135
endfunction()
3236

37+
# pico_enable_stdio_usb(TARGET ENABLED)
38+
# \brief\ Enable stdio USB for the target
39+
#
40+
# \param\ ENABLED Whether to enable stdio USB
3341
function(pico_enable_stdio_usb TARGET ENABLED)
3442
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_STDIO_USB ${ENABLED})
3543
endfunction()
3644

45+
# pico_enable_stdio_semihosting(TARGET ENABLED)
46+
# \brief\ Enable stdio semi-hosting for the target
47+
#
48+
# \param\ ENABLED Whether to enable stdio semi-hosting
3749
function(pico_enable_stdio_semihosting TARGET ENABLED)
3850
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_STDIO_SEMIHOSTING ${ENABLED})
3951
endfunction()
4052

53+
# pico_enable_stdio_rtt(TARGET ENABLED)
54+
# \brief\ Enable stdio RTT for the target
55+
#
56+
# \param\ ENABLED Whether to enable stdio RTT
4157
function(pico_enable_stdio_rtt TARGET ENABLED)
4258
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_STDIO_RTT ${ENABLED})
4359
endfunction()

0 commit comments

Comments
 (0)