* .version: bumped version number to 2.4.5
[fw/sdcc] / src / pic16 / NOTES
1 NOTES file for SDCC pic16 port
2 $Id$
3
4 Current pic16 port status is: Development
5
6 Some things may change without notification between port updates. The latest
7 CVS snapshot is guarenteed to compile without problems, but does not
8 guarantee backwards compatibility.
9
10 For any questions please ask the current port
11 developers.
12
13 Current developer:
14 Vangelis Rokas  <vrokas AT otenet.gr>
15
16 Other people to contact:
17 Scott Dattalo   <scott AT dattalo.com>
18
19 ======================================================================
20 ======================================================================
21 2004-Sep-27 Vangelis Rokas
22 1. Function parameters have been extended to cover functions with
23 variable arguments. Now function parameters follow the rules below:
24
25   a) void foo(long a, int b, char c)
26      void foo(long a, int b, char c) reentrant
27
28 Stack layout: c, b+1, b, a+3, a+2, a+1 and WREG = a
29
30   b) prototype: void foo(long a, int b, ...)
31
32         example: foo(0xaaffeedd, 0xbbcc, 0x4455, 0x7788);
33
34 Stack layout: 0x77, 0x88, 0x44, 0x55, 0xbb, 0xcc, 0xaa, 0xff, 0xee, 0xdd
35
36 WREG is not used in functions with variable arguments so that the address
37 of the first parameter can be taken.
38
39
40
41
42 2004-Sep-24 Vangelis Rokas
43 1. Began implementation of generic pointers, current specs are:
44         0x0 xxxxxxx -> code pointer
45         0x8 xxxxxxx -> data pointer
46         0x4 xxxxxxx -> eeprom pointer (currently unimplemented)
47
48
49 2004-Aug-30 Vangelis Rokas
50 1. A few months ago Hans Dorn had the idea to support general pointer
51 for accessing all code, eeprom data and data ram memory. These pointers
52 would have 3 bytes of size (24-bits), of which only the 21 lower bits
53 would be useful. The rest of them could be used to indicate the pointer
54 type. I.e.
55 0x4xxxxxxx would mean code pointer
56 0x8xxxxxxx would mean eeprom pointer
57 0xcxxxxxxx would mean data ram pointer
58
59 The implementatio of such pointers needs a lot of work and general
60 reform of pointer access, data initializing functions and the writing
61 of support functions for decoding their type.
62
63 The implementation of such pointers along with the implementation of
64 a more SDCC like stack access system will allow the writing of variable
65 arguments functions like printf etc... Also one set of functions will be
66 able to handle all data types without having to worry about where they
67 are placed.
68
69
70 2004-May-23 Vangelis Rokas
71
72 1. The improvement of the port has been stalled a bit. But, struct/union
73 SFR headers are ready for the PIC18F[45][45][28] chips along with their
74 respective sources.
75
76 2. The genCmp function should be rewritten from scratch.
77
78 3. The internal helper functions for char/int/long/float arithmetic
79 now compile and will be placed in the appropriate directory under device/
80
81
82
83 2004-Feb-20 Vangelis Rokas
84 Major update with many bugfixes.
85
86 1. The most of the pic16 regression tests (former pic regression tests) pass
87 successfully. Many thanks to Hans Dorn who did a great job with the
88 arithmetic, shift and pointer functions.
89
90 2. Bit fields now work properly.
91
92 3. Stack is permanently enabled. Command argument -pstack-enable is deleted
93 and no more recognized by the port.
94
95
96 2004-Feb-07 Vangelis Rokas
97
98 1. Fixed a bug so that compiler allocated internal registered, will
99 be shared along multiple sources via '.registers' section placed
100 in absolute data memory address 0x0000. Registers 0x00 to 0x7f are
101 considered as internal since they can be used for fast access.
102
103
104
105 2004-Jan-11 Vangelis Rokas
106
107 1. Compiling
108 The current release of the port can produce object code which is not
109 completely bug free. To use the new features the user should enable them via
110 command line arguments. A sane set of command arguments that I use to test
111 programs is:
112
113 - debug options
114         --debug         enable sdcc debug information
115         --debug-xtra    enable pic16 port debug information (most useful)
116         --debug-ralloc  enable register allocator debug messages
117         --pcode-verbose enable verbose pcode generator messages
118
119 - port options
120         --pno-banksel   disable banksel directives for the assembler
121         --pomit-config-words    does not emit configuration instruction in
122                         the translation This is useful when copmiling
123                         multiple sources, when you do not want multiple
124                         config instructions in the end file
125         --pomit-ivt     disables the dumping of the interrupt vector tables
126                         in the translation for the same reasons as above
127         --penable-stack enables stack support. This option uses stack to
128                         pass function arguments, and reuses registers between
129                         functions by saving the registers used in the function
130                         on the stack
131
132 - compiler options
133         --all-callee-saves      you may omit this options as the port
134                         enables it by default, all functions are currently
135                         compiled as reentrant and they are marked as
136                         callee-saves
137         --no-peep       peephole optimizer is better to be switched off,
138                         because it behaves strangely in some cases
139         --fommit-frame-pointer  this omits frame pointer in functions that
140                         don't use registers (maybe changed later, not
141                         important)
142
143
144 2. Functions
145 The current implementation puts every function in its own code section in
146 PIC's program memory. This may not be the standard, but I think its more
147 flexible.
148
149 3. Pragmas
150 Since SDCC is goind for a release, its better to document pragmas available.
151
152 3.1. code
153 The 'code' pragma emits a function's code at a specific address in program
154 memory. Currently it is only used for functions.
155 Syntax:
156 #pragma code [function_name] [address]
157
158 3.2. stack
159 The 'stack' pragma initializes the stack/frame pointer at an address of the
160 data ram other than the default (which is the end of the available data ram)
161 Synatx:
162 #pragma stack [address]
163
164 3.3. maxram
165 The 'maxram' pragma sets maximum data ram of the device. Currently is not
166 used at all, but it may be useful in the future when devices with external
167 memory will be supported.
168 Syntax:
169 #pragma maxram [max_address]
170
171
172 4. Internal compiler functions
173 Internal SDCC functions like, __fsmul, etc... are currently supported by the
174 port, but the libraries for the pic16 port are not yet ready. So one cannot
175 use long and float variables.
176
177
178 5. Special Function Registers (SFRs)
179 The processor SFRs are not anymore declared in any header file. The user can
180 define by himself all the needed SFR's. The code to that is:
181
182 sfr at [sfr_address] [sfr_name];
183
184 Where sfr_address is the SFR address in the data ram, and sfr_name is the
185 name of the SFR. i.e.:
186
187 sfr at 0xf80 PORTA;