Rev 7983 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7983 | leency | 1 | (* |
2 | BSD 2-Clause License |
||
3 | |||
4 | Copyright (c) 2019-2020, Anton Krotov |
||
5 | All rights reserved. |
||
6 | *) |
||
7 | |||
8 | MODULE TARGETS; |
||
9 | |||
10 | |||
11 | CONST |
||
12 | |||
13 | MSP430* = 0; |
||
14 | Win32C* = 1; |
||
15 | Win32GUI* = 2; |
||
16 | Win32DLL* = 3; |
||
17 | KolibriOS* = 4; |
||
18 | KolibriOSDLL* = 5; |
||
19 | Win64C* = 6; |
||
20 | Win64GUI* = 7; |
||
21 | Win64DLL* = 8; |
||
22 | Linux32* = 9; |
||
23 | Linux32SO* = 10; |
||
24 | Linux64* = 11; |
||
25 | Linux64SO* = 12; |
||
26 | STM32CM3* = 13; |
||
8097 | maxcodehac | 27 | RVM32I* = 14; |
7983 | leency | 28 | |
29 | cpuX86* = 0; cpuAMD64* = 1; cpuMSP430* = 2; cpuTHUMB* = 3; |
||
8097 | maxcodehac | 30 | cpuRVM32I* = 4; |
7983 | leency | 31 | |
32 | osNONE* = 0; osWIN32* = 1; osWIN64* = 2; |
||
33 | osLINUX32* = 3; osLINUX64* = 4; osKOS* = 5; |
||
34 | |||
8097 | maxcodehac | 35 | noDISPOSE = {MSP430, STM32CM3, RVM32I}; |
7983 | leency | 36 | |
8097 | maxcodehac | 37 | noRTL = {MSP430}; |
38 | |||
39 | |||
7983 | leency | 40 | TYPE |
41 | |||
42 | STRING = ARRAY 32 OF CHAR; |
||
43 | |||
44 | TARGET = RECORD |
||
45 | |||
8097 | maxcodehac | 46 | target, CPU, OS, RealSize: INTEGER; |
7983 | leency | 47 | ComLinePar*, LibDir, FileExt: STRING |
48 | |||
49 | END; |
||
50 | |||
51 | |||
52 | VAR |
||
53 | |||
8097 | maxcodehac | 54 | Targets*: ARRAY 15 OF TARGET; |
7983 | leency | 55 | |
8097 | maxcodehac | 56 | CPUs: ARRAY 5 OF |
57 | RECORD |
||
58 | BitDepth, InstrSize: INTEGER; |
||
59 | LittleEndian: BOOLEAN |
||
60 | END; |
||
61 | |||
62 | target*, CPU*, BitDepth*, OS*, RealSize*, WordSize*, AdrSize*, InstrSize*: INTEGER; |
||
7983 | leency | 63 | ComLinePar*, LibDir*, FileExt*: STRING; |
8097 | maxcodehac | 64 | Import*, Dispose*, RTL*, Dll*, LittleEndian*: BOOLEAN; |
7983 | leency | 65 | |
66 | |||
8097 | maxcodehac | 67 | PROCEDURE Enter (idx, CPU, RealSize, OS: INTEGER; ComLinePar, LibDir, FileExt: STRING); |
7983 | leency | 68 | BEGIN |
69 | Targets[idx].target := idx; |
||
70 | Targets[idx].CPU := CPU; |
||
71 | Targets[idx].RealSize := RealSize; |
||
72 | Targets[idx].OS := OS; |
||
73 | Targets[idx].ComLinePar := ComLinePar; |
||
74 | Targets[idx].LibDir := LibDir; |
||
75 | Targets[idx].FileExt := FileExt; |
||
76 | END Enter; |
||
77 | |||
78 | |||
79 | PROCEDURE Select* (ComLineParam: ARRAY OF CHAR): BOOLEAN; |
||
80 | VAR |
||
81 | i: INTEGER; |
||
82 | res: BOOLEAN; |
||
83 | |||
84 | BEGIN |
||
85 | i := 0; |
||
86 | WHILE (i < LEN(Targets)) & (Targets[i].ComLinePar # ComLineParam) DO |
||
87 | INC(i) |
||
88 | END; |
||
89 | |||
90 | res := i < LEN(Targets); |
||
91 | IF res THEN |
||
92 | target := Targets[i].target; |
||
93 | CPU := Targets[i].CPU; |
||
8097 | maxcodehac | 94 | BitDepth := CPUs[CPU].BitDepth; |
95 | InstrSize := CPUs[CPU].InstrSize; |
||
96 | LittleEndian := CPUs[CPU].LittleEndian; |
||
7983 | leency | 97 | RealSize := Targets[i].RealSize; |
98 | OS := Targets[i].OS; |
||
99 | ComLinePar := Targets[i].ComLinePar; |
||
100 | LibDir := Targets[i].LibDir; |
||
101 | FileExt := Targets[i].FileExt; |
||
102 | |||
103 | Import := OS IN {osWIN32, osWIN64, osKOS}; |
||
8097 | maxcodehac | 104 | Dispose := ~(target IN noDISPOSE); |
105 | RTL := ~(target IN noRTL); |
||
7983 | leency | 106 | Dll := target IN {Linux32SO, Linux64SO, Win32DLL, Win64DLL, KolibriOSDLL}; |
107 | WordSize := BitDepth DIV 8; |
||
108 | AdrSize := WordSize |
||
109 | END |
||
110 | |||
111 | RETURN res |
||
112 | END Select; |
||
113 | |||
114 | |||
8097 | maxcodehac | 115 | PROCEDURE EnterCPU (cpu, BitDepth, InstrSize: INTEGER; LittleEndian: BOOLEAN); |
7983 | leency | 116 | BEGIN |
8097 | maxcodehac | 117 | CPUs[cpu].BitDepth := BitDepth; |
118 | CPUs[cpu].InstrSize := InstrSize; |
||
119 | CPUs[cpu].LittleEndian := LittleEndian |
||
120 | END EnterCPU; |
||
121 | |||
122 | |||
123 | BEGIN |
||
124 | EnterCPU(cpuX86, 32, 1, TRUE); |
||
125 | EnterCPU(cpuAMD64, 64, 1, TRUE); |
||
126 | EnterCPU(cpuMSP430, 16, 2, TRUE); |
||
127 | EnterCPU(cpuTHUMB, 32, 2, TRUE); |
||
128 | EnterCPU(cpuRVM32I, 32, 4, TRUE); |
||
129 | |||
130 | Enter( MSP430, cpuMSP430, 0, osNONE, "msp430", "MSP430", ".hex"); |
||
131 | Enter( Win32C, cpuX86, 8, osWIN32, "win32con", "Windows32", ".exe"); |
||
132 | Enter( Win32GUI, cpuX86, 8, osWIN32, "win32gui", "Windows32", ".exe"); |
||
133 | Enter( Win32DLL, cpuX86, 8, osWIN32, "win32dll", "Windows32", ".dll"); |
||
134 | Enter( KolibriOS, cpuX86, 8, osKOS, "kosexe", "KolibriOS", ""); |
||
135 | Enter( KolibriOSDLL, cpuX86, 8, osKOS, "kosdll", "KolibriOS", ".obj"); |
||
136 | Enter( Win64C, cpuAMD64, 8, osWIN64, "win64con", "Windows64", ".exe"); |
||
137 | Enter( Win64GUI, cpuAMD64, 8, osWIN64, "win64gui", "Windows64", ".exe"); |
||
138 | Enter( Win64DLL, cpuAMD64, 8, osWIN64, "win64dll", "Windows64", ".dll"); |
||
139 | Enter( Linux32, cpuX86, 8, osLINUX32, "linux32exe", "Linux32", ""); |
||
140 | Enter( Linux32SO, cpuX86, 8, osLINUX32, "linux32so", "Linux32", ".so"); |
||
141 | Enter( Linux64, cpuAMD64, 8, osLINUX64, "linux64exe", "Linux64", ""); |
||
142 | Enter( Linux64SO, cpuAMD64, 8, osLINUX64, "linux64so", "Linux64", ".so"); |
||
143 | Enter( STM32CM3, cpuTHUMB, 4, osNONE, "stm32cm3", "STM32CM3", ".hex"); |
||
144 | Enter( RVM32I, cpuRVM32I, 4, osNONE, "rvm32i", "RVM32I", ".bin"); |
||
7983 | leency | 145 | END TARGETS.>> |