                         uC/OS-II, The Real-Time Kernel

                              Atmel AT90/AVR Port
			 	                  for AVR-GCC


                                 READ ME FILE

*******************************************************************************								 
Added by Don Carveth, January 2002.
Thanks to Jesper Hansen for getting this operational with GCC.

Comments added to Jesper Hansen's readme file to explain changes made.  Port
as provided is for the ATMEGA103 in single chip mode with an LED connected to
PD5.  I have been running this on an ATMEGA128 in 103 mode.

The 4K of RAM in the ATMEGA103 is suitable for a minimal RTOS.  uCOS-II uses a
little less than 2K leaving 2K for task stacks and user variables.  Task stacks
are nominally set at 256 bytes but can be less (there is a way of checking).  I
set them at 150 bytes in this program and it runs fine.  This means that you
can likely run between 7 and 12 tasks successfully.

If the program is running correctly then the LED should flash on and off once
second and the, if the UART is connected to Hyperterminal at 19200, uCOS stats
will be displayed on the terminal.The VT-102 output seems to go astray after 
a short while.  I suspect an improperly passed semaphore but I haven't bothered 
to debug the code.

I have found with uC/OS that getting the tick operational is the first hurdle.
Once thats working it works pretty well.  The code in step 5 below is to help
debug the tick ISR.

Changes made:

1.  Revised makefile and test.c for single chip mode rather than external
    memory.  I did not use the revised AVRMega103.x file provided.
2.  Added a RunLED task in test.c abd changed number of identical tasks.  Moved
    tick initiation (TCNT0 enable) lines into TaskStart.  Revised initiation
	values for TCCR0 and TIMSK to 07 and 01 respectively.  I expect original
	values were based on AT90S8515.
3.  Changed values in the os_cfg.h file as follows:
	#define OS_TASK_DEF_STK_SIZE    150    /* Default stack size
4.  Changed following line in os_cpu-a.asm based on 16 MHz xtl  
	LDI     R16,256-(16000000/50/1024)  ; Reload timer to overflow at a rate of 50Hz
	Added the following lines, but left them commented out (for testing):
;				SBIC	PIND,5						; If PORT D Pin 5 clear
;				CBI		PORTD,5
;				SBIS	PIND,5						; If PORT D Pin 5 set
;				SBI		PORTD,5

********************************************************************************

  						 
Acknowledgements:

Most files in this port is based on the  Atmel AVR port for the IAR compiler by
Ole Saether. Without his work, porting to avr-gcc would have taken much longer.


------------------------------- AVR C COMPILER --------------------------------

1) This version of the avr-gcc port is based on version 2.95.2 of avr-gcc.

   Versions of this can be found at :	

	http://8bit.at/avr/
	http://www.gwdg.de/~mrickma/avr/
	http://home.overta.ru/users/denisc/


2) It is assumed that the command line version of the GCC compiler is installed
   as described in the compiler documentation.


--------------------------------- AVR PORT NOTES ------------------------------

1) The port ZIP file should be unpacked, retaining the directory structure, into
   the "standard" UCOS-II directory :

   \SOFTWARE\uCOS-II\

   After unpacking, you should have the following sub-directories:

   \SOFTWARE\uCOS-II\AT-AVR\GCC\SOURCE
       This directory contains the port source files.  

   \SOFTWARE\uCOS-II\AT-AVR\GCC\TEST
       This directory contains the sample test code  (i.e. TEST.C),  as well as
       the makefile and BUILD.BAT  which is used to compile,  assemble and link 
       the test code.

   \SOFTWARE\uCOS-II\AT-AVR\GCC\OBJ
       This  directory  contains the  object files produced by the compiler and
       assembler.

   \SOFTWARE\uCOS-II\AT-AVR\GCC\LST
       This directory contains the 'listing' files produced by the compiler and
       the assembler.  For the C compiler, these files contain the  interleaved
       C source along with the assembly language code generated by the compiler.

   \SOFTWARE\uCOS-II\AT-AVR\GCC\DOC
       Contains  this readme file  and any other  documentation that comes with
       the port.


2) The SOURCE directory also contains two modified linker script files, one for
   the At90S8515 CPU  and one for the Atmega103 CPU.  These files  contains the
   necessary modifications to allow the .bss section to exist  in the  external
   RAM. They both assume a 32K RAM. If you have more or less, you should modify 
   these scripts.

3) The port supports both the At90S8515 and the Atmega103 CPU's.  The selection
   is done by commenting two lines in the makefile.Only the makefile and linker
   scripts should need to be changed for other CPU's.

4) TIMER0   overflow  interrupt  is  used  to  generate  the  clock  tick  (see
   OS_CPU_A.ASM).

5) The code was tested on a STK200 using an  AT90S8515  CPU. It was also tested
   on a mega103 CPU on a Opticompo board. I have not tried running the code  on
   the AVR Studio Simulator, as first attempts crashed AVR Studio (Ver.  3.22). 
   The  port should work equally well on the AT90S4414 device as long as enough 
   (external) RAM is  provided.

6) You will also need the source code for uC/OS-II to recompile  this port. The
   uC/OS-II source is included in Jean Labrosse's book  "MicroC/OS-II, The Real
   Time Kernel".More information about uC/OS-II can be found at www.ucos-ii.com 
   or www.micrium.com


----------------------------- REPORTING PROBLEMS ------------------------------

If you find a bug in this port, do  not  hesitate  to  report the problem to me
(Jesper Hansen):

1) Through e-mail: jesperh@telia.com

Make  sure  that the problem  you are reporting is in this port and not in your
application.

Enjoy!!


------------------------------ AVR RELEASE NOTES ------------------------------

April 2, 2001: V1.00
-----------------------

 1) First release of AVR port for AVR-GCC


