Browse code

Add source code of the assembler compiler

Pawel Jablonski authored on 14/12/2022 19:04:16
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,70 @@
1
+/*
2
+ * Author: Pawel Jablonski
3
+ * E-mail: pj@xirx.net
4
+ * WWW: xirx.net
5
+ * GIT: git.xirx.net
6
+ *
7
+ * License: You can use this code however you like
8
+ * but leave information about the original author.
9
+ * Code is free for non-commercial and commercial use.
10
+ */
11
+
12
+#ifndef DATALIST_H
13
+#define DATALIST_H
14
+
15
+#include <QList>
16
+#include <QSharedPointer>
17
+
18
+#include "codesection.h"
19
+#include "ramitem.h"
20
+#include "flashitem.h"
21
+#include "data.h"
22
+
23
+/**
24
+ * This class contains all parsed data for each source file.
25
+ * It allows in a simply way to collect all external or global sections of code, RAM items and Flash items.
26
+ * It contains too a selection of which mode is used to compile the application.
27
+ */
28
+class DataList : public QList<QSharedPointer<Data>>
29
+{
30
+	public:
31
+		//! List of possible compile modes
32
+		enum class Mode
33
+		{
34
+			Rom, //!< Flash residing mode. Mostly for kernel. It generates *.map file.
35
+			App //!< RAM residing mode. Mostly for user applications. It can use *.map files.
36
+		};
37
+
38
+		DataList(Mode mode);
39
+
40
+		Mode getMode() const;
41
+
42
+		bool addExternalCodeSection(const QSharedPointer<CodeSection> &codeSection);
43
+		bool addExternalRamItem(const QSharedPointer<RamItem> &ramItem);
44
+		bool addExternalFlashItem(const QSharedPointer<FlashItem> &flashItem);
45
+
46
+		bool addGlobalCodeSection(const QSharedPointer<CodeSection> &codeSection);
47
+		bool addGlobalRamItem(const QSharedPointer<RamItem> &ramItem);
48
+		bool addGlobalFlashItem(const QSharedPointer<FlashItem> &flashItem);
49
+
50
+		QList<QSharedPointer<CodeSection>> &getExternalCodeSectionList();
51
+		QList<QSharedPointer<RamItem>> &getExternalRamItemList();
52
+		QList<QSharedPointer<FlashItem>> &getExternalFlashItemList();
53
+
54
+		QList<QSharedPointer<CodeSection>> &getGlobalCodeSectionList();
55
+		QList<QSharedPointer<RamItem>> &getGlobalRamItemList();
56
+		QList<QSharedPointer<FlashItem>> &getGlobalFlashItemList();
57
+
58
+	private:
59
+		Mode mode; //!< Which mode is used to compilation the code
60
+
61
+		QList<QSharedPointer<CodeSection>> externalCodeSectionList; //!< List of external code sections
62
+		QList<QSharedPointer<RamItem>> externalRamItemList; //!< List of external RAM items
63
+		QList<QSharedPointer<FlashItem>> externalFlashItemList; //!< List of external Flash items
64
+
65
+		QList<QSharedPointer<CodeSection>> globalCodeSectionList; //!< List of global code section
66
+		QList<QSharedPointer<RamItem>> globalRamItemList; //!< List of global RAM item
67
+		QList<QSharedPointer<FlashItem>> globalFlashItemList; //!< List of global Flash items
68
+};
69
+
70
+#endif