@@ -95,6 +95,12 @@ define_property(TARGET
95
95
BRIEF_DOCS "Extra arguments to pass to uf2 conversion"
96
96
FULL_DOCS "Extra arguments to pass to uf2 conversion"
97
97
)
98
+ define_property (TARGET
99
+ PROPERTY PICOTOOL_LOAD_MAP
100
+ INHERITED
101
+ BRIEF_DOCS "Ensure a load map is added"
102
+ FULL_DOCS "Ensure a load map is added"
103
+ )
98
104
99
105
# Check pioasm is installed, or build it if not installed
100
106
function (pico_init_pioasm )
@@ -267,19 +273,41 @@ function(pico_generate_pio_header TARGET)
267
273
endif ()
268
274
endfunction ()
269
275
270
- # pico_package_uf2_output(TARGET PACKADDR)
276
+ # pico_ensure_load_map(TARGET)
277
+ # \brief\ Ensure a load map is added to the target.
278
+ # This can be used to ensure a load map is present, so the bootrom knows where
279
+ # to load the binary if it's stored in a different location (e.g. a packaged
280
+ # binary).
281
+ #
282
+ # This sets the target property PICOTOOL_LOAD_MAP to true.
283
+ function (pico_ensure_load_map TARGET )
284
+ picotool_check_configurable (${TARGET} )
285
+ set_target_properties (${TARGET} PROPERTIES
286
+ PICOTOOL_LOAD_MAP true
287
+ )
288
+ endfunction ()
289
+
290
+ # pico_package_uf2_output(TARGET [PACKADDR])
271
291
# \brief\ Package a UF2 output to be written to the PACKADDR address.
272
292
# This can be used with a no_flash binary to write the UF2 to flash when dragging &
273
293
# dropping, and it will be copied to SRAM by the bootrom before execution.
274
294
#
275
- # This sets the target property PICOTOOL_UF2_PACKAGE_ADDR to PACKADDR.
295
+ # This sets the target property PICOTOOL_UF2_PACKAGE_ADDR to PACKADDR and calls
296
+ # pico_ensure_load_map(TARGET).
276
297
#
277
- # \param\ PACKADDR The address to package the UF2 to
278
- function (pico_package_uf2_output TARGET PACKADDR )
298
+ # \param\ PACKADDR The address to package the UF2 to, defaults to start of flash
299
+ function (pico_package_uf2_output TARGET )
279
300
picotool_check_configurable (${TARGET} )
280
- set_target_properties (${TARGET} PROPERTIES
281
- PICOTOOL_UF2_PACKAGE_ADDR ${PACKADDR}
282
- )
301
+ if (ARGC EQUAL 1 )
302
+ set_target_properties (${TARGET} PROPERTIES
303
+ PICOTOOL_UF2_PACKAGE_ADDR 0x10000000
304
+ )
305
+ else ()
306
+ set_target_properties (${TARGET} PROPERTIES
307
+ PICOTOOL_UF2_PACKAGE_ADDR ${ARGV1}
308
+ )
309
+ endif ()
310
+ pico_ensure_load_map (${TARGET} )
283
311
endfunction ()
284
312
285
313
# pico_set_otp_key_output_file(TARGET OTPFILE)
@@ -629,7 +657,7 @@ function(picotool_postprocess_binary TARGET)
629
657
if (NOT otp_file )
630
658
set (otp_file "" )
631
659
endif ()
632
- get_target_property (uf2_package_addr ${TARGET} PICOTOOL_UF2_PACKAGE_ADDR )
660
+ get_target_property (ensure_load_map ${TARGET} PICOTOOL_LOAD_MAP )
633
661
634
662
# Embed PT properties
635
663
get_target_property (picotool_embed_pt ${TARGET} PICOTOOL_EMBED_PT )
@@ -668,7 +696,7 @@ function(picotool_postprocess_binary TARGET)
668
696
# Signing/hashing/load maps for packaging
669
697
if (picotool_sign_output OR
670
698
picotool_hash_output OR
671
- uf2_package_addr OR
699
+ ensure_load_map OR
672
700
extra_process_args )
673
701
# We don't need the extra end block, as picotool seal will add one
674
702
target_compile_definitions (${TARGET} PRIVATE PICO_CRT0_INCLUDE_PICOBIN_END_BLOCK=0 )
0 commit comments