Skip to content

Commit 4b1fa0e

Browse files
authored
[projmgr] Allow redefining load mode and load-offset of output images
1 parent 93ce883 commit 4b1fa0e

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

tools/projmgr/src/ProjMgrRunDebug.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,26 @@ bool ProjMgrRunDebug::CollectSettings(const vector<ContextItem*>& contexts, cons
235235
if (item.type.empty()) {
236236
item.type = ProjMgrUtils::FileTypeFromExtension(item.image);
237237
}
238-
if (item.load.empty()) {
239-
// files with 'type: elf' get 'load: image+symbols'
240-
// files with 'type: lib' get 'load: none'
241-
// all other file types get 'load: image'
242-
item.load = item.type == RteConstants::OUTPUT_TYPE_ELF ? LOAD_IMAGE_SYMBOLS :
243-
item.type == RteConstants::OUTPUT_TYPE_LIB ? LOAD_NONE : LOAD_IMAGE;
244-
}
245-
m_runDebug.outputs.push_back({ item.image, item.info, item.type, item.load, item.offset, item.pname });
238+
bool merged = false;
239+
for (auto& output : m_runDebug.outputs) {
240+
if (output.file == item.image && output.type == item.type) {
241+
// set load/offset of already inserted output with same image/type
242+
output.load = item.load.empty() ? output.load : item.load;
243+
output.offset = item.offset.empty() ? output.offset : item.offset;
244+
merged = true;
245+
break;
246+
}
247+
}
248+
if (!merged) {
249+
if (item.load.empty()) {
250+
// files with 'type: elf' get 'load: image+symbols'
251+
// files with 'type: lib' get 'load: none'
252+
// all other file types get 'load: image'
253+
item.load = item.type == RteConstants::OUTPUT_TYPE_ELF ? LOAD_IMAGE_SYMBOLS :
254+
item.type == RteConstants::OUTPUT_TYPE_LIB ? LOAD_NONE : LOAD_IMAGE;
255+
}
256+
m_runDebug.outputs.push_back({ item.image, item.info, item.type, item.load, item.offset, item.pname });
257+
}
246258
}
247259

248260
// debug vars

tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ cbuild-run:
1212
- file: run-debug/TestHW/run-debug.axf
1313
info: generate by run-debug+TestHW
1414
type: elf
15-
load: symbols
15+
load: none
1616
- file: run-debug/TestHW/run-debug.hex
1717
info: generate by run-debug+TestHW
1818
type: hex
19-
load: image
19+
load: none
2020
- file: run-debug/TestHW/run-debug.bin
2121
info: generate by run-debug+TestHW
2222
type: bin
23-
load: none
23+
load: image
2424
load-offset: 0x0000A000
2525
- file: ../../data/TestRunDebug/customImage.bin
2626
info: load image info

tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ solution:
2424
dbgconf: RTE/Device/RteTest1/RteTest1.dbgconf
2525
images:
2626
- project-context: run-debug
27+
load: none
28+
- image: $bin(run-debug)$
29+
load: image
2730
load-offset: 0x0000A000
2831
- image: customImage.bin
2932
info: load image info

0 commit comments

Comments
 (0)