Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

Initialization
[* AVR]

Collaboration diagram for Initialization:


Detailed Description

Starting Nut/OS.


Defines

#define NUTMEM_END
 Last memory address without using external SRAM.

Functions

void main (void *)
 NutIdle (void *arg)
 AVR Idle thread.
void NutInitHeap ()
void NutCustomInit (void)
void NutInit (void)
 Nut/OS Initialization.


Define Documentation

#define NUTMEM_END
 

Last memory address without using external SRAM.

Todo:
Shall we support NUTRAMEND for backward compatibility? If, then let's do it in cfg/memory.h.


Function Documentation

void NutCustomInit void   ) 
 

NutCustomInit is a container function for hardware specific init code.

The hardware is selected with a PLATFORM macro definition.

Typically this function configures CPLDs, enables chips, overwrites NutInitXRAM's default wait state settings, sets the default baudrate for NUDEBUG as they depend on the crystal frequency used, etc.

NutIdle void *  arg  ) 
 

AVR Idle thread.

Running at priority 254 in an endless loop.

void NutInit void   ) 
 

Nut/OS Initialization.

Initializes the memory management and the thread system and starts an idle thread, which in turn initializes the timer management. Finally the application's main() function is called.

Depending on the compiler, different methods are used to execute this function before main() is called.

For ICCAVR the default crtatmega.o startup file is replaced by crtnut.o, which calls NutInit instead of main(). This is done by adding the following compiler options in the project:

 -ucrtnut.o nutinit.o 

crtnut.o should be replaced by crtnutram.o, if the application's variable space exceeds 4kB. For boards with RTL8019AS and EEPROM emulation (like Ethernut 1.3 Rev-G) use crtenut.o or crtenutram.o.

For AVRGCC this function is located in section .init8, which is called immediately before jumping to main(). NutInit is defined as:

 void NutInit(void) __attribute__ ((naked)) __attribute__ ((section (".init8")));

Todo:
Make heap threshold configurable, currently hardcoded at 384.

Make wait states for external memory access configuratble.

Make early UART initialization for kernel debugging configurable.


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/