<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://sdcc.sourceforge.net/mediawiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://sdcc.sourceforge.net/mediawiki/index.php?title=Design_Document_for_AVR_Port&amp;feed=atom&amp;action=history</id>
		<title>Design Document for AVR Port - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://sdcc.sourceforge.net/mediawiki/index.php?title=Design_Document_for_AVR_Port&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://sdcc.sourceforge.net/mediawiki/index.php?title=Design_Document_for_AVR_Port&amp;action=history"/>
		<updated>2013-05-19T09:47:22Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://sdcc.sourceforge.net/mediawiki/index.php?title=Design_Document_for_AVR_Port&amp;diff=48&amp;oldid=prev</id>
		<title>Borutr: Created page with &quot;&lt;pre&gt; Design Document for AVR Port ----------------------------  The first release will support all AVR architectures except ATMega &amp; ATtiny (i.e. all variants with 64K or les...&quot;</title>
		<link rel="alternate" type="text/html" href="http://sdcc.sourceforge.net/mediawiki/index.php?title=Design_Document_for_AVR_Port&amp;diff=48&amp;oldid=prev"/>
				<updated>2012-12-04T16:23:47Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; Design Document for AVR Port ----------------------------  The first release will support all AVR architectures except ATMega &amp;amp; ATtiny (i.e. all variants with 64K or les...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
Design Document for AVR Port&lt;br /&gt;
----------------------------&lt;br /&gt;
&lt;br /&gt;
The first release will support all AVR architectures except ATMega &amp;amp; ATtiny&lt;br /&gt;
(i.e. all variants with 64K or less of code/data space will be supported)&lt;br /&gt;
&lt;br /&gt;
All functions will be REENTRANT .&lt;br /&gt;
&lt;br /&gt;
I) Language extensions.&lt;br /&gt;
-----------------------&lt;br /&gt;
&lt;br /&gt;
a) Storage classes&lt;br /&gt;
------------------&lt;br /&gt;
&lt;br /&gt;
&amp;quot;bit&amp;quot;   - not applicable (will be returned to user name space)&lt;br /&gt;
&amp;quot;data&amp;quot;  - not applicable (will be returned to user name space)&lt;br /&gt;
&amp;quot;idata&amp;quot; - not applicable (will be returned to user name space)&lt;br /&gt;
&amp;quot;xdata&amp;quot; - not applicable (will be returned to user name space)&lt;br /&gt;
&amp;quot;code&amp;quot;  - will place variable in &amp;quot;code&amp;quot; space. NOTE code space is NOT read-only.&lt;br /&gt;
&amp;quot;eeprom&amp;quot;- (new) will place the variable in eeprom (read &amp;amp; write)&lt;br /&gt;
&amp;quot;sram&amp;quot;  - (new) will place the variable in &amp;quot;SRAM&amp;quot; after the SFRs (default).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
b) register/sfr bit access.&lt;br /&gt;
--------------------------&lt;br /&gt;
Operator '.' will be overloaded ( the compiler will decide if it&lt;br /&gt;
is a structure access or register bit access depending on context)&lt;br /&gt;
eg.&lt;br /&gt;
&lt;br /&gt;
sfr SOME_SFR = 0x40;&lt;br /&gt;
sfr SOME_OTHER_SFR = 0x41;&lt;br /&gt;
foobar() &lt;br /&gt;
{&lt;br /&gt;
        ...&lt;br /&gt;
        SOME_SFR.4 = 1; // set bit 4 of sfr SOME_SFR&lt;br /&gt;
        ...&lt;br /&gt;
        SOME_SFR.5 = SOME_OTHER_SFR.6; // copy bit 6 of SOME_OTHER_SFR to SOME_SFR's bit 5.&lt;br /&gt;
        ...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
II) Pointers &lt;br /&gt;
------------&lt;br /&gt;
As mentioned above initial releases will NOT support ATMega. &lt;br /&gt;
&lt;br /&gt;
Keeping with the three byte pointers for generic pointers,&lt;br /&gt;
the compiler will treat unqualified pointers as 3 byte pointers, &lt;br /&gt;
the storage area will be saved in the upper nibble of the third byte &lt;br /&gt;
(this will facilitate later support for ATMega). Here we differ for &lt;br /&gt;
IAR (they seem to make copies of variables in code &amp;amp; other address &lt;br /&gt;
spaces into data space, seemed like a needless waste of data space).&lt;br /&gt;
&lt;br /&gt;
pointer declaration examples.&lt;br /&gt;
&lt;br /&gt;
char *cp;        /* generic three byte pointer */&lt;br /&gt;
code char *cp;   /* pointer to code space */&lt;br /&gt;
eeprom char *cp; /* pointer to data in eepromp */&lt;br /&gt;
sram char *cp;   /* pointer to data in SRAM space */&lt;br /&gt;
&lt;br /&gt;
III) Function calls&lt;br /&gt;
-------------------&lt;br /&gt;
The previous issue of function calls has been somewhat resolved.&lt;br /&gt;
SDCC will NOT support ATtiny &amp;amp; other variants (such as AT90S1200)&lt;br /&gt;
which have limited stack depth. It will however support variants&lt;br /&gt;
with 8 bit stack pointers.&lt;br /&gt;
&lt;br /&gt;
IV) Register Usage&lt;br /&gt;
------------------&lt;br /&gt;
&lt;br /&gt;
R0-R7      -  Parameter passing &amp;amp; return value (differs from IAR I don't&lt;br /&gt;
              like IAR's usage of R16-R23, specially since R0-R1 has&lt;br /&gt;
              to be kept free anyway for divide &amp;amp; multiply operations)&lt;br /&gt;
R8-R25     -  General purpose registers for local variables.&lt;br /&gt;
R28-R29(Y) -  Stack Frame (Same as IAR)&lt;br /&gt;
R26-R27(X) -  GPRs assigned to pointers (non generic pointers).&lt;br /&gt;
R30-R31(Z) -  GPRs assigned to pointers (non generic pointers).&lt;br /&gt;
&lt;br /&gt;
V) Parameter passing &amp;amp; return values&lt;br /&gt;
------------------------------------&lt;br /&gt;
Registers R0-R7 (eight) registers will be used for parameter passing.&lt;br /&gt;
Unlike the 8051 port the AVR port will pass the first eight bytes of&lt;br /&gt;
parameters in a registers (8051 passes only the first parameter in&lt;br /&gt;
registers), the exception being.. part of a parameter will not be put&lt;br /&gt;
into registers.&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
int foo (char a,long b);&lt;br /&gt;
    R0    &amp;lt;- a,&lt;br /&gt;
    R1-R4 &amp;lt;- b;&lt;br /&gt;
&lt;br /&gt;
int foo (long a, char b, long c)&lt;br /&gt;
    R0-R3   &amp;lt;- a,&lt;br /&gt;
    R4      &amp;lt;- b,&lt;br /&gt;
    (STACK) &amp;lt;- c;&lt;br /&gt;
&lt;br /&gt;
int foo (long a,long b)&lt;br /&gt;
    R0-R3   &amp;lt;- a,&lt;br /&gt;
    R4-R7   &amp;lt;- b;&lt;br /&gt;
&lt;br /&gt;
Return values will be placed in registers R0-R3;&lt;br /&gt;
&lt;br /&gt;
VI) Memory models&lt;br /&gt;
-----------------&lt;br /&gt;
The memory model will be used primarily to determine the &lt;br /&gt;
width of the stack pointer.&lt;br /&gt;
&lt;br /&gt;
--model-small - stack pointer 8 bit&lt;br /&gt;
--model-large - stack pointer 16 bit.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Borutr</name></author>	</entry>

	</feed>