@@ -115,18 +115,37 @@ string ProjMgrMlops::BuildVelaOptions(const MlopsNpuType& npu, const MlopsVelaIt
115115 return options;
116116}
117117
118- void ProjMgrMlops::SetMlopsRunType (MlopsRunType& run, const string& targetType, const string & targetSet,
118+ bool ProjMgrMlops::SetMlopsRunType (MlopsRunType& run, const string& targetType, const TargetSetItem & targetSet,
119119 const vector<ContextItem>& contexts, const string& outBaseDir, const string& solutionName) const {
120- run.active = BuildActive (targetType, targetSet);
120+ run.active = BuildActive (targetType, targetSet. set );
121121 run.cbuildRun = outBaseDir + ' /' + solutionName + ' +' + targetType + " .cbuild-run.yml" ;
122- for (const auto & context : contexts) {
122+ for (auto context : contexts) {
123123 if (context.outputTypes .elf .on ) {
124124 MlopsOutputType output;
125125 output.file = context.directories .cprj + ' /' + context.directories .outdir + ' /' + context.outputTypes .elf .filename ;
126126 output.type = RteConstants::OUTPUT_TYPE_ELF ;
127127 run.output .push_back (output);
128128 }
129+ if (context.imageOnly ) {
130+ for (auto item : targetSet.images ) {
131+ if (!item.image .empty ()) {
132+ if (!m_worker->ProcessSequenceRelative (context, item.image , context.csolution ->directory , false )) {
133+ return false ;
134+ }
135+ if (RteFsUtils::IsRelative (item.image )) {
136+ RteFsUtils::NormalizePath (item.image , context.directories .cprj );
137+ }
138+ if (ProjMgrUtils::FileTypeFromExtension (item.image ) == RteConstants::OUTPUT_TYPE_ELF ) {
139+ MlopsOutputType output;
140+ output.file = item.image ;
141+ output.type = RteConstants::OUTPUT_TYPE_ELF ;
142+ run.output .push_back (output);
143+ }
144+ }
145+ }
146+ }
129147 }
148+ return true ;
130149}
131150
132151bool ProjMgrMlops::CollectSettings (const CsolutionItem& csolution, MlopsType& mlops) {
@@ -157,22 +176,20 @@ bool ProjMgrMlops::CollectSettings(const CsolutionItem& csolution, MlopsType& ml
157176 {hardwareTargetSet, hardwareType, hardwareContexts}, {simulatorTargetSet, simulatorType, simulatorContexts}};
158177 for (auto & [targetSet, targetType, ref] : refs) {
159178 for (const auto & entry : targetSet.images ) {
160- if (!entry.context .empty ()) {
161- const string contextName = entry.context + " +" + targetType;
162- if (contexts->find (contextName) != contexts->end ()) {
163- // process context precedences if needed
164- auto & context = contexts->at (contextName);
165- if (!context.precedences ) {
166- if (!m_worker->ParseContextLayers (context) || !m_worker->LoadPacks (context) ||
167- !m_worker->ProcessPrecedences (context, BoardOrDevice::Both) ||
168- !m_worker->SetTargetAttributes (context, context.targetAttributes )) {
169- return false ;
170- }
171- m_worker->CollectNpuInfo (context);
179+ const string contextName = (entry.context .empty () ? csolution.name : entry.context ) + " +" + targetType;
180+ if (contexts->find (contextName) != contexts->end ()) {
181+ // process context precedences if needed
182+ auto & context = contexts->at (contextName);
183+ if (!context.precedences ) {
184+ if (!m_worker->ParseContextLayers (context) || !m_worker->LoadPacks (context) ||
185+ !m_worker->ProcessPrecedences (context, BoardOrDevice::Both) ||
186+ !m_worker->SetTargetAttributes (context, context.targetAttributes )) {
187+ return false ;
172188 }
173- ref.push_back (context);
174- pnames.insert (context.deviceItem .pname );
189+ m_worker->CollectNpuInfo (context);
175190 }
191+ ref.push_back (context);
192+ pnames.insert (context.deviceItem .pname );
176193 }
177194 }
178195 }
@@ -185,7 +202,7 @@ bool ProjMgrMlops::CollectSettings(const CsolutionItem& csolution, MlopsType& ml
185202 for (const auto & [ref, t] : contextRefs) {
186203 if (!t.targetType .empty () && ref.empty ()) {
187204 // print error if context for specified target type was not found
188- ProjMgrLogger::Get ().Error (" mlops: no project-context specified for target '" +
205+ ProjMgrLogger::Get ().Error (" mlops: no image or project-context specified for target '" +
189206 t.targetType + (t.targetSet .empty () ? " " : ' @' + t.targetSet ) + " '" );
190207 return false ;
191208 }
@@ -198,8 +215,8 @@ bool ProjMgrMlops::CollectSettings(const CsolutionItem& csolution, MlopsType& ml
198215 ContextItem& hardwareContext = hardwareFound ? hardwareContexts.front () : emptyContext;
199216 ContextItem& simulatorContext = simulatorFound ? simulatorContexts.front () : emptyContext;
200217
201- // if hardware is not determined use first default context for processor type and access sequences
202- ContextItem& context = hardwareFound ? hardwareContext : contexts->begin ()-> second ;
218+ // if hardware is not determined use first selected context for processor type and access sequences
219+ ContextItem& context = hardwareFound ? hardwareContext : contexts->at (m_worker-> GetSelectedContexts (). front ()) ;
203220
204221 // mlops description
205222 mlops.description = solutionMlops.description ;
@@ -289,13 +306,17 @@ bool ProjMgrMlops::CollectSettings(const CsolutionItem& csolution, MlopsType& ml
289306 if (hardwareFound) {
290307 // set hardware run types
291308 const string outBaseDir = hardwareContext.directories .cprj + " /" + hardwareContext.directories .outBaseDir ;
292- SetMlopsRunType (mlops.hardware , hardwareType, hardwareTargetSet.set , hardwareContexts, outBaseDir, csolution.name );
309+ if (!SetMlopsRunType (mlops.hardware , hardwareType, hardwareTargetSet, hardwareContexts, outBaseDir, csolution.name )) {
310+ return false ;
311+ }
293312 }
294313
295314 if (simulatorFound) {
296315 // set simulator run types
297316 const string outBaseDir = simulatorContext.directories .cprj + " /" + simulatorContext.directories .outBaseDir ;
298- SetMlopsRunType (mlops.simulator , simulatorType, simulatorTargetSet.set , simulatorContexts, outBaseDir, csolution.name );
317+ if (!SetMlopsRunType (mlops.simulator , simulatorType, simulatorTargetSet, simulatorContexts, outBaseDir, csolution.name )) {
318+ return false ;
319+ }
299320
300321 // get debugger model and config-file
301322 mlops.simulator .model = GetCustomScalar (simulatorTargetSet.debugger .custom , " model" );
0 commit comments