Gputils.Pdf (184K)
Total Page:16
File Type:pdf, Size:1020Kb
gputils 0.12.2 James Bowman and Craig Franklin July 13, 2004 Contents 1 Introduction 4 1.1 Tool Flows . 4 1.1.1 Absolute Asm Mode . 4 1.1.2 Relocatable Asm Mode . 4 1.1.3 HLL Mode . 5 1.1.4 Which Tool Flow is best? . 5 1.2 Supported processors . 5 2 gpal 7 2.1 Introduction . 7 2.2 Running gpal . 7 2.2.1 Operations . 8 2.2.2 Input files . 8 2.3 Basics . 8 2.3.1 Free-format . 8 2.3.2 Statement terminator . 9 2.3.3 Comments . 9 2.4 Types . 9 2.4.1 Builtin Types . 9 2.4.2 Arrays . 9 2.4.3 Enumerated . 10 2.4.4 Type Alias . 10 2.5 Expressions . 10 2.5.1 Symbols . 10 2.5.2 Symbol Alias . 10 2.5.3 Numbers . 11 2.5.4 Operators . 11 2.5.5 Assignment . 12 2.5.6 Test . 12 2.5.7 Label . 12 2.6 Statements . 12 2.6.1 Assembly . 12 2.6.2 Case . 12 2.6.3 For . 13 1 CONTENTS 2 2.6.4 Goto . 13 2.6.5 If . 14 2.6.6 Loop . 14 2.6.7 Null . 14 2.6.8 Pragma . 14 2.6.9 Return . 15 2.6.10 While . 15 2.7 Declarations . 15 2.7.1 Variables . 15 2.7.2 Constants . 16 2.8 Subprograms . 16 2.8.1 Procedure . 16 2.8.2 Function . 16 2.9 Files . 16 2.9.1 Module . 16 2.9.2 Public . 17 2.9.3 With . 17 2.10 Code Generation . 17 2.10.1 Phases . 17 2.10.2 Expression Evaluation . 18 2.10.3 COFF sections . 18 2.10.4 Name mangling . 18 2.11 Coding Suggestions . 18 2.11.1 Use uint8 types . 19 2.11.2 Keep data private . 19 2.11.3 Group related subprograms and data in one module . 19 2.11.4 Name COFF sections . 19 2.11.5 Don' t use absolute sections . 19 2.11.6 Use multiple module implementations . 19 3 gpasm 20 3.1 Running gpasm . 20 3.1.1 Using gpasm with “make” . 21 3.1.2 Dealing with errors . 22 3.2 Syntax . 22 3.2.1 File structure . 22 3.2.2 Expressions . 22 3.2.3 Numbers . 24 3.2.4 Preprocessor . 25 3.2.5 Processor header files . 25 3.3 Directives . 26 3.3.1 Code generation . 26 3.3.2 Configuration . 26 3.3.3 Conditional assembly . 26 3.3.4 Macros . 26 3.3.5 $ . 27 CONTENTS 3 3.3.6 Suggestions for structuring your code . 27 3.3.7 Directive summary . 28 3.4 Instructions . 37 3.4.1 Instruction set summary . 38 3.5 Errors/Warnings/Messages . 40 3.5.1 Errors . 41 3.5.2 Warnings . 42 3.5.3 Messages . 43 4 gplink 44 4.1 Running gplink . 44 4.2 gplink outputs . 44 4.3 Linker scripts . ..