femtoos_headers/femtoos_device.h

Go to the documentation of this file.
00001 /*
00002  * Femto OS v 0.91 - Copyright (C) 2008-2009 Ruud Vlaming
00003  *
00004  * This file is part of the Femto OS distribution.
00005  *
00006  * This program is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, version 3 of the License.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  *
00018  * Please note that, due to the GPLv3 license, for application of this
00019  * work and/or combined work in embedded systems special obligations apply.
00020  * If these are not to you liking, please know the Femto OS is dual
00021  * licensed. A commercial license and support are available.
00022  * See http://www.femtoos.org/ for details.
00023  */
00024 
00025 /* Port check, see a list of all possible devices at:
00026  * http://www.nongnu.org/avr-libc/user-manual/using_tools.html */
00027 
00028 #if defined(__AVR_ATmega128__)
00029 
00030   /* port is present and tested */
00031   #include "femtoos_ATmega128.asm"
00032 
00033 #elif defined(__AVR_ATmega1280__)
00034 
00035   /* port is present and tested */
00036   #include "femtoos_ATmega1280.asm"
00037 
00038 #elif defined(__AVR_ATmega1281__)
00039 
00040   /* port is present and tested */
00041   #include "femtoos_ATmega1281.asm"
00042 
00043 #elif defined(__AVR_ATmega1284P__)
00044 
00045   /* port is present but untested on the actual device. */
00046   #warning "Port for this device (ATmega1284P) is untested"
00047   #include "femtoos_ATmega1284P.asm"
00048 
00049 #elif defined(__AVR_ATmega16__)
00050 
00051   /* port is present and tested */
00052   #include "femtoos_ATmega16A.asm"
00053 
00054 #elif defined(__AVR_ATmega162__)
00055 
00056   /* port is present and tested */
00057   #include "femtoos_ATmega162.asm"
00058 
00059 #elif defined(__AVR_ATmega164P__)
00060 
00061   /* port is present and tested */
00062   #include "femtoos_ATmega164P.asm"
00063 
00064 #elif defined(__AVR_ATmega168__)
00065 
00066   /* port is present and tested */
00067   #include "femtoos_ATmega168.asm"
00068 
00069 #elif defined(__AVR_ATmega168P__)
00070 
00071   /* port is present and tested */
00072   #include "femtoos_ATmega168P.asm"
00073 
00074 #elif defined(__AVR_ATmega2560__)
00075 
00076   /* port is present and tested */
00077   #include "femtoos_ATmega2560.asm"
00078 
00079 #elif defined(__AVR_ATmega2561__)
00080 
00081   /* port is present and tested */
00082   #include "femtoos_ATmega2561.asm"
00083 
00084 #elif defined(__AVR_ATmega32__)
00085 
00086   /* port is present and tested */
00087   #include "femtoos_ATmega32A.asm"
00088 
00089 #elif defined(__AVR_ATmega324P__)
00090 
00091   /* port is present and tested */
00092   #include "femtoos_ATmega324P.asm"
00093 
00094 #elif defined(__AVR_ATmega325__)
00095 
00096   /* port is present and tested */
00097   #include "femtoos_ATmega325.asm"
00098 
00099 #elif defined(__AVR_ATmega3250__)
00100 
00101   /* port is present and tested */
00102   #include "femtoos_ATmega3250.asm"
00103 
00104 #elif defined(__AVR_ATmega325P__)
00105 
00106   /* port is present and tested */
00107   #include "femtoos_ATmega325P.asm"
00108 
00109 #elif defined(__AVR_ATmega3250P__)
00110 
00111   /* port is present and tested */
00112   #include "femtoos_ATmega3250P.asm"
00113 
00114 #elif defined(__AVR_ATmega328P__)
00115 
00116   /* port is present and tested */
00117   #include "femtoos_ATmega328P.asm"
00118 
00119 #elif defined(__AVR_ATmega48__)
00120 
00121   /* port is present and tested */
00122   #include "femtoos_ATmega48.asm"
00123 
00124 #elif defined(__AVR_ATmega48P__)
00125 
00126   /* port is present and tested */
00127   #include "femtoos_ATmega48P.asm"
00128 
00129 #elif defined(__AVR_ATmega64__)
00130 
00131   /* port is present and tested */
00132   #include "femtoos_ATmega64.asm"
00133 
00134 #elif defined(__AVR_ATmega645__)
00135 
00136   /* port is present and tested */
00137   #warning "Port for this device (ATmega645) is untested"
00138   #include "femtoos_ATmega645.asm"
00139 
00140 #elif defined(__AVR_ATmega6450__)
00141 
00142   /* port is present and tested */
00143   #warning "Port for this device (ATmega6450) is untested"
00144   #include "femtoos_ATmega6450.asm"
00145 
00146 #elif defined(__AVR_ATmega640__)
00147 
00148   /* port is present and tested */
00149   #include "femtoos_ATmega640.asm"
00150 
00151 #elif defined(__AVR_ATmega644__)
00152 
00153   /* port is present and tested */
00154   #include "femtoos_ATmega644.asm"
00155 
00156 #elif defined(__AVR_ATmega644P__)
00157 
00158   /* port is present and tested */
00159   #include "femtoos_ATmega644P.asm"
00160 
00161 #elif defined(__AVR_ATmega8__)
00162 
00163   /* port is present and tested */
00164   #include "femtoos_ATmega8.asm"
00165 
00166 #elif defined(__AVR_ATmega8515__)
00167 
00168   /* port is present and tested */
00169   #include "femtoos_ATmega8515.asm"
00170 
00171 #elif defined(__AVR_ATmega8535__)
00172 
00173   /* port is present and tested */
00174   #include "femtoos_ATmega8535.asm"
00175 
00176 #elif defined(__AVR_ATmega88__)
00177 
00178   /* port is present and tested */
00179   #include "femtoos_ATmega88.asm"
00180 
00181 #elif defined(__AVR_ATmega88P__)
00182 
00183   /* port is present and tested */
00184  #include "femtoos_ATmega88P.asm"
00185 
00186 #elif defined(__AVR_ATtiny2313__)
00187 
00188   /* port is present and tested */
00189   #include "femtoos_ATtiny2313.asm"
00190 
00191 #elif defined(__AVR_ATtiny24__)
00192 
00193   /* port is present and tested */
00194   #include "femtoos_ATtiny24.asm"
00195 
00196 #elif defined(__AVR_ATtiny25__)
00197 
00198   /* port is present and tested */
00199   #include "femtoos_ATtiny25.asm"
00200 
00201 #elif defined(__AVR_ATtiny261__)
00202 
00203   /* port is present and tested */
00204   #include "femtoos_ATtiny261.asm"
00205 
00206 #elif defined(__AVR_ATtiny43U__)
00207 
00208   /* port is present but untested on the actual device. */
00209   #warning "Port for this device (ATtiny43U) is untested"
00210   #include "femtoos_ATtiny43U.asm"
00211 
00212 #elif defined(__AVR_ATtiny44__)
00213 
00214   /* port is present and tested */
00215   #include "femtoos_ATtiny44.asm"
00216 
00217 #elif defined(__AVR_ATtiny45__)
00218 
00219   /* port is present and tested */
00220   #include "femtoos_ATtiny45.asm"
00221 
00222 #elif defined(__AVR_ATtiny461__)
00223 
00224   /* port is present and tested */
00225   #include "femtoos_ATtiny461.asm"
00226 
00227 #elif defined(__AVR_ATtiny48__)
00228 
00229   /* port is present and tested */
00230   #include "femtoos_ATtiny48.asm"
00231 
00232 #elif defined(__AVR_ATtiny84__)
00233 
00234   /* port is present and tested */
00235   #include "femtoos_ATtiny84.asm"
00236 
00237 #elif defined(__AVR_ATtiny85__)
00238 
00239   /* port is present and tested */
00240   #include "femtoos_ATtiny85.asm"
00241 
00242 #elif defined(__AVR_ATtiny861__)
00243 
00244   /* port is present and tested */
00245   #include "femtoos_ATtiny861.asm"
00246 
00247 #elif defined(__AVR_ATtiny88__)
00248 
00249   /* port is present and tested */
00250   #include "femtoos_ATtiny88.asm"
00251 
00252 #else
00253 
00254   /* ports are not present. */
00255   #error "Port for this device is absent"
00256 
00257 #endif
00258 
00259 
00266 #if defined(FEMTOOS_DEVICE_ASSEMBLY) && (defSysGCCstartup == cfgOverride)
00267 
00268   .global __init
00269   .global __do_clear_bss
00270   /* TODO some devices cannot handle the definition of a pseudo method
00271    * .global __do_copy_data, to suppress the one definned by gcc. I do
00272    * have a solution up to this moment, but we just take an other name.
00273    * Unfortunately this costs a lot of bytes. Maybe this is solved in
00274    * gcc 4.4 but we are not ready for that yet.  */
00275   .global __start_main
00276 
00277   .section .init0,"ax"
00278   __init:
00279     clr  r1
00280   __do_clear_bss:
00281   #if (devRAMbegin >= 0x100)
00282     ldi  r25, hi8(devRAMbegin)
00283   #endif
00284     ldi  r26, lo8(devRAMend)
00285     ldi  r27, hi8(devRAMend)
00286   __do_clear_bss_loop:
00287     st   -X, r1
00288     cpi  r26, lo8(devRAMbegin)
00289   #if (devRAMbegin >= 0x100)
00290     cpc  r27, r25
00291   #else
00292     cpc  r27, r1
00293   #endif
00294     brne __do_clear_bss_loop
00295   __do_stack_def:
00296     ldi  r26, lo8(xOS+(OSstackInit))
00297     out  (_SFR_IO_ADDR(SPL)), r26
00298   #if (devRAMend > 0x100)
00299     ldi  r27, hi8(xOS+(OSstackInit))
00300     out  (_SFR_IO_ADDR(SPH)), r27
00301   #endif
00302   __start_main:
00303   #if (devFLASHsize <= 0x1000U)
00304     rjmp    main
00305   #else
00306     jmp    main
00307   #endif
00308 /* TODO: gcc still dumps in some junk code here which can never
00309  * be executed. I don't know how to avoid this. the tip from Bjoern
00310  * http://www.mail-archive.com/avr-gcc-list@nongnu.org/msg02390.html
00311  * does not seem to work properly. */
00312 
00313 #endif

Generated on Fri Oct 16 00:05:21 2009 for FemtoOS by  doxygen 1.5.2