summaryrefslogtreecommitdiffstats
path: root/src/tools/pic30/pic30_compile.cpp
blob: 02cbb35197fc904313fb3d4e6306c7089dbc79e1 (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/***************************************************************************
 *   Copyright (C) 2006-2007 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_compile.h"

#include "config.h"
#include "pic30_config.h"
#include "devices/list/device_list.h"

//-----------------------------------------------------------------------------
QStringList PIC30::CompileFile::genericArguments(const Compile::Config &config) const
{
  QStringList args;
  args += "-S"; // compile only
  args += "$NO_AUTO_DEVICE(-mcpu=%DEVICE)";
  args += config.includeDirs(Tool::Category::Compiler, "-I");
  PURL::Directory purl = Compile::Config::directory(group(), Compile::DirectoryType::Header);
  if ( !purl.isEmpty() ) args += "-I" + purl.path();
  args += config.customOptions(Tool::Category::Compiler);
  return args;
}

QString PIC30::CompileFile::outputFiles() const
{
  return "PURL::AsmPIC30";
}

void PIC30::CompileFile::logStderrLine(const QString &line)
{
  // #### TODO
  doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
}

//-----------------------------------------------------------------------------
QStringList PIC30::CompileStandaloneFile::genericArguments(const Compile::Config &config) const
{
  QStringList args = CompileFile::genericArguments(config);
  args += "%I";
  return args;
}

QString PIC30::CompileStandaloneFile::outputFiles() const
{
  return CompileFile::outputFiles() + " PURL::Object PURL::Elf";
}

//-----------------------------------------------------------------------------
QStringList PIC30::CompileProjectFile::genericArguments(const Compile::Config &config) const
{
  QStringList args = CompileFile::genericArguments(config);
  args += "-g";
  args += "%I";
  return args;
}

//-----------------------------------------------------------------------------
QStringList PIC30::AssembleFile::genericArguments(const Compile::Config &config) const
{
  QStringList args;
  args += "-g";
  args += "-a=%LIST"; // listing
  args += "-o%O";
  args += config.includeDirs(Tool::Category::Assembler, "-I");
  args += config.customOptions(Tool::Category::Assembler);
  return args;
}

QString PIC30::AssembleFile::outputFiles() const
{
  return "PURL::Object PURL::Lst";
}

void PIC30::AssembleFile::logStderrLine(const QString &line)
{
  // #### TODO
  doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
}

//-----------------------------------------------------------------------------
QStringList PIC30::AssembleStandaloneFile::genericArguments(const Compile::Config &config) const
{
  QStringList args = AssembleFile::genericArguments(config);
  args += "$NO_AUTO_DEVICE(-p%DEVICE)";
  args += "%I";
  return args;
}

//-----------------------------------------------------------------------------
QStringList PIC30::AssembleProjectFile::genericArguments(const Compile::Config &config) const
{
  QStringList args = AssembleFile::genericArguments(config);
  if ( !_data.items[0].generated ) args += "-p%DEVICE";
  args += "%I";
  return args;
}

//-----------------------------------------------------------------------------
QString PIC30::Link::outputFilepath() const
{
  PURL::FileType type = Compile::Config::outputExecutableType(group()).data().type;
  return filepath(type);
}

QStringList PIC30::Link::genericArguments(const Compile::Config &config) const
{
  QStringList args;
  args += "-Map";
  args += "%MAP";
  args += "-o%O";
  args += config.includeDirs(Tool::Category::Linker, "-L");
  PURL::Directory purl = Compile::Config::directory(group(), Compile::DirectoryType::Library);
  if ( !purl.isEmpty() ) args += "-L" + purl.path();
  args += "$LKR(-T%LKR)";
  args += config.customOptions(Tool::Category::Linker);
  args += "%OBJS";
  return args;
}

QString PIC30::Link::outputFiles() const
{
  PURL::FileType type = Compile::Config::outputExecutableType(group()).data().type;
  return QString("PURL::Map PURL::") + type.key();
}

void PIC30::Link::logStderrLine(const QString &line)
{
  // #### TODO
  doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
}

//-----------------------------------------------------------------------------
QStringList PIC30::LinkStandalone::genericArguments(const Compile::Config &config) const
{
  QStringList args = Link::genericArguments(config);
  args += config.customLibraries(Tool::Category::Linker);
  return args;
}

//-----------------------------------------------------------------------------
QStringList PIC30::LinkProject::genericArguments(const Compile::Config &config) const
{
  QStringList args = Link::genericArguments(config);
  args += "%LIBS";
  args += config.customLibraries(Tool::Category::Linker);
  return args;
}

//-----------------------------------------------------------------------------
QStringList PIC30::LibraryProject::genericArguments(const Compile::Config &) const
{
  QStringList args;
  args += "-rc"; // insert new + do not warn if creating library
  args += "%O";
  args += "%LIBS";
  args += "%OBJS";
  return args;
}

void PIC30::LibraryProject::logStderrLine(const QString &line)
{
  // #### TODO
  doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
}

QString PIC30::LibraryProject::outputFiles() const
{
  return "PURL::Library";
}

//-----------------------------------------------------------------------------
QString PIC30::BinToHex::inputFilepath(uint) const
{
  PURL::FileType type = Compile::Config::outputExecutableType(group()).data().type;
  return filepath(type);
}

QStringList PIC30::BinToHex::genericArguments(const Compile::Config &) const
{
  return "%I";
}

QString PIC30::BinToHex::outputFiles() const
{
  return "PURL::Hex";
}

void PIC30::BinToHex::logStderrLine(const QString &line)
{
  // #### TODO
  doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
}