2004-01-11 Vangelis Rokas <vrokas@otenet.gr>
[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@otenet.gr>
15
16 Other people to contact:
17 Scott Dattalo   <scott@dattalo.com>
18
19
20
21 2004-Jan-11 Vangelis Rokas
22
23 1. Compiling
24 The current release of the port can produce object code which is not
25 completely bug free. To use the new features the user should enable them via
26 command line arguments. A sane set of command arguments that I use to test
27 programs is:
28
29 - debug options
30         --debug         enable sdcc debug information
31         --debug-xtra    enable pic16 port debug information (most useful)
32         --debug-ralloc  enable register allocator debug messages
33         --pcode-verbose enable verbose pcode generator messages
34
35 - port options
36         --pgen-banksel  enable banksel directives for the assembler
37                         This will be turned on by default later, but left as
38                         is for now
39         --pomit-config-words    does not emit configuration instruction in
40                         the translation This is useful when copmiling
41                         multiple sources, when you do not want multiple
42                         config instructions in the end file
43         --pomit-ivt     disables the dumping of the interrupt vector tables
44                         in the translation for the same reasons as above
45         --penable-stack enables stack support. This option uses stack to
46                         pass function arguments, and reuses registers between
47                         functions by saving the registers used in the function
48                         on the stack
49
50 - compiler options
51         --all-callee-saves      you may omit this options as the port
52                         enables it by default, all functions are currently
53                         compiled as reentrant and they are marked as
54                         callee-saves
55         --no-peep       peephole optimizer is better to be switched off,
56                         because it behaves strangely in some cases
57         --fommit-frame-pointer  this omits frame pointer in functions that
58                         don't use registers (maybe changed later, not
59                         important)
60
61
62 2. Functions
63 The current implementation puts every function in its own code section in
64 PIC's program memory. This may not be the standard, but I think its more
65 flexible.
66
67 3. Pragmas
68 Since SDCC is goind for a release, its better to document pragmas available.
69
70 3.1. code
71 The 'code' pragma emits a function's code at a specific address in program
72 memory. Currently it is only used for functions.
73 Syntax:
74 #pragma code [function_name] [address]
75
76 3.2. stack
77 The 'stack' pragma initializes the stack/frame pointer at an address of the
78 data ram other than the default (which is the end of the available data ram)
79 Synatx:
80 #pragma stack [address]
81
82 3.3. maxram
83 The 'maxram' pragma sets maximum data ram of the device. Currently is not
84 used at all, but it may be useful in the future when devices with external
85 memory will be supported.
86 Syntax:
87 #pragma maxram [max_address]
88
89
90 4. Internal compiler functions
91 Internal SDCC functions like, __fsmul, etc... are currently supported by the
92 port, but the libraries for the pic16 port are not yet ready. So one cannot
93 use long and float variables.
94
95
96 5. Special Function Registers (SFRs)
97 The processor SFRs are not anymore declared in any header file. The user can
98 define by himself all the needed SFR's. The code to that is:
99
100 sfr at [sfr_address] [sfr_name];
101
102 Where sfr_address is the SFR address in the data ram, and sfr_name is the
103 name of the SFR. i.e.:
104
105 sfr at 0xf80 PORTA;