Tidy up things for better parsing

Treat ; as a newline request
This commit is contained in:
William Vinnicombe 2025-04-14 15:01:41 +01:00
parent 6ac95efc19
commit 078986dcc5
3 changed files with 45 additions and 34 deletions

View File

@ -51,22 +51,22 @@ elseif (PICO_C_COMPILER_IS_CLANG)
# target_link_options(pico_runtime INTERFACE "-nostdlib")
endif()
# pico_minimize_runtime((INCLUDE ...) (EXCLUDE ...))
# pico_minimize_runtime([INCLUDE ...] [EXCLUDE ...])
#
# INCLUDE/EXCLUDE can contain any of the following (all defaulting to not included)
#
# DEFAULT_ALARM_POOL - default alarm pool setup
# PRINTF - full printf support
# PRINTF_MINIMAL - printf support without the following
# PRINTF_FLOAT - to control float support if printf is enabled
# PRINTF_EXPONENTIAL
# PRINTF_LONG_LONG
# PRINTF_PTRDIFF_T
# FLOAT - support for single-precision floating point
# DOUBLE - support for double-precision floating point
# FPGA_CHECK - checks for FPGA which allows Raspberry Pi to run your binary on FPGA
# PANIC - default panic impl which brings in stdio
# AUTO_INIT_MUTEX - auto init mutexes; without this you get no printf mutex either -
# DEFAULT_ALARM_POOL - default alarm pool setup;
# PRINTF - full printf support;
# PRINTF_MINIMAL - printf support without the following;
# PRINTF_FLOAT - to control float support if printf is enabled;
# PRINTF_EXPONENTIAL - to control exponential support if printf is enabled;
# PRINTF_LONG_LONG - to control long long support if printf is enabled;
# PRINTF_PTRDIFF_T - to control ptrdiff_t support if printf is enabled;
# FLOAT - support for single-precision floating point;
# DOUBLE - support for double-precision floating point;
# FPGA_CHECK - checks for FPGA which allows Raspberry Pi to run your binary on FPGA;
# PANIC - default panic impl which brings in stdio;
# AUTO_INIT_MUTEX - auto init mutexes, without this you get no printf mutex either;
function(pico_minimize_runtime TARGET)
set(ALL_ITEMS
DEFAULT_ALARM_POOL

View File

@ -175,7 +175,9 @@ function(picotool_check_default_keys TARGET)
picotool_compare_keys(${TARGET} ${picotool_enc_sigfile} private.pem "encrypted signing")
endfunction()
# pico_generate_pio_header(TARGET PIO_FILES... [OUTPUT_FORMAT <format>] [OUTPUT_DIR <dir>])
# Generate pio header and include it in the build
#
# PICO_CMAKE_CONFIG: PICO_DEFAULT_PIOASM_OUTPUT_FORMAT, Default output format used by pioasm when using pico_generate_pio_header, type=string, default=c-sdk, group=build
function(pico_generate_pio_header TARGET)
pico_init_pioasm()
@ -233,6 +235,7 @@ endfunction()
# Package a UF2 output to be written to the PACKADDR address. This can be
# used with a no_flash binary to write the UF2 to flash when dragging &
# dropping, and it will be copied to SRAM by the bootrom before execution.
#
# This sets PICOTOOL_UF2_PACKAGE_ADDR to PACKADDR.
function(pico_package_uf2_output TARGET PACKADDR)
picotool_check_configurable(${TARGET})
@ -243,6 +246,7 @@ endfunction()
# pico_set_otp_key_output_file(TARGET OTPFILE)
# Output the public key hash and other necessary rows to an otp JSON file.
#
# This sets PICOTOOL_OTP_FILE to OTPFILE.
function(pico_set_otp_key_output_file TARGET OTPFILE)
picotool_check_configurable(${TARGET})
@ -253,8 +257,9 @@ endfunction()
# pico_load_map_clear_sram(TARGET)
# Adds an entry to the load map to instruct the bootrom to clear all of SRAM
# before loading the binary. This appends the `--clear` argument
# to PICOTOOL_EXTRA_PROCESS_ARGS.
# before loading the binary.
#
# This appends the `--clear` argument to PICOTOOL_EXTRA_PROCESS_ARGS.
function(pico_load_map_clear_sram TARGET)
picotool_check_configurable(${TARGET})
# get and set, to inherit list
@ -270,9 +275,11 @@ endfunction()
# pico_set_binary_version(<TARGET> [MAJOR <version>] [MINOR <version>] [ROLLBACK <version>] [ROLLBACK_ROWS <rows...>])
# Adds a version item to the metadata block, with the given major, minor and
# rollback version, along with the rollback rows. These are appended as arguments
# to PICOTOOL_EXTRA_PROCESS_ARGS if setting the rollback version, or set as compile
# definitions if only setting the major/minor versions.
# rollback version, along with the rollback rows.
#
# These are appended as arguments to PICOTOOL_EXTRA_PROCESS_ARGS if setting the
# rollback version, or set as compile definitions if only setting the major/minor
# versions.
function(pico_set_binary_version TARGET)
picotool_check_configurable(${TARGET})
set(oneValueArgs MAJOR MINOR ROLLBACK)
@ -322,6 +329,7 @@ endfunction()
# pico_set_uf2_family(TARGET FAMILY)
# Set the UF2 family to use when creating the UF2.
#
# This sets PICOTOOL_UF2_FAMILY to FAMILY.
function(pico_set_uf2_family TARGET FAMILY)
picotool_check_configurable(${TARGET})
@ -331,10 +339,12 @@ function(pico_set_uf2_family TARGET FAMILY)
endfunction()
# pico_sign_binary(TARGET [SIGFILE])
# Sign the target binary with the given PEM signature. This sets
# PICOTOOL_SIGN_OUTPUT to true, PICOTOOL_SIGFILE to SIGFILE (if specified),
# and PICOTOOL_OTP_FILE to ${TARGET}.otp.json (if not already set). To
# specify a common SIGFILE for multiple targets, the SIGFILE property can be
# Sign the target binary with the given PEM signature.
#
# This sets PICOTOOL_SIGN_OUTPUT to true, PICOTOOL_SIGFILE to SIGFILE (if
# specified), and PICOTOOL_OTP_FILE to ${TARGET}.otp.json (if not already set).
#
# To specify a common SIGFILE for multiple targets, the SIGFILE property can be
# set for a given scope, and then the SIGFILE argument is optional.
function(pico_sign_binary TARGET)
picotool_check_configurable(${TARGET})
@ -361,7 +371,9 @@ function(pico_sign_binary TARGET)
endfunction()
# pico_hash_binary(TARGET)
# Hash the target binary. This sets PICOTOOL_HASH_OUTPUT to true.
# Hash the target binary.
#
# This sets PICOTOOL_HASH_OUTPUT to true.
function(pico_hash_binary TARGET)
picotool_check_configurable(${TARGET})
# Enforce hashing through target properties
@ -372,7 +384,9 @@ endfunction()
# pico_embed_pt_in_binary(TARGET PTFILE)
# Create the specified partition table from JSON, and embed it in the
# block loop. This sets PICOTOOL_EMBED_PT to PTFILE.
# block loop.
#
# This sets PICOTOOL_EMBED_PT to PTFILE.
function(pico_embed_pt_in_binary TARGET PTFILE)
picotool_check_configurable(${TARGET})
set_target_properties(${TARGET} PROPERTIES

View File

@ -22,8 +22,6 @@ import re
import csv
import logging
from collections import defaultdict
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
@ -41,6 +39,7 @@ all_functions = {}
for dirpath, dirnames, filenames in os.walk(scandir):
# dirnames[:] = [d for d in dirnames if d != "lib"]
for filename in filenames:
group = os.path.basename(dirpath)
file_ext = os.path.splitext(filename)[1]
if filename == 'CMakeLists.txt' or file_ext == '.cmake':
file_path = os.path.join(dirpath, filename)
@ -51,20 +50,18 @@ for dirpath, dirnames, filenames in os.walk(scandir):
name = match.group(4)
signature = match.group(1).strip()
description = match.group(2)
description = description.replace('\n#\n', '\n\n').strip()
description = description.strip('#').strip('\n')
description = description.replace('\n#\n', ';').strip()
description = description.replace('\n#', '').strip()
description = description.replace('#', '').strip()
if signature.startswith(name):
all_functions[name] = (signature, description)
print(all_functions)
all_functions[name] = (signature, description, group)
with open(outfile, 'w', newline='') as csvfile:
fieldnames = ('name', 'signature', 'description')
fieldnames = ('name', 'signature', 'description', 'group')
writer = csv.DictWriter(csvfile, fieldnames=fieldnames, extrasaction='ignore', dialect='excel-tab')
writer.writeheader()
for name, (signature, description) in sorted(all_functions.items()):
writer.writerow({'name': name, 'signature': signature, 'description': description})
for name, (signature, description, group) in sorted(all_functions.items(), key=lambda x: all_functions[x[0]][2]):
writer.writerow({'name': name, 'signature': signature, 'description': description, 'group': group})