Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tools/projmgr/include/ProjMgrParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ struct TargetType {
* cbuild directory,
* cprj directory,
* rte directory,
* output base directory
*/
struct DirectoriesItem {
std::string intdir;
Expand All @@ -260,6 +261,7 @@ struct DirectoriesItem {
std::string cbuild;
std::string cprj;
std::string rte;
std::string outBaseDir;
};

/**
Expand Down
1 change: 1 addition & 0 deletions tools/projmgr/include/ProjMgrRunDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ struct RunDebugType {
std::string solutionName;
std::string targetType;
std::string targetSet;
std::string cbuildRun;
std::string compiler;
std::string board;
std::string boardPack;
Expand Down
1 change: 1 addition & 0 deletions tools/projmgr/include/ProjMgrYamlEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class ProjMgrYamlEmitter {
ProjMgrParser* m_parser = nullptr;
ProjMgrWorker* m_worker = nullptr;
std::string m_outputDir;
std::string m_cbuildRun;
bool m_checkSchema;

bool WriteFile(YAML::Node& rootNode, const std::string& filename, const std::string& context = std::string(), bool allowUpdate = true);
Expand Down
1 change: 1 addition & 0 deletions tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@
"generated-by": { "type": "string", "description": "Tool name along with version information used to generate this file." },
"cdefault": { "type": "string", "description": "Path to cdefault.yml file." },
"csolution": { "type": "string", "description": "Path to csolution.yml file." },
"cbuild-run": { "type": "string", "description": "Path to cbuild-run.yml file." },
"tmpdir": { "type": "string", "description": "Specifies the directory for the interim temporary files." },
"cprojects": { "$ref": "#/definitions/BuildProjectsType" },
"cbuilds": { "$ref": "#/definitions/BuildContextsType" },
Expand Down
13 changes: 8 additions & 5 deletions tools/projmgr/src/ProjMgrCbuildIdx.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2024 Arm Limited. All rights reserved.
* Copyright (c) 2020-2025 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -18,16 +18,16 @@ class ProjMgrCbuildIdx : public ProjMgrCbuildBase {
public:
ProjMgrCbuildIdx(
YAML::Node node, const vector<ContextItem*>& processedContexts,
ProjMgrParser* parser, ProjMgrWorker* worker, const string& directory, const set<string>& failedContexts,
ProjMgrParser* parser, ProjMgrWorker* worker, const string& directory, const string& cbuildRun, const set<string>& failedContexts,
const map<string, ExecutesItem>& executes);
private:
void SetExecutesNode(YAML::Node node, const map<string, ExecutesItem>& executes, const string& base, const string& ref);
void SetVariablesNode(YAML::Node node, ProjMgrParser* parser, const ContextItem* context, const map<string, map<string, set<const ConnectItem*>>>& layerTypes);
};

ProjMgrCbuildIdx::ProjMgrCbuildIdx(YAML::Node node,
const vector<ContextItem*>& processedContexts, ProjMgrParser* parser, ProjMgrWorker* worker, const string& directory, const set<string>& failedContexts,
const map<string, ExecutesItem>& executes) : ProjMgrCbuildBase(false) {
const vector<ContextItem*>& processedContexts, ProjMgrParser* parser, ProjMgrWorker* worker, const string& directory, const string& cbuildRun,
const set<string>& failedContexts, const map<string, ExecutesItem>& executes) : ProjMgrCbuildBase(false) {
error_code ec;
SetNodeValue(node[YAML_GENERATED_BY], ORIGINAL_FILENAME + string(" version ") + VERSION_STRING);
if (processedContexts.size() > 0) {
Expand All @@ -37,6 +37,9 @@ ProjMgrCbuildIdx::ProjMgrCbuildIdx(YAML::Node node,
SetNodeValue(node[YAML_CDEFAULT], FormatPath(parser->GetCdefault().path, directory));
}
SetNodeValue(node[YAML_CSOLUTION], FormatPath(parser->GetCsolution().path, directory));
if (!cbuildRun.empty()) {
SetNodeValue(node[YAML_CBUILD_RUN], FormatPath(cbuildRun, directory));
}
SetNodeValue(node[YAML_OUTPUT_TMPDIR], FormatPath(parser->GetCsolution().directories.tmpdir, directory));

// Generate layer info for each target
Expand Down Expand Up @@ -269,7 +272,7 @@ bool ProjMgrYamlEmitter::GenerateCbuildIndex(const vector<ContextItem*>& context

YAML::Node rootNode;
ProjMgrCbuildIdx cbuild(
rootNode[YAML_BUILD_IDX], contexts, m_parser, m_worker, m_outputDir, failedContexts, executes);
rootNode[YAML_BUILD_IDX], contexts, m_parser, m_worker, m_outputDir, m_cbuildRun, failedContexts, executes);

// set rebuild flags
if (NeedRebuild(filename, rootNode)) {
Expand Down
10 changes: 6 additions & 4 deletions tools/projmgr/src/ProjMgrCbuildRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,11 @@ void ProjMgrCbuildRun::SetProcessorsNode(YAML::Node node, const vector<Processor
//-- ProjMgrYamlEmitter::GenerateCbuildRun --------------------------------------------------------
bool ProjMgrYamlEmitter::GenerateCbuildRun(const RunDebugType& debugRun) {
// generate cbuild-run.yml
const string& filename = m_outputDir + "/" + debugRun.solutionName + "+" +
debugRun.targetType + ".cbuild-run.yml";
m_cbuildRun = debugRun.cbuildRun;
RteFsUtils::NormalizePath(m_cbuildRun, m_outputDir);
const auto& cbuildRunDir = RteFsUtils::ParentPath(m_cbuildRun);

YAML::Node rootNode;
ProjMgrCbuildRun cbuildRun(rootNode[YAML_CBUILD_RUN], debugRun, m_outputDir);
return WriteFile(rootNode, filename);
ProjMgrCbuildRun cbuildRun(rootNode[YAML_CBUILD_RUN], debugRun, cbuildRunDir);
return WriteFile(rootNode, m_cbuildRun);
}
3 changes: 3 additions & 0 deletions tools/projmgr/src/ProjMgrRunDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ bool ProjMgrRunDebug::CollectSettings(const vector<ContextItem*>& contexts, cons
m_runDebug.solution = context0->csolution->path;
m_runDebug.targetType = context0->type.target;
m_runDebug.targetSet = context0->targetSet;
m_runDebug.cbuildRun = context0->directories.cprj + "/" + context0->directories.outBaseDir + "/" +
m_runDebug.solutionName + "+" + m_runDebug.targetType + ".cbuild-run.yml";

m_runDebug.compiler = context0->compiler;
if (!context0->device.empty()) {
m_runDebug.device = context0->deviceItem.vendor + "::" + context0->deviceItem.name;
Expand Down
35 changes: 28 additions & 7 deletions tools/projmgr/src/ProjMgrWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,14 @@ void ProjMgrWorker::AddContext(ContextDesc& descriptor, const TypePair& type, Co
context.precedences = false;

// default directories
context.directories.cprj = m_outputDir.empty() ? context.cproject->directory : m_outputDir;
context.directories.intdir = m_cbuild2cmake ? "tmp" :
"tmp/" + context.cproject->name + (type.target.empty() ? "" : "/" + type.target) + (type.build.empty() ? "" : "/" + type.build);
context.directories.outdir = "out/" + context.cproject->name + (type.target.empty() ? "" : "/" + type.target) + (type.build.empty() ? "" : "/" + type.build);
"tmp/" + context.cproject->name + (type.target.empty() ? "" : "/" + type.target) + (type.build.empty() ? "" : "/" + type.build);
context.directories.outBaseDir = "out";
context.directories.outdir = context.directories.outBaseDir +
"/" + context.cproject->name + (type.target.empty() ? "" : "/" + type.target) + (type.build.empty() ? "" : "/" + type.build);
context.directories.rte = "RTE";

// customized directories
if (m_outputDir.empty() && !context.csolution->directories.cprj.empty()) {
context.directories.cprj = context.csolution->directories.cprj;
}
if (!context.csolution->directories.intdir.empty()) {
if (m_cbuild2cmake) {
ProjMgrLogger::Get().Warn("customization of intermediate directory 'intdir' is ignored by the cbuild2cmake backend", context.name);
Expand All @@ -141,11 +139,32 @@ void ProjMgrWorker::AddContext(ContextDesc& descriptor, const TypePair& type, Co
}
if (!context.csolution->directories.outdir.empty()) {
context.directories.outdir = context.csolution->directories.outdir;
// https://github.com/Open-CMSIS-Pack/devtools/issues/2057
// specified in csolution.yml with output-dirs, but $Project$, $TargetType$, and $BuildType$ are replaced by empty strings
context.directories.outBaseDir = RteUtils::ExpandAccessSequences(context.csolution->directories.outdir, {
{ RteConstants::AS_PROJECT, RteUtils::EMPTY_STRING },
{ RteConstants::AS_BUILD_TYPE, RteUtils::EMPTY_STRING },
{ RteConstants::AS_TARGET_TYPE, RteUtils::EMPTY_STRING },
});
}
if (!context.cproject->rteBaseDir.empty()) {
context.directories.rte = context.cproject->rteBaseDir;
}

// cbuild.yml / legacy cprj directory
if (m_cbuild2cmake) {
// cprj = cbuild location (outdir)
context.directories.cprj = context.directories.outdir;
RteFsUtils::NormalizePath(context.directories.cprj, m_outputDir);
} else {
// legacy cprj location
context.directories.cprj = m_outputDir.empty() ?
!context.csolution->directories.cprj.empty() ?
context.csolution->directories.cprj : // custom cprj
context.cproject->directory : // cproject directory
m_outputDir; // --output command line option
}

// context variables
context.variables[RteConstants::AS_SOLUTION] = context.csolution->name;
context.variables[RteConstants::AS_PROJECT] = context.cproject->name;
Expand Down Expand Up @@ -3278,6 +3297,7 @@ bool ProjMgrWorker::ProcessSequencesRelatives(ContextItem & context, bool rerun)
}
if (!ProcessSequenceRelative(context, context.directories.rte, context.cproject->directory) ||
!ProcessSequenceRelative(context, context.directories.outdir, ref) ||
!ProcessSequenceRelative(context, context.directories.outBaseDir, ref) ||
!ProcessSequenceRelative(context, context.directories.intdir, ref)) {
return false;
}
Expand Down Expand Up @@ -4961,7 +4981,8 @@ bool ProjMgrWorker::GetExtGeneratorOptions(ContextItem& context, const string& l
if (options.path.empty()) {
// from global register
options.path = m_extGenerator->GetGlobalGenDir(options.id);
if (!ProcessSequenceRelative(context, options.path, layer.empty() ? context.cproject->directory : context.clayers.at(layer)->directory)) {
if (!options.path.empty() &&
!ProcessSequenceRelative(context, options.path, layer.empty() ? context.cproject->directory : context.clayers.at(layer)->directory)) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build:
generated-by: csolution version 0.0.0+g1057b313
solution: ../board.csolution.yml
project: single-core.cproject.yml
generated-by: csolution version 0.0.0
solution: ../../../../board.csolution.yml
project: ../../../../single/single-core.cproject.yml
context: single-core.Debug+Board
compiler: AC6
board: Keil::RteTest CM4 board:Rev.C
Expand All @@ -19,7 +19,7 @@ build:
- name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0553a/index.html
title: Cortex-M4 Device Generic Users Guide
dbgconf:
- file: ../.cmsis/board+Board.dbgconf
- file: ../../../../.cmsis/board+Board.dbgconf
version: 0.2.1
processor:
fpu: sp
Expand All @@ -40,21 +40,21 @@ build:
- ARMCM4_FP
- _RTE_
add-path:
- RTE/_Debug_Board
- generated/RTE/RteTest
- ../../../../single/RTE/_Debug_Board
- ../../../../single/generated/RTE/RteTest
- ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/GlobalLevel
- ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/Include
- ${CMSIS_PACK_ROOT}/ARM/RteTest_DFP/0.2.0/Device/ARM/ARMCM4/Include
add-path-asm:
- RTE/_Debug_Board
- generated/RTE/RteTest
- ../../../../single/RTE/_Debug_Board
- ../../../../single/generated/RTE/RteTest
- ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/GlobalLevel
- ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/Include
- ${CMSIS_PACK_ROOT}/ARM/RteTest_DFP/0.2.0/Device/ARM/ARMCM4/Include
output-dirs:
intdir: ../tmp
outdir: ../out/single-core/Board/Debug
rtedir: RTE
intdir: ../../../../tmp
outdir: .
rtedir: ../../../../single/RTE
output:
- type: elf
file: single-core.axf
Expand All @@ -75,11 +75,11 @@ build:
- file: ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/Include/Outside/OutsideInclude.h
category: header
version: 0.0.2
- file: generated/RTE/RteTest/Config/ConfigInclude.h
- file: ../../../../single/generated/RTE/RteTest/Config/ConfigInclude.h
category: header
attr: config
version: 0.0.2
- file: generated/RTE/RteTest/GlobalLevelConfig.h
- file: ../../../../single/generated/RTE/RteTest/GlobalLevelConfig.h
category: preIncludeGlobal
attr: config
version: 0.0.2
Expand All @@ -88,23 +88,23 @@ build:
selected-by: RteTestGenerator:Check Global Generator
generator:
id: RteTestExternalGenerator
path: generated/single-core.cgen.yml
path: ../../../../single/generated/single-core.cgen.yml
linker:
script: RTE/Device/RteTest_ARMCM4_FP/ac6_linker_script.sct.src
regions: RTE/Device/RteTest_ARMCM4_FP/regions_RteTest_CM4_board.h
script: ../../../../single/RTE/Device/RteTest_ARMCM4_FP/ac6_linker_script.sct.src
regions: ../../../../single/RTE/Device/RteTest_ARMCM4_FP/regions_RteTest_CM4_board.h
groups:
- group: sources
files:
- file: main.c
- file: ../../../../single/main.c
category: sourceC
- group: generated sources
files:
- file: generated/generated.c
- file: ../../../../single/generated/generated.c
category: sourceC
constructed-files:
- file: RTE/_Debug_Board/Pre_Include_Global.h
- file: ../../../../single/RTE/_Debug_Board/Pre_Include_Global.h
category: preIncludeGlobal
- file: RTE/_Debug_Board/RTE_Components.h
- file: ../../../../single/RTE/_Debug_Board/RTE_Components.h
category: header
licenses:
- license: <unknown>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build:
generated-by: csolution version 0.0.0+gf14e09a4
solution: ../extgen.csolution.yml
project: single-core.cproject.yml
generated-by: csolution version 0.0.0
solution: ../../../../extgen.csolution.yml
project: ../../../../single/single-core.cproject.yml
context: single-core.Debug+CM0
compiler: AC6
device: ARM::RteTestGen_ARMCM0
Expand All @@ -18,19 +18,19 @@ build:
define-asm:
- _RTE_
add-path:
- RTE/_Debug_CM0
- generated/RTE/RteTest
- ../../../../single/RTE/_Debug_CM0
- ../../../../single/generated/RTE/RteTest
- ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/GlobalLevel
- ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/Include
add-path-asm:
- RTE/_Debug_CM0
- generated/RTE/RteTest
- ../../../../single/RTE/_Debug_CM0
- ../../../../single/generated/RTE/RteTest
- ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/GlobalLevel
- ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/Include
output-dirs:
intdir: ../tmp
outdir: ../out/single-core/CM0/Debug
rtedir: RTE
intdir: ../../../../tmp
outdir: .
rtedir: ../../../../single/RTE
output:
- type: elf
file: single-core.axf
Expand All @@ -51,12 +51,12 @@ build:
- file: ${CMSIS_PACK_ROOT}/ARM/RteTest/0.1.0/Include/Outside/OutsideInclude.h
category: header
version: 0.0.2
- file: generated/RTE/RteTest/Config/ConfigInclude.h
- file: ../../../../single/generated/RTE/RteTest/Config/ConfigInclude.h
category: header
attr: config
version: 0.0.2
status: missing base
- file: generated/RTE/RteTest/GlobalLevelConfig.h
- file: ../../../../single/generated/RTE/RteTest/GlobalLevelConfig.h
category: preIncludeGlobal
attr: config
version: 0.0.2
Expand All @@ -65,23 +65,23 @@ build:
selected-by: RteTestGenerator:Check Global Generator
generator:
id: RteTestExternalGenerator
path: generated/single-core.cgen.yml
path: ../../../../single/generated/single-core.cgen.yml
linker:
script: RTE/Device/RteTestGen_ARMCM0/ac6_linker_script.sct.src
regions: RTE/Device/RteTestGen_ARMCM0/regions_RteTestGen_ARMCM0.h
script: ../../../../single/RTE/Device/RteTestGen_ARMCM0/ac6_linker_script.sct.src
regions: ../../../../single/RTE/Device/RteTestGen_ARMCM0/regions_RteTestGen_ARMCM0.h
groups:
- group: sources
files:
- file: main.c
- file: ../../../../single/main.c
category: sourceC
- group: generated sources
files:
- file: generated/generated.c
- file: ../../../../single/generated/generated.c
category: sourceC
constructed-files:
- file: RTE/_Debug_CM0/Pre_Include_Global.h
- file: ../../../../single/RTE/_Debug_CM0/Pre_Include_Global.h
category: preIncludeGlobal
- file: RTE/_Debug_CM0/RTE_Components.h
- file: ../../../../single/RTE/_Debug_CM0/RTE_Components.h
category: header
licenses:
- license: <unknown>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ build-idx:
- clayer: .
- clayer: config.clayer.yml
cbuilds:
- cbuild: config.CompatibleLayers+RteTest_ARMCM3.cbuild.yml
- cbuild: out/config/RteTest_ARMCM3/CompatibleLayers/config.CompatibleLayers+RteTest_ARMCM3.cbuild.yml
project: config
configuration: .CompatibleLayers+RteTest_ARMCM3
clayers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build-idx:
generated-by: csolution version 0.0.0+gd39b4a24
generated-by: csolution version 0.0.0
csolution: ../data/TestLayers/empty-layer.csolution.yml
tmpdir: tmp
cprojects:
Expand All @@ -8,7 +8,7 @@ build-idx:
- clayer: ../data/TestLayers
- clayer: ../data/TestLayers/$Board-Layer$
cbuilds:
- cbuild: empty-layer+RteTest_ARMCM3.cbuild.yml
- cbuild: out/empty-layer/RteTest_ARMCM3/empty-layer+RteTest_ARMCM3.cbuild.yml
project: empty-layer
configuration: +RteTest_ARMCM3
messages:
Expand Down
Loading
Loading