summaryrefslogtreecommitdiffstats
path: root/src/tools/pic30/pic30.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
commitf508189682b6fba62e08feeb1596f682bad5fff9 (patch)
tree28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/tools/pic30/pic30.cpp
downloadpiklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz
piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/tools/pic30/pic30.cpp')
-rw-r--r--src/tools/pic30/pic30.cpp137
1 files changed, 137 insertions, 0 deletions
diff --git a/src/tools/pic30/pic30.cpp b/src/tools/pic30/pic30.cpp
new file mode 100644
index 0000000..45b9270
--- /dev/null
+++ b/src/tools/pic30/pic30.cpp
@@ -0,0 +1,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"
+
+//----------------------------------------------------------------------------
+QString PIC30::Base::baseExecutable(bool, Tool::OutputExecutableType type) const
+{
+ QString 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 QString::null;
+}
+
+QStringList PIC30::Base::checkExecutableOptions(bool) const
+{
+ if ( _category!=Tool::Category::BinToHex ) return "--version";
+ return QStringList();
+}
+
+bool PIC30::Base::checkExecutableResult(bool, QStringList &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;
+}
+
+//----------------------------------------------------------------------------
+QString 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();
+}
+
+QValueList<const Device::Data *> PIC30::Group::getSupportedDevices(const QString &) const
+{
+ QValueList<const Device::Data *> list;
+ QValueVector<QString> 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();
+}