Next: 4.5.2 Creating a device
Up: 4.5 The PIC14 port
Previous: 4.5 The PIC14 port
Contents
Index
4.5.1 C code and 14bit PIC code page and RAM
banks
The linker organizes allocation for the code page and RAM banks. It
does not have intimate knowledge of the code flow. It will put all
the code section of a single asm file into a single code page. In
order to make use of multiple code pages, separate asm files must
be used. The compiler treats all functions of a single C file as being
in the same code page unless it is non static. The compiler treats
all local variables of a single C file as being in the same RAM bank
unless it is an extern.
To get the best follow these guide lines:
- make local functions static, as non static functions require code
page selection overhead.
- Make local variables static as extern variables require RAM bank selection
overhead.
- For devices that have multiple code pages it is more efficient to
use the same number of files as pages, i.e. for the 16F877 use 4 separate
files and i.e. for the 16F874 use 2 separate files. This way the linker
can put the code for each file into different code pages and the compiler
can allocate reusable variables more efficiently and there's less
page selection overhead. And as for any 8 bit micro (especially for
PIC 14 as they have a very simple instruction set) use 'unsigned char'
whereever possible instead of 'int'.
Next: 4.5.2 Creating a device
Up: 4.5 The PIC14 port
Previous: 4.5 The PIC14 port
Contents
Index
2007-12-15