2024-08-08 19:02:04 +08:00
# Picotool Property Defines
# All INHERITED, so can be defined globally, or per target
#
# The picotool functions all set the specified target properties,
# and therefore if the property should be set for multiple targets
# then it can be set manually with `set_property` or other CMake
# functions to set properties for a given scope.
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ O T P _ F I L E
I N H E R I T E D
B R I E F _ D O C S " O T P F i l e t o w r i t e "
F U L L _ D O C S " O T P F i l e t o w r i t e "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ S I G N _ O U T P U T
I N H E R I T E D
B R I E F _ D O C S " S i g n o u t p u t "
F U L L _ D O C S " S i g n o u t p u t "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ S I G F I L E
I N H E R I T E D
B R I E F _ D O C S " P r i v a t e k e y f o r s i g n i n g "
F U L L _ D O C S " P r i v a t e k e y f o r s i g n i n g "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ H A S H _ O U T P U T
I N H E R I T E D
B R I E F _ D O C S " H a s h o u t p u t "
F U L L _ D O C S " H a s h o u t p u t "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ E M B E D _ P T
I N H E R I T E D
B R I E F _ D O C S " P a r t i t i o n t a b l e t o e m b e d i n o u t p u t "
F U L L _ D O C S " P a r t i t i o n t a b l e t o e m b e d i n o u t p u t "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ A E S F I L E
I N H E R I T E D
B R I E F _ D O C S " A E S k e y f o r e n c r y p t i n g "
F U L L _ D O C S " A E S k e y f o r e n c r y p t i n g "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ E N C _ S I G F I L E
I N H E R I T E D
B R I E F _ D O C S " P r i v a t e k e y f o r s i g n i n g e n c r y p t e d b i n a r i e s "
F U L L _ D O C S " P r i v a t e k e y f o r s i g n i n g e n c r y p t e d b i n a r i e s "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ U F 2 _ P A C K A G E _ A D D R
I N H E R I T E D
B R I E F _ D O C S " A d d r e s s t o p a c k a g e U F 2 a t "
F U L L _ D O C S " A d d r e s s t o p a c k a g e U F 2 a t "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ U F 2 _ F A M I L Y
I N H E R I T E D
B R I E F _ D O C S " U F 2 f a m i l y t o u s e "
F U L L _ D O C S " U F 2 f a m i l y t o u s e "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ E X T R A _ P R O C E S S _ A R G S
I N H E R I T E D
B R I E F _ D O C S " E x t r a a r g u m e n t s t o p a s s t o p r o c e s s i n g "
F U L L _ D O C S " E x t r a a r g u m e n t s t o p a s s t o p r o c e s s i n g "
)
define_property ( TARGET
P R O P E R T Y P I C O T O O L _ E X T R A _ U F 2 _ A R G S
I N H E R I T E D
B R I E F _ D O C S " E x t r a a r g u m e n t s t o p a s s t o u f 2 c o n v e r s i o n "
F U L L _ D O C S " E x t r a a r g u m e n t s t o p a s s t o u f 2 c o n v e r s i o n "
)
2023-06-06 23:46:17 +08:00
2024-08-08 19:02:04 +08:00
# Check pioasm is installed, or build it if not installed
function ( pico_init_pioasm )
# Assemble the version string from components instead of using PICO_SDK_VERSION_STRING, because the version string
# potentially has a PRE_RELEASE_ID suffix, which will trip up the find_package call.
set ( pioasm_VERSION_REQUIRED "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}" )
if ( NOT TARGET pioasm AND NOT DEFINED pioasm_FOUND )
set ( pioasm_INSTALL_DIR ${ CMAKE_BINARY_DIR } /pioasm-install )
if ( NOT pioasm_DIR AND EXISTS ${ pioasm_INSTALL_DIR } /pioasm )
set ( pioasm_DIR ${ pioasm_INSTALL_DIR } /pioasm )
endif ( )
# Find package - will find installed pioasm, either at pioasm_DIR or system
find_package ( pioasm ${ pioasm_VERSION_REQUIRED } QUIET CONFIG NO_CMAKE_FIND_ROOT_PATH )
if ( NOT pioasm_FOUND )
2023-06-06 23:46:17 +08:00
set ( CMAKE_MODULE_PATH ${ CMAKE_MODULE_PATH } ${ PICO_SDK_PATH } /tools )
# todo CMAKE_CURRENT_FUNCTION_LIST_DIR ... what version?
2024-08-08 19:02:04 +08:00
find_package ( pioasm MODULE REQUIRED )
endif ( )
endif ( )
if ( TARGET pioasm )
set ( pioasm_FOUND 1 PARENT_SCOPE )
else ( )
message ( "No pioasm found" )
endif ( )
endfunction ( )
# Check picotool is installed, or download and build it if not installed
function ( pico_init_picotool )
set ( picotool_VERSION_REQUIRED 2.0.0 )
if ( NOT TARGET picotool AND NOT DEFINED picotool_FOUND )
# Build path of local install dir
if ( DEFINED ENV{PICOTOOL_FETCH_FROM_GIT_PATH} AND ( NOT PICOTOOL_FETCH_FROM_GIT_PATH ) )
set ( PICOTOOL_FETCH_FROM_GIT_PATH $ENV{ PICOTOOL_FETCH_FROM_GIT_PATH } )
message ( "Using PICOTOOL_FETCH_FROM_GIT_PATH from environment ('${PICOTOOL_FETCH_FROM_GIT_PATH}')" )
endif ( )
include ( FetchContent )
if ( PICOTOOL_FETCH_FROM_GIT_PATH )
get_filename_component ( picotool_INSTALL_DIR "${PICOTOOL_FETCH_FROM_GIT_PATH}" ABSOLUTE )
else ( )
set ( picotool_INSTALL_DIR ${ FETCHCONTENT_BASE_DIR } )
endif ( )
if ( NOT PICOTOOL_FORCE_FETCH_FROM_GIT AND NOT ENV{PICOTOOL_FORCE_FETCH_FROM_GIT} )
if ( NOT picotool_DIR AND EXISTS ${ picotool_INSTALL_DIR } /picotool )
set ( picotool_DIR ${ picotool_INSTALL_DIR } /picotool )
endif ( )
# Find package - will find installed picotool, either at picotool_DIR or system
find_package ( picotool ${ picotool_VERSION_REQUIRED } QUIET CONFIG NO_CMAKE_FIND_ROOT_PATH )
if ( NOT picotool_FOUND AND picotool_CONSIDERED_VERSIONS )
message ( FATAL_ERROR
" I n c o m p a t i b l e p i c o t o o l i n s t a l l a t i o n f o u n d : "
" R e q u i r e s v e r s i o n $ { p i c o t o o l _ V E R S I O N _ R E Q U I R E D } , "
" y o u h a v e v e r s i o n $ { p i c o t o o l _ C O N S I D E R E D _ V E R S I O N S } \ n "
" U p d a t e y o u r i n s t a l l a t i o n , o r s e t P I C O T O O L _ F O R C E _ F E T C H _ F R O M _ G I T "
" t o d o w n l o a d a n d b u i l d t h e c o r r e c t v e r s i o n "
)
endif ( )
else ( )
message ( "Forcing fetch of picotool from git" )
2023-06-06 23:46:17 +08:00
endif ( )
2024-08-08 19:02:04 +08:00
if ( NOT picotool_FOUND )
set ( CMAKE_MODULE_PATH ${ CMAKE_MODULE_PATH } ${ PICO_SDK_PATH } /tools )
find_package ( picotool MODULE )
endif ( )
endif ( )
if ( TARGET picotool )
set ( picotool_FOUND 1 PARENT_SCOPE )
else ( )
message ( "No picotool found" )
2023-02-06 08:05:54 +08:00
endif ( )
2021-01-21 00:44:27 +08:00
endfunction ( )
2024-08-08 19:02:04 +08:00
# 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
2021-01-21 00:44:27 +08:00
function ( pico_generate_pio_header TARGET PIO )
2024-08-08 19:02:04 +08:00
pico_init_pioasm ( )
2022-05-17 03:20:41 +08:00
cmake_parse_arguments ( pico_generate_pio_header "" "OUTPUT_FORMAT;OUTPUT_DIR" "" ${ ARGN } )
if ( pico_generate_pio_header_OUTPUT_FORMAT )
set ( OUTPUT_FORMAT "${pico_generate_pio_header_OUTPUT_FORMAT}" )
elseif ( DEFINED PICO_DEFAULT_PIOASM_OUTPUT_FORMAT )
set ( OUTPUT_FORMAT "${PICO_DEFAULT_PIOASM_OUTPUT_FORMAT}" )
else ( )
set ( OUTPUT_FORMAT "c-sdk" )
endif ( )
2021-01-21 00:44:27 +08:00
if ( pico_generate_pio_header_OUTPUT_DIR )
2024-01-19 22:57:16 +08:00
file ( MAKE_DIRECTORY ${ pico_generate_pio_header_OUTPUT_DIR } )
2021-01-21 00:44:27 +08:00
get_filename_component ( HEADER_DIR ${ pico_generate_pio_header_OUTPUT_DIR } ABSOLUTE )
else ( )
set ( HEADER_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
endif ( )
get_filename_component ( PIO_NAME ${ PIO } NAME )
set ( HEADER "${HEADER_DIR}/${PIO_NAME}.h" )
#message("Will generate ${HEADER}")
get_filename_component ( HEADER_GEN_TARGET ${ PIO } NAME_WE )
set ( HEADER_GEN_TARGET "${TARGET}_${HEADER_GEN_TARGET}_pio_h" )
2021-01-30 03:46:23 +08:00
add_custom_target ( ${ HEADER_GEN_TARGET } DEPENDS ${ HEADER } )
2021-01-21 00:44:27 +08:00
2024-08-08 19:02:04 +08:00
if ( PICO_PIO_VERSION )
set ( VERSION_STRING "${PICO_PIO_VERSION}" )
else ( )
set ( VERSION_STRING "0" )
endif ( )
2021-01-21 00:44:27 +08:00
add_custom_command ( OUTPUT ${ HEADER }
D E P E N D S $ { P I O }
2024-08-08 19:02:04 +08:00
C O M M A N D p i o a s m - o $ { O U T P U T _ F O R M A T } - v $ { V E R S I O N _ S T R I N G } $ { P I O } $ { H E A D E R }
2022-12-07 07:45:57 +08:00
V E R B A T I M )
2021-01-21 00:44:27 +08:00
add_dependencies ( ${ TARGET } ${ HEADER_GEN_TARGET } )
get_target_property ( target_type ${ TARGET } TYPE )
2021-06-29 05:53:38 +08:00
if ( "INTERFACE_LIBRARY" STREQUAL "${target_type}" )
2021-01-21 00:44:27 +08:00
target_include_directories ( ${ TARGET } INTERFACE ${ HEADER_DIR } )
2021-06-29 05:53:38 +08:00
else ( )
target_include_directories ( ${ TARGET } PUBLIC ${ HEADER_DIR } )
2021-01-21 00:44:27 +08:00
endif ( )
endfunction ( )
2024-08-08 19:02:04 +08:00
# pico_package_uf2_output(TARGET PACKADDR)
# 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 )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ U F 2 _ P A C K A G E _ A D D R $ { P A C K A D D R }
)
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 )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ O T P _ F I L E $ { O T P F I L E }
)
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.
function ( pico_load_map_clear_sram TARGET )
# get and set, to inherit list
get_target_property ( extra_args ${ TARGET } PICOTOOL_EXTRA_PROCESS_ARGS )
if ( extra_args )
set_target_properties ( ${ TARGET } PROPERTIES PICOTOOL_EXTRA_PROCESS_ARGS ${ extra_args } )
endif ( )
# append --clear to list
set_property ( TARGET ${ TARGET } APPEND PROPERTY
P I C O T O O L _ E X T R A _ P R O C E S S _ A R G S " - - c l e a r "
)
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.
function ( pico_set_binary_version TARGET )
set ( oneValueArgs MAJOR MINOR ROLLBACK )
set ( multiValueArgs ROWS )
cmake_parse_arguments ( PARSE_ARGV 1 SV "" "${oneValueArgs}" "${multiValueArgs}" )
# get and set, to inherit list
get_target_property ( extra_args ${ TARGET } PICOTOOL_EXTRA_PROCESS_ARGS )
if ( extra_args )
set_target_properties ( ${ TARGET } PROPERTIES PICOTOOL_EXTRA_PROCESS_ARGS ${ extra_args } )
endif ( )
if ( SV_ROLLBACK )
if ( SV_MAJOR )
# append major version
set_property ( TARGET ${ TARGET } APPEND PROPERTY
P I C O T O O L _ E X T R A _ P R O C E S S _ A R G S " - - m a j o r " " $ { S V _ M A J O R } "
)
endif ( )
if ( SV_MINOR )
# append minor version
set_property ( TARGET ${ TARGET } APPEND PROPERTY
P I C O T O O L _ E X T R A _ P R O C E S S _ A R G S " - - m i n o r " " $ { S V _ M I N O R } "
)
endif ( )
# append rollback version
set_property ( TARGET ${ TARGET } APPEND PROPERTY
P I C O T O O L _ E X T R A _ P R O C E S S _ A R G S " - - r o l l b a c k " " $ { S V _ R O L L B A C K } "
)
if ( SV_ROWS )
# append rollback rows
foreach ( row IN LISTS SV_ROWS )
set_property ( TARGET ${ TARGET } APPEND PROPERTY
P I C O T O O L _ E X T R A _ P R O C E S S _ A R G S " $ { r o w } "
)
endforeach ( )
endif ( )
else ( )
if ( SV_MAJOR )
# set major version
target_compile_definitions ( ${ TARGET } PRIVATE PICO_CRT0_VERSION_MAJOR= ${ SV_MAJOR } )
endif ( )
if ( SV_MINOR )
# append minor version
target_compile_definitions ( ${ TARGET } PRIVATE PICO_CRT0_VERSION_MINOR= ${ SV_MINOR } )
endif ( )
endif ( )
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 )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ U F 2 _ F A M I L Y $ { F A M I L Y }
)
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
# set for a given scope, and then the SIGFILE argument is optional.
function ( pico_sign_binary TARGET )
# Enforce signing through target properties
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ S I G N _ O U T P U T t r u e
)
if ( ARGC EQUAL 2 )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ S I G F I L E $ { A R G V 1 }
)
else ( )
get_target_property ( sig_file ${ TARGET } PICOTOOL_SIGFILE )
if ( NOT sig_file )
message ( FATAL_ERROR "Signature file not set for ${TARGET}" )
endif ( )
endif ( )
get_target_property ( otp_file ${ TARGET } PICOTOOL_OTP_FILE )
if ( NOT otp_file )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ O T P _ F I L E " $ { T A R G E T } . o t p . j s o n "
)
endif ( )
endfunction ( )
# pico_hash_binary(TARGET)
# Hash the target binary. This sets PICOTOOL_HASH_OUTPUT to true.
function ( pico_hash_binary TARGET )
# Enforce hashing through target properties
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ H A S H _ O U T P U T t r u e
)
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.
function ( pico_embed_pt_in_binary TARGET PTFILE )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ E M B E D _ P T $ { P T F I L E }
)
endfunction ( )
# pico_encrypt_binary(TARGET AESFILE [SIGFILE])
# Encrypt the target binary with the given AES key (should be a binary
# file containing 32 bytes of a random key), and sign the encrypted binary.
# This sets PICOTOOL_AESFILE to AESFILE, and PICOTOOL_ENC_SIGFILE to SIGFILE
# if present, else PICOTOOL_SIGFILE.
function ( pico_encrypt_binary TARGET AESFILE )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ A E S F I L E $ { A E S F I L E }
)
if ( ARGC EQUAL 3 )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ E N C _ S I G F I L E $ { A R G V 2 }
)
else ( )
get_target_property ( enc_sig_file ${ TARGET } PICOTOOL_ENC_SIGFILE )
if ( NOT enc_sig_file )
get_target_property ( sig_file ${ TARGET } PICOTOOL_SIGFILE )
if ( NOT sig_file )
message ( FATAL_ERROR "Signature file not set for ${TARGET}" )
else ( )
set_target_properties ( ${ TARGET } PROPERTIES
P I C O T O O L _ E N C _ S I G F I L E $ { s i g _ f i l e }
)
endif ( )
endif ( )
endif ( )
endfunction ( )
# pico_add_uf2_output(TARGET)
# Add a UF2 output using picotool - must be called after
# all required properties have been set
2021-01-21 00:44:27 +08:00
function ( pico_add_uf2_output TARGET )
2024-08-08 19:02:04 +08:00
pico_init_picotool ( )
2022-10-21 22:01:55 +08:00
get_target_property ( ${ TARGET } _archive_directory ${ TARGET } ARCHIVE_OUTPUT_DIRECTORY )
if ( ${ TARGET } _archive_directory )
get_filename_component ( output_path "${${TARGET}_archive_directory}"
R E A L P A T H B A S E _ D I R " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } " )
file ( MAKE_DIRECTORY "${output_path}" )
set ( output_path "${output_path}/" )
else ( )
set ( output_path "" )
endif ( )
2024-08-08 19:02:04 +08:00
get_target_property ( ${ TARGET } _uf2_package_addr ${ TARGET } PICOTOOL_UF2_PACKAGE_ADDR )
if ( ${ TARGET } _uf2_package_addr )
set ( uf2_package_args "-o;${${TARGET}_uf2_package_addr}" )
endif ( )
get_target_property ( extra_uf2_args ${ TARGET } PICOTOOL_EXTRA_UF2_ARGS )
if ( 1 ) # TODO: A2 only (Errata RP2350-E9)
if ( NOT extra_uf2_args )
set ( extra_uf2_args "--abs-block" )
elseif ( NOT "--abs-block" IN_LIST extra_uf2_args )
list ( APPEND extra_uf2_args "--abs-block" )
endif ( )
else ( )
if ( NOT extra_uf2_args )
set ( extra_uf2_args "" )
endif ( )
endif ( )
if ( picotool_FOUND )
get_target_property ( picotool_family ${ TARGET } PICOTOOL_UF2_FAMILY )
if ( NOT picotool_family )
if ( PICOTOOL_DEFAULT_FAMILY )
set ( picotool_family ${ PICOTOOL_DEFAULT_FAMILY } )
else ( )
set ( picotool_family ${ PICO_PLATFORM } )
endif ( )
2023-06-06 23:46:17 +08:00
endif ( )
2024-08-08 19:02:04 +08:00
add_custom_command ( TARGET ${ TARGET } POST_BUILD
C O M M A N D p i c o t o o l
A R G S u f 2 c o n v e r t
- - q u i e t
$ { u f 2 _ p a c k a g e _ a r g s }
$ < T A R G E T _ F I L E : $ { T A R G E T } >
$ { o u t p u t _ p a t h } $ < I F : $ < B O O L : $ < T A R G E T _ P R O P E R T Y : $ { T A R G E T } , O U T P U T _ N A M E > > , $ < T A R G E T _ P R O P E R T Y : $ { T A R G E T } , O U T P U T _ N A M E > , $ < T A R G E T _ P R O P E R T Y : $ { T A R G E T } , N A M E > > . u f 2
- - f a m i l y $ { p i c o t o o l _ f a m i l y }
$ { e x t r a _ u f 2 _ a r g s }
C O M M A N D _ E X P A N D _ L I S T S
V E R B A T I M )
endif ( )
endfunction ( )
# Run picotool post-processing on the binary - must be called after
# all required properties have been set
function ( picotool_postprocess_binary TARGET )
# Read target properties
get_target_property ( picotool_sign_output ${ TARGET } PICOTOOL_SIGN_OUTPUT )
if ( picotool_sign_output )
list ( APPEND picotool_args "--sign" )
get_target_property ( picotool_sigfile ${ TARGET } PICOTOOL_SIGFILE )
2021-01-21 00:44:27 +08:00
endif ( )
2024-08-08 19:02:04 +08:00
get_target_property ( picotool_hash_output ${ TARGET } PICOTOOL_HASH_OUTPUT )
if ( picotool_hash_output )
list ( APPEND picotool_args "--hash" )
endif ( )
get_target_property ( otp_file ${ TARGET } PICOTOOL_OTP_FILE )
if ( NOT otp_file )
set ( otp_file "" )
endif ( )
get_target_property ( uf2_package_addr ${ TARGET } PICOTOOL_UF2_PACKAGE_ADDR )
# Embed PT properties
get_target_property ( picotool_embed_pt ${ TARGET } PICOTOOL_EMBED_PT )
# Encryption properties
get_target_property ( picotool_aesfile ${ TARGET } PICOTOOL_AESFILE )
get_target_property ( picotool_enc_sigfile ${ TARGET } PICOTOOL_ENC_SIGFILE )
# Extra args
get_target_property ( extra_process_args ${ TARGET } PICOTOOL_EXTRA_PROCESS_ARGS )
if ( extra_process_args )
list ( APPEND picotool_args ${ extra_process_args } )
endif ( )
pico_init_picotool ( )
if ( picotool_FOUND )
# Embed PT
if ( picotool_embed_pt )
add_custom_command ( TARGET ${ TARGET } POST_BUILD
D E P E N D S $ { p i c o t o o l _ e m b e d _ p t }
C O M M A N D p i c o t o o l p a r t i t i o n c r e a t e - - q u i e t $ { p i c o t o o l _ e m b e d _ p t } $ < T A R G E T _ F I L E : $ { T A R G E T } > $ < T A R G E T _ F I L E : $ { T A R G E T } >
V E R B A T I M )
endif ( )
# Signing/hashing/load maps for packaging
if (
p i c o t o o l _ s i g n _ o u t p u t O R
p i c o t o o l _ h a s h _ o u t p u t O R
u f 2 _ p a c k a g e _ a d d r O R
e x t r a _ p r o c e s s _ a r g s
)
2021-01-21 00:44:27 +08:00
add_custom_command ( TARGET ${ TARGET } POST_BUILD
2024-08-08 19:02:04 +08:00
D E P E N D S $ { p i c o t o o l _ s i g f i l e }
C O M M A N D p i c o t o o l
A R G S s e a l
- - q u i e t
$ < T A R G E T _ F I L E : $ { T A R G E T } > $ < T A R G E T _ F I L E : $ { T A R G E T } >
$ { p i c o t o o l _ s i g f i l e } $ { o t p _ f i l e }
$ { p i c o t o o l _ a r g s }
C O M M A N D _ E X P A N D _ L I S T S
2022-12-07 07:45:57 +08:00
V E R B A T I M )
2024-08-08 19:02:04 +08:00
endif ( )
# Encryption
if ( picotool_aesfile )
add_custom_command ( TARGET ${ TARGET } POST_BUILD
D E P E N D S $ { p i c o t o o l _ e n c _ s i g f i l e } $ { p i c o t o o l _ a e s f i l e }
C O M M A N D p i c o t o o l e n c r y p t - - q u i e t - - h a s h - - s i g n $ < T A R G E T _ F I L E : $ { T A R G E T } > $ < T A R G E T _ F I L E : $ { T A R G E T } > $ { p i c o t o o l _ a e s f i l e } $ { p i c o t o o l _ e n c _ s i g f i l e }
V E R B A T I M )
if ( ARGC EQUAL 2 )
set ( ${ ARGV1 } TRUE PARENT_SCOPE )
endif ( )
endif ( )
2021-01-21 00:44:27 +08:00
endif ( )
endfunction ( )