File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,9 +112,30 @@ if(DMBOOT_FLASH_DMD_FILES)
112112 endif ()
113113 endforeach ()
114114
115- # Download main module if specified (at the end of installation)
115+ # Download main module if specified (at the end of installation),
116+ # but only if it is not already listed in any flash.dmd file
116117 if (DMBOOT_MAIN_MODULE)
117- append_main_module_download_commands (_FLASH_DOWNLOAD_COMMANDS )
118+ set (_MAIN_MODULE_IN_FLASH_DMD FALSE )
119+ foreach (_DMD_FILE IN LISTS DMBOOT_FLASH_DMD_FILES)
120+ file (STRINGS "${_DMD_FILE} " _DMD_LINES )
121+ foreach (_LINE IN LISTS _DMD_LINES)
122+ string (STRIP "${_LINE} " _LINE_STRIPPED)
123+ if (NOT _LINE_STRIPPED MATCHES "^#" AND NOT _LINE_STRIPPED STREQUAL "" )
124+ if (_LINE_STRIPPED STREQUAL "${DMBOOT_MAIN_MODULE} " )
125+ set (_MAIN_MODULE_IN_FLASH_DMD TRUE )
126+ break ()
127+ endif ()
128+ endif ()
129+ endforeach ()
130+ if (_MAIN_MODULE_IN_FLASH_DMD)
131+ break ()
132+ endif ()
133+ endforeach ()
134+ if (NOT _MAIN_MODULE_IN_FLASH_DMD)
135+ append_main_module_download_commands (_FLASH_DOWNLOAD_COMMANDS )
136+ else ()
137+ message (STATUS "Main module '${DMBOOT_MAIN_MODULE} ' is already listed in flash.dmd, skipping explicit download" )
138+ endif ()
118139 endif ()
119140
120141 list (APPEND _FLASH_DOWNLOAD_COMMANDS
You can’t perform that action at this time.
0 commit comments