<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2008 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>4.5.1 PIC Code Pages and Memory Banks</TITLE> <META NAME="description" CONTENT="4.5.1 PIC Code Pages and Memory Banks"> <META NAME="keywords" CONTENT="sdccman"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="sdccman.css"> <LINK REL="next" HREF="node112.html"> <LINK REL="previous" HREF="node110.html"> <LINK REL="up" HREF="node110.html"> <LINK REL="next" HREF="node112.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html2399" HREF="node112.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html2393" HREF="node110.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html2387" HREF="node110.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html2395" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html2397" HREF="node191.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html2400" HREF="node112.html">4.5.2 Adding New Devices</A> <B> Up:</B> <A NAME="tex2html2394" HREF="node110.html">4.5 The PIC14 port</A> <B> Previous:</B> <A NAME="tex2html2388" HREF="node110.html">4.5 The PIC14 port</A> <B> <A NAME="tex2html2396" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html2398" HREF="node191.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H2><A NAME="SECTION00551000000000000000"></A><A NAME="2951"></A><A NAME="2952"></A> <BR> 4.5.1 PIC Code Pages and Memory Banks </H2> <P> 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 assigns all <I>static</I> functions of a single .c file into the same code page. <BR> <BR> To get the best results, follow these guidelines: <OL> <LI>Make local functions static, as non static functions require code page selection overhead. <BR> Due to the way sdcc handles functions, place called functions prior to calling functions in the file wherever possible: Otherwise sdcc will insert unnecessary pagesel directives around the call, believing that the called function is externally defined. </LI> <LI>For devices that have multiple code pages it is more efficient to use the same number of files as pages: Use up to 4 separate .c files for the 16F877, but only 2 files for the 16F874. This way the linker can put the code for each file into different code pages and there will be less page selection overhead. </LI> <LI>And as for any 8 bit micro (especially for PIC14 as they have a very simple instruction set), use `unsigned char' wherever possible instead of `int'. </LI> </OL> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html2399" HREF="node112.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html2393" HREF="node110.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html2387" HREF="node110.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html2395" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html2397" HREF="node191.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html2400" HREF="node112.html">4.5.2 Adding New Devices</A> <B> Up:</B> <A NAME="tex2html2394" HREF="node110.html">4.5 The PIC14 port</A> <B> Previous:</B> <A NAME="tex2html2388" HREF="node110.html">4.5 The PIC14 port</A> <B> <A NAME="tex2html2396" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html2398" HREF="node191.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> 2011-03-20 </ADDRESS> </BODY> </HTML>