Skip to content

Commit f7a460d

Browse files
authored
Make changes in dbgconf location
1 parent 0ecaab7 commit f7a460d

File tree

79 files changed

+161
-325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+161
-325
lines changed

libs/rtemodel/include/RteDevice.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,15 @@ class RteDeviceDebugVars : public RteDeviceProperty
674674
*/
675675
bool IsConfig() const override { return true; }
676676

677+
/**
678+
* @brief construct full path including filename for a file that should be used when adding file to a project
679+
* @param target pointer to RteTarget object for which path needs to be calculated
680+
* @param instanceIndex file index for components with multiple instantiation (ignored for this override).
681+
* @param rteFolder the "RTE" folder path used for placing files (ignored for this override)
682+
* @return full project-relative path including filename and extension
683+
*/
684+
std::string GetInstancePathName(const RteTarget* target, int instanceIndex, const std::string& rteFolder) const override;
685+
677686

678687
protected:
679688
/**

libs/rtemodel/include/RteFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ class RteFile : public RteItem
192192

193193
/**
194194
* @brief construct full path including filename for a file that should be used when adding file to a project
195-
* @param deviceName name of device used in the project
195+
* @param target pointer to RteTarget object for which path needs to be calculated
196196
* @param instanceIndex file index for components with multiple instantiation.
197197
* Gets appended as a string to the base filename before extension it its value >=0.
198198
* Value of < 0 indicates that parent component can have only one instance
199199
* @param rteFolder the "RTE" folder path used for placing files
200200
* @return full project-relative path including filename and extension
201201
*/
202-
std::string GetInstancePathName(const std::string& deviceName, int instanceIndex, const std::string& rteFolder) const override;
202+
std::string GetInstancePathName(const RteTarget* target, int instanceIndex, const std::string& rteFolder) const override;
203203

204204
/**
205205
* @brief construct absolute include path string that can be used in'-I' compiler option.

libs/rtemodel/include/RteInstance.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,11 +1407,11 @@ class RteFileInstance : public RteItemInstance
14071407
/**
14081408
* @brief initialize the file instance
14091409
* @param f pointer to the original RteItem, represents RteFile or an item associated with a file
1410-
* @param deviceName device name used in the target
1410+
* @param target to obtain device name or expand sequences
14111411
* @param instanceIndex instance index, can be > 0 for multi-instance components
14121412
* @param rteFolder the "RTE" folder path used for placing files
14131413
*/
1414-
void Init(RteItem* f, const std::string& deviceName, int instanceIndex, const std::string& rteFolder);
1414+
void Init(RteItem* f, const RteTarget* target, int instanceIndex, const std::string& rteFolder);
14151415

14161416
/**
14171417
* @brief update file instance

libs/rtemodel/include/RteItem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,14 +532,14 @@ class RteItem : public XmlTreeItem<RteItem>
532532

533533
/**
534534
* @brief construct full path including filename for a file that should be used when adding file to a project
535-
* @param deviceName name of device used in the project
535+
* @param target pointer to RteTarget object for which path needs to be calculated
536536
* @param instanceIndex file index for components with multiple instantiation
537537
* Gets appended as a string to the base filename before extension if its value >= 0
538538
* Value of < 0 indicates that parent component can have only one instance
539539
* @param rteFolder the "RTE" folder path used for placing files
540540
* @return full project-relative path including filename and extension
541541
*/
542-
virtual std::string GetInstancePathName(const std::string& deviceName, int instanceIndex, const std::string& rteFolder) const;
542+
virtual std::string GetInstancePathName(const RteTarget* target, int instanceIndex, const std::string& rteFolder) const;
543543

544544
/**
545545
* @brief check if item provides data matching OS this code is built for: Linux, Windows or Mac OS

libs/rtemodel/src/RteDevice.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,23 @@ RteDeviceProperty* RteDeviceTrace::CreateProperty(const string& tag)
362362
return new RteDeviceProperty(this);
363363
}
364364

365+
///
366+
string RteDeviceDebugVars::GetInstancePathName(const RteTarget* target, int instanceIndex, const string& rteFolder) const
367+
{
368+
if(target) {
369+
auto solutionfile = target->GetModel()->GetRootFileName();
370+
auto solutionfileExt = RteUtils::ExtractFileExtension(solutionfile);
371+
if(solutionfileExt == "yml" || solutionfileExt == "yaml") {
372+
return target->ExpandAccessSequences("$SolutionDir()$/.cmsis/$Solution$+$TargetType$.dbgconf");
373+
} else {
374+
return RteItem::GetInstancePathName(target, instanceIndex, rteFolder);
375+
}
376+
}
377+
// return absolute path in pack repo
378+
return GetOriginalAbsolutePath();
379+
}
380+
381+
365382
/////////////////
366383
// Flash info
367384

libs/rtemodel/src/RteFile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void RteFile::GetAbsoluteSourcePaths(set<string>& paths) const
208208
}
209209

210210

211-
string RteFile::GetInstancePathName(const string& deviceName, int instanceIndex, const string& rteFolder) const
211+
string RteFile::GetInstancePathName(const RteTarget* target, int instanceIndex, const string& rteFolder) const
212212
{
213213
string pathName;
214214
RteComponent* c = GetComponent();
@@ -218,6 +218,7 @@ string RteFile::GetInstancePathName(const string& deviceName, int instanceIndex,
218218
bool bForcedCopy = IsForcedCopy();
219219
if (bConfig || bTemplate || bForcedCopy) {
220220
if (bConfig || bForcedCopy) {
221+
auto deviceName = target ? target->GetFullDeviceName() : EMPTY_STRING;
221222
// replace all ' ' with '_' in class name, the generated path should not contain spaces
222223
pathName += rteFolder + "/" + RteUtils::SpacesToUnderscore(c->GetCclassName()) + "/";
223224
if (!bForcedCopy && !deviceName.empty() && c->IsDeviceDependent()) {

libs/rtemodel/src/RteInstance.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,9 @@ RteFileInstance::RteFileInstance(RteItem* parent) :
659659
m_tag = "file";
660660
}
661661

662-
void RteFileInstance::Init(RteItem* f, const string& deviceName, int instanceIndex, const string& rteFolder)
662+
void RteFileInstance::Init(RteItem* f, const RteTarget* target, int instanceIndex, const string& rteFolder)
663663
{
664-
m_instanceName = f->GetInstancePathName(deviceName, instanceIndex, rteFolder);
664+
m_instanceName = f->GetInstancePathName(target, instanceIndex, rteFolder);
665665
m_instanceIndex = instanceIndex;
666666
m_fileName = RteUtils::ExtractFileName(m_instanceName);
667667
m_bRemoved = false;
@@ -901,15 +901,16 @@ string RteFileInstance::GetHeaderComment() const
901901

902902
string RteFileInstance::GetAbsolutePath() const
903903
{
904-
string s;
905-
if (IsConfig()) {
904+
if(IsConfig()) {
906905
RteProject* project = GetProject();
907-
if (project && !project->GetProjectPath().empty())
908-
s = project->GetProjectPath() + m_instanceName;
909-
} else {
910-
s = GetOriginalAbsolutePath();
906+
string projectPath = project ? project->GetProjectPath() : EMPTY_STRING;
907+
if(projectPath.empty() || !RteFsUtils::IsRelative(m_instanceName)) {
908+
return m_instanceName;
909+
} else {
910+
return project->GetProjectPath() + m_instanceName;
911+
}
911912
}
912-
return s;
913+
return GetOriginalAbsolutePath();
913914
}
914915

915916
RteItem* RteFileInstance::GetFile(const string& targetName) const

libs/rtemodel/src/RteItem.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,11 +842,12 @@ string RteItem::GetOriginalAbsolutePath(const string& name) const
842842
return RteFsUtils::MakePathCanonical(absPath);
843843
}
844844

845-
string RteItem::GetInstancePathName(const string& deviceName, int instanceIndex, const string& rteFolder) const
845+
string RteItem::GetInstancePathName(const RteTarget* target, int instanceIndex, const string& rteFolder) const
846846
{
847-
if(IsConfig()) {
847+
if(target && IsConfig()) {
848848
// construct RTE/Device/Dname/fileName.ext
849849
string pathName = rteFolder + "/";
850+
auto deviceName = target->GetFullDeviceName();
850851
if(!deviceName.empty() && IsDeviceDependent()) {
851852
pathName += "Device/";
852853
string device = WildCards::ToX(deviceName);

libs/rtemodel/src/RteProject.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,7 @@ RteFileInstance* RteProject::AddFileInstance(RteComponentInstance* ci, RteItem*
558558
if (!f || !f->IsConfig())
559559
return NULL;
560560

561-
string deviceName = target->GetFullDeviceName();
562-
string id = f->GetInstancePathName(deviceName, index, GetRteFolder(ci));
561+
string id = f->GetInstancePathName(target, index, GetRteFolder(ci));
563562
if(ci) {
564563
target->AddComponentInstanceForFile(id, ci);
565564
}
@@ -592,10 +591,9 @@ bool RteProject::UpdateFileToNewVersion(RteFileInstance* fi, RteItem* f, bool bM
592591

593592
void RteProject::InitFileInstance(RteFileInstance* fi, RteItem* f, int index, RteTarget* target, const string& savedVersion, const string& rteFolder)
594593
{
595-
string deviceName = target->GetFullDeviceName();
596594
const string& targetName = target->GetName();
597595

598-
fi->Init(f, deviceName, index, rteFolder);
596+
fi->Init(f, target, index, rteFolder);
599597
fi->Update(f, false);
600598
fi->AddTargetInfo(targetName); // set/update supported targets
601599
fi->SetRemoved(false);
@@ -1073,7 +1071,7 @@ void RteProject::UpdateRte() {
10731071
}
10741072
// add forced copy files
10751073
for(auto f : m_forcedFiles) {
1076-
string dst = GetProjectPath() + f->GetInstancePathName(EMPTY_STRING, 0, GetRteFolder());
1074+
string dst = GetProjectPath() + f->GetInstancePathName(nullptr, 0, GetRteFolder());
10771075
if(RteFsUtils::Exists(dst))
10781076
continue;
10791077
string src = f->GetOriginalAbsolutePath();

libs/rtemodel/src/RteTarget.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ void RteTarget::Clear()
103103
ClearFilteredComponents();
104104
ClearCollections();
105105
ClearMissingPacks();
106-
m_filteredModel->Clear();
106+
if(m_filteredModel) {
107+
m_filteredModel->Clear();
108+
}
107109
m_filterContext->Clear();
108110
m_dependencySolver->Clear();
109111
m_bTargetSupported = false;
@@ -131,7 +133,11 @@ std::string RteTarget::ExpandAccessSequences(const std::string& src) const
131133
const string& compiler = GetAttribute("Tcompiler");
132134
attributes.AddAttribute(RteConstants::AS_COMPILER, (compiler == "ARMCC") ? "AC6" : compiler);
133135
// target name as target type
134-
attributes.AddAttribute(RteConstants::AS_TARGET_TYPE, GetName());
136+
string targetType = RteUtils::GetSuffix(GetName(), '+');
137+
if(targetType.empty()) {
138+
targetType = GetName();
139+
}
140+
attributes.AddAttribute(RteConstants::AS_TARGET_TYPE, targetType);
135141
attributes.AddAttribute(RteConstants::AS_BUILD_TYPE, RteUtils::EMPTY_STRING);
136142

137143
// project and solution
@@ -140,10 +146,17 @@ std::string RteTarget::ExpandAccessSequences(const std::string& src) const
140146
attributes.AddAttribute(RteConstants::AS_PROJECT, projectName);
141147
string projectDir = RteUtils::RemoveTrailingBackslash(project->GetProjectPath());
142148

149+
string solutionName;
150+
string solutionDir;
143151
RteModel* globalModel = GetModel();
144-
string solutionDir = globalModel->GetRootFilePath(false); // solution filename
152+
solutionName = RteUtils::ExtractFileBaseName( // removes .csolution
153+
RteUtils::ExtractFileBaseName(globalModel->GetRootFileName()) // removes .yml
154+
);
155+
solutionDir = globalModel->GetRootFilePath(false);
156+
145157
if(solutionDir.empty()) {
146158
solutionDir = projectDir;
159+
solutionName = projectName;
147160
projectDir = ".";
148161
} else {
149162
projectDir = RteFsUtils::RelativePath(projectDir, solutionDir);
@@ -153,6 +166,7 @@ std::string RteTarget::ExpandAccessSequences(const std::string& src) const
153166
attributes.AddAttribute(RteConstants::AS_PROJECT_DIR_BR, projectDir);
154167
attributes.AddAttribute(RteConstants::AS_SOLUTION_DIR, solutionDir);
155168
attributes.AddAttribute(RteConstants::AS_SOLUTION_DIR_BR, solutionDir);
169+
attributes.AddAttribute(RteConstants::AS_SOLUTION, solutionName);
156170

157171
return RteUtils::ExpandAccessSequences(src, attributes.GetAttributes());
158172
}
@@ -752,15 +766,14 @@ void RteTarget::CollectComponentSettings(RteComponentInstance* ci)
752766
const set<RteFile*>& files = GetFilteredFiles(c);
753767
if (files.empty())
754768
return;
755-
string deviceName = GetFullDeviceName();
756769
const string& rteFolder = GetRteFolder(ci);
757770
for (auto itf = files.begin(); itf != files.end(); ++itf) {
758771
RteFile* f = *itf;
759772
if (!f)
760773
continue;
761774
if (f->IsConfig()) {
762775
for (int i = 0; i < count; i++) {
763-
string id = f->GetInstancePathName(deviceName, i, rteFolder);
776+
string id = f->GetInstancePathName(this, i, rteFolder);
764777
AddComponentInstanceForFile(id, ci);
765778
}
766779
continue;
@@ -1467,18 +1480,17 @@ RteItem* RteTarget::GetFile(const RteFileInstance* fi, RteComponent* c, const st
14671480
if(!fi) {
14681481
return nullptr;
14691482
}
1470-
const string& deviceName = GetFullDeviceName();
14711483
const string& instanceName = fi->GetInstanceName();
14721484
if(c) { // a component file
14731485
int index = fi->GetInstanceIndex();
14741486
for(auto f : GetFilteredFiles(c)) {
1475-
if(f && f->GetInstancePathName(deviceName, index, rteFolder) == instanceName) {
1487+
if(f && f->GetInstancePathName(this, index, rteFolder) == instanceName) {
14761488
return f;
14771489
}
14781490
}
14791491
} else {
14801492
auto debugVars = GetDeviceDebugVars();
1481-
if(debugVars && debugVars->GetInstancePathName(deviceName, 0, rteFolder) == instanceName) {
1493+
if(debugVars && debugVars->GetInstancePathName(this, 0, rteFolder) == instanceName) {
14821494
return debugVars;
14831495
}
14841496
}

0 commit comments

Comments
 (0)