Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | Nächste ÜberarbeitungBeide Seiten der Revision |
software:deep:dev:crosscompiler:linker32 [2014-02-10 09:48] – graf | software:deep:dev:crosscompiler:linker32 [2014-02-10 10:31] – graf |
---|
| |
| |
===== Grösse und Offsets berechnen ===== | ===== Calculate Size and Offsets ===== |
[{{ .:linker_code_methods.png?300px&direct|Maschinencode: Grösse und Offsets}}] | [{{ .:linker_code_methods.png?350px&direct|Machine Code: Size and Offsets}}] |
Bevor die Memory Map fixiert werden kann, müssen noch ein paar Grössen und Offsets pro Standard-Klasse berechnet werden: | Before the memory map can be fixed, a couple sizes and offsets must be calculated for each class: |
* ''void calculateCodeSizeAndOffsets(Class)'': Diese Methode berechnet die Grösse des Maschinencodes für die gesamte Klasse und setzt das Feld ''offset'' jeder Methode dieser Klasse. Dieses beschreibt den Byte-Offset des Maschinencodes einer Methode im Speicher ausgehend von der Startaddresse des Codes der Klasse. Wenn der Offset einer Methode direkt von der Konfiguration vorgegeben ist (für Exception-Handler-Code) wird diese Methode nicht in die Berechnung der Codegrösse miteinbezogen. Der durch die Konfiguration vorgegebene Offset bezieht sich nicht auf die Basis einer Klasse, sondern auf die Basis des zugehörigen Segmentes. | * ''void calculateCodeSizeAndOffsets(Class)'': This methods determines the size of the machine code of the whole class and sets the field //offset// of each method of this class. //offset// is the byte offset of the machine code of a method in the memory starting from the start address of the code of this class. If a method offset is given by the configuration (e.g. exception handlers), then this method is not included in the culculation of the code size. The offset given by the configuration is not relative to the base of a class but to the base of the appropriate segment. |
* ''void calculateGlobalConstantTableSize()'': Berechnet die Grösse der globalen Konstanten-Tabelle. | * ''void calculateGlobalConstantTableSize()'': This method calculates the size of the global constant table. |
| |
===== Systemtabelle erstellen ===== | ===== Create System Table ===== |
Der Linker stellt für das gesamte System eine Systemtabelle zusammen. Diese muss an eine fixe Adresse geladen werden und enthält wichtige Informationen für das Laufzeitsystem. Grundsätzlich muss dabei zwischen drei Fällen unterschieden werden: | The linker assembles a system table for the whole system. This table must be loaded to a prefixed address in the target system and holds information for the [[..:rts:start|Runtime System]]. Various settings must be handled: |
- Das gesamte System befindet sich im Flash. | - The system runs from the flash |
- Das gesamte System befindet sich im Ram. | - The system runs from the RAM. |
- Das Basissystem befinden sich im Flash. Weitere Klassen werden nachträglich ins Ram geladen. Für diesen Fall werden zwei Systemtabellen benötigt. Im Flash befindet sich eine Systemtabelle, welche nur die Klassen im Flash abdeckt. Im RAM hingegen befindet sich eine Systemtabelle, die sowohl die Klassen im RAM als auch die im Flash abdeckt. -> IMPORTANT Dies ist zur Zeit noch nicht implementiert IMPORTANT | - The base system is in the flash. Further classes are later loaded into the RAM. This case needs two system tables. The flash holds a system table which contains only classes which are present in the flash. The system table in the RAM must hold all classes. IMPORTANT This feature is not implemented yet IMPORTANT |
\\ | \\ |
Die Methode ''void createSystemtable()'' erstellt die Systemtabelle. Diese ist als doppelt verkettete Liste realisiert und verwendet die selben von ''BlockEntry'' abgeleiteten Listenelemente wie die Konstantenblöcke der Klassen, zusätzlich noch die Klasse ''SysTabEntry''. Diese referenziert den Konstantenblock einer Klasse. | Die Methode ''void createSystemtable()'' erstellt die Systemtabelle. Diese ist als doppelt verkettete Liste realisiert und verwendet die selben von ''BlockEntry'' abgeleiteten Listenelemente wie die Konstantenblöcke der Klassen, zusätzlich noch die Klasse ''SysTabEntry''. Diese referenziert den Konstantenblock einer Klasse. |