blob: 3822cd1485dc066e2ecfc09a29a5d88b4bba7af6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
/***************************************************************************
* Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "pic30.h"
#include "devices/list/device_list.h"
#include "devices/base/device_group.h"
#include "pic30_compile.h"
#include "pic30_config.h"
#include "devices/pic/pic/pic_memory.h"
#include "common/global/process.h"
#include "pic30_generator.h"
//----------------------------------------------------------------------------
TQString PIC30::Base::baseExecutable(bool, Tool::OutputExecutableType type) const
{
TQString s = "pic30-";
if ( type==Tool::OutputExecutableType::Coff ) s += "coff";
else s += "elf";
s += "-";
switch (_category.type()) {
case Tool::Category::Compiler: return s + "gcc";
case Tool::Category::Assembler: return s + "as";
case Tool::Category::Linker: return s + "ld";
case Tool::Category::Librarian: return s + "ar";
case Tool::Category::BinToHex: return s + "bin2hex";
case Tool::Category::Nb_Types: break;
}
Q_ASSERT(false);
return TQString();
}
TQStringList PIC30::Base::checkExecutableOptions(bool) const
{
if ( _category!=Tool::Category::BinToHex ) return "--version";
return TQStringList();
}
bool PIC30::Base::checkExecutableResult(bool, TQStringList &lines) const
{
if ( lines.count()==0 ) return false;
lines[0] = lines[0].stripWhiteSpace();
switch (_category.type()) {
case Tool::Category::Compiler: return lines[0].startsWith("pic30");
case Tool::Category::Assembler: return lines[0].startsWith("GNU assembler");
case Tool::Category::Linker: return lines[0].startsWith("GNU ld");
case Tool::Category::BinToHex: return lines.join(" ").contains("Microchip ");
case Tool::Category::Librarian: return lines[0].startsWith("GNU ar");
case Tool::Category::Nb_Types: break;
}
Q_ASSERT(false);
return false;
}
//----------------------------------------------------------------------------
TQString PIC30::Group::informationText() const
{
return i18n("The <a href=\"%1\">PIC30 ToolChain</a> is a toolsuite for 16-bit PICs available from Microchip. Most of it is available under the GNU Public License.").arg("http://microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010065&part=SW006012");
}
Tool::Group::BaseData PIC30::Group::baseFactory(Tool::Category category) const
{
if ( category==Tool::Category::Compiler || category==Tool::Category::Assembler
|| category==Tool::Category::Linker || category==Tool::Category::BinToHex ) return BaseData(new ::PIC30::Base, Both);
if ( category==Tool::Category::Librarian ) return BaseData(new ::PIC30::Base, ProjectOnly);
return BaseData();
}
TQValueList<const Device::Data *> PIC30::Group::getSupportedDevices(const TQString &) const
{
TQValueList<const Device::Data *> list;
TQValueVector<TQString> devices = Device::lister().group("pic")->supportedDevices();
for (uint i=0; i<devices.count(); i++) {
const Device::Data *data = Device::lister().data(devices[i]);
if ( static_cast<const Pic::Data *>(data)->is16bitFamily() ) list.append(data);
}
return list;
}
Compile::Process *PIC30::Group::processFactory(const Compile::Data &data) const
{
switch (data.category.type()) {
case Tool::Category::Compiler:
if (data.project) return new PIC30::CompileProjectFile;
return new PIC30::CompileStandaloneFile;
case Tool::Category::Assembler:
if (data.project) return new PIC30::AssembleProjectFile;
return new PIC30::AssembleStandaloneFile;
case Tool::Category::Linker:
if (data.project) return new PIC30::LinkProject;
return new PIC30::LinkStandalone;
case Tool::Category::Librarian:
Q_ASSERT(data.project);
return new PIC30::LibraryProject;
case Tool::Category::BinToHex: return new PIC30::BinToHex;
case Tool::Category::Nb_Types: break;
}
Q_ASSERT(false);
return 0;
}
Compile::Config *PIC30::Group::configFactory(::Project *project) const
{
return new Config(project);
}
PURL::FileType PIC30::Group::implementationType(PURL::ToolType type) const
{
if ( type==PURL::ToolType::Assembler ) return PURL::AsmPIC30;
if ( type==PURL::ToolType::Compiler ) return PURL::CSource;
return PURL::Nb_FileTypes;
}
Tool::SourceGenerator *PIC30::Group::sourceGeneratorFactory() const
{
return new SourceGenerator;
}
PURL::Directory PIC30::Group::autodetectDirectory(Compile::DirectoryType type, const PURL::Directory &execDir, bool withWine) const
{
if ( !withWine ) return PURL::Directory();
PURL::Directory baseDir = execDir.up();
switch (type.type()) {
case Compile::DirectoryType::LinkerScript: return baseDir.down("support/gld");
case Compile::DirectoryType::Header: return baseDir.down("support/h");
case Compile::DirectoryType::Library: return baseDir.down("lib");
case Compile::DirectoryType::Executable:
case Compile::DirectoryType::Source:
case Compile::DirectoryType::Nb_Types: Q_ASSERT(false); break;
}
return PURL::Directory();
}
|