|
5 | 5 |
|
6 | 6 | include_guard(GLOBAL)
|
7 | 7 |
|
| 8 | +# Usage: |
| 9 | +# UpdateableImage_Add(APPLICATION <name> |
| 10 | +# GROUP <name> |
| 11 | +# ) |
| 12 | +# |
| 13 | +# This function includes an image inside a list that will be used to trigger |
| 14 | +# bootloader-dependent build and packaging logic. |
| 15 | +# |
| 16 | +# APPLICATION <name>: Name of the application. |
| 17 | +# GROUP <name>: Application group (i.e. VARIANT) |
| 18 | +function(UpdateableImage_Add) |
| 19 | + cmake_parse_arguments(VIMAGE "" "APPLICATION;GROUP" "" ${ARGN}) |
| 20 | + |
| 21 | + if(VIMAGE_GROUP) |
| 22 | + set(group ${VIMAGE_GROUP}) |
| 23 | + else() |
| 24 | + set(group "DEFAULT") |
| 25 | + endif() |
| 26 | + |
| 27 | + # Update list of avilable groups |
| 28 | + get_property( |
| 29 | + groups GLOBAL PROPERTY sysbuild_updateable_groups |
| 30 | + ) |
| 31 | + list(APPEND groups ${group}) |
| 32 | + list(REMOVE_DUPLICATES groups) |
| 33 | + set_property( |
| 34 | + GLOBAL PROPERTY sysbuild_updateable_groups ${groups} |
| 35 | + ) |
| 36 | + |
| 37 | + # Append the image name |
| 38 | + set_property( |
| 39 | + GLOBAL |
| 40 | + APPEND PROPERTY sysbuild_updateable_${group} ${VIMAGE_APPLICATION} |
| 41 | + ) |
| 42 | +endfunction() |
| 43 | + |
| 44 | +# Usage: |
| 45 | +# UpdateableImage_Get(<outvar> [ALL|GROUP <group>]) |
| 46 | +# |
| 47 | +# This function returns a list of images, assigned to the specified group. |
| 48 | +# |
| 49 | +# <outvar>: Name of variable to set. |
| 50 | +# ALL: Get images from all groups. |
| 51 | +# GROUP <group>: Image update group. |
| 52 | +# Use "DEFAULT" to get the default group (including DEFAULT_IMAGE). |
| 53 | +function(UpdateableImage_Get outvar) |
| 54 | + set(all_images) |
| 55 | + set(group) |
| 56 | + |
| 57 | + cmake_parse_arguments(VGRP "ALL" "GROUP" "" ${ARGN}) |
| 58 | + if(VGRP_GROUP) |
| 59 | + list(APPEND group ${VGRP_GROUP}) |
| 60 | + endif() |
| 61 | + |
| 62 | + if(VGRP_ALL) |
| 63 | + get_property( |
| 64 | + group GLOBAL PROPERTY sysbuild_updateable_groups |
| 65 | + ) |
| 66 | + list(APPEND group "DEFAULT") |
| 67 | + list(REMOVE_DUPLICATES group) |
| 68 | + endif() |
| 69 | + |
| 70 | + foreach(image_group ${group}) |
| 71 | + get_property( |
| 72 | + images GLOBAL PROPERTY sysbuild_updateable_${image_group} |
| 73 | + ) |
| 74 | + if(images) |
| 75 | + list(APPEND all_images "${images}") |
| 76 | + endif() |
| 77 | + |
| 78 | + # Include the DEFAULT_IMAGE if the DEFAULT group is used. |
| 79 | + if(${image_group} STREQUAL "DEFAULT") |
| 80 | + list(APPEND all_images ${DEFAULT_IMAGE}) |
| 81 | + endif() |
| 82 | + endforeach() |
| 83 | + |
| 84 | + set(${outvar} "${all_images}" PARENT_SCOPE) |
| 85 | +endfunction() |
| 86 | + |
8 | 87 | # Usage:
|
9 | 88 | # ExternalNcsVariantProject_Add(APPLICATION <name>
|
10 | 89 | # VARIANT <name>
|
|
0 commit comments