diff --git a/tools/projmgr/src/ProjMgrRunDebug.cpp b/tools/projmgr/src/ProjMgrRunDebug.cpp index af2cdb2c8..33920d5b5 100644 --- a/tools/projmgr/src/ProjMgrRunDebug.cpp +++ b/tools/projmgr/src/ProjMgrRunDebug.cpp @@ -235,14 +235,26 @@ bool ProjMgrRunDebug::CollectSettings(const vector& contexts, cons if (item.type.empty()) { item.type = ProjMgrUtils::FileTypeFromExtension(item.image); } - if (item.load.empty()) { - // files with 'type: elf' get 'load: image+symbols' - // files with 'type: lib' get 'load: none' - // all other file types get 'load: image' - item.load = item.type == RteConstants::OUTPUT_TYPE_ELF ? LOAD_IMAGE_SYMBOLS : - item.type == RteConstants::OUTPUT_TYPE_LIB ? LOAD_NONE : LOAD_IMAGE; - } - m_runDebug.outputs.push_back({ item.image, item.info, item.type, item.load, item.offset, item.pname }); + bool merged = false; + for (auto& output : m_runDebug.outputs) { + if (output.file == item.image && output.type == item.type) { + // set load/offset of already inserted output with same image/type + output.load = item.load.empty() ? output.load : item.load; + output.offset = item.offset.empty() ? output.offset : item.offset; + merged = true; + break; + } + } + if (!merged) { + if (item.load.empty()) { + // files with 'type: elf' get 'load: image+symbols' + // files with 'type: lib' get 'load: none' + // all other file types get 'load: image' + item.load = item.type == RteConstants::OUTPUT_TYPE_ELF ? LOAD_IMAGE_SYMBOLS : + item.type == RteConstants::OUTPUT_TYPE_LIB ? LOAD_NONE : LOAD_IMAGE; + } + m_runDebug.outputs.push_back({ item.image, item.info, item.type, item.load, item.offset, item.pname }); + } } // debug vars diff --git a/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml b/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml index e85c899a6..181b7184c 100644 --- a/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml +++ b/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml @@ -12,15 +12,15 @@ cbuild-run: - file: run-debug/TestHW/run-debug.axf info: generate by run-debug+TestHW type: elf - load: symbols + load: none - file: run-debug/TestHW/run-debug.hex info: generate by run-debug+TestHW type: hex - load: image + load: none - file: run-debug/TestHW/run-debug.bin info: generate by run-debug+TestHW type: bin - load: none + load: image load-offset: 0x0000A000 - file: ../../data/TestRunDebug/customImage.bin info: load image info diff --git a/tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml b/tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml index 8349e2689..250e712b1 100644 --- a/tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml +++ b/tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml @@ -24,6 +24,9 @@ solution: dbgconf: RTE/Device/RteTest1/RteTest1.dbgconf images: - project-context: run-debug + load: none + - image: $bin(run-debug)$ + load: image load-offset: 0x0000A000 - image: customImage.bin info: load image info