# OS_Init

## Syntax

      #include <nitro/os.h>

      void OS_Init( void );

## Arguments

None.

## Return Values

None.

## Description

Initializes the system.

Specifically, the following actions are performed. Items with the NITRO logo ( ) show the behavior in NITRO mode, and items with the TWL logo ( ) show the behavior in TWL mode.

> ARM9
> Performs initialization for displaying necessary debug messages.( `OS_InitPrintServer`)
> Initializes the inter-processor communication system.( `PXI_Init`)
> Initializes the arena.( `OS_InitArena`)
> Initializes the lock system.(`OS_InitLock`)
> Makes initial settings for the extended main memory arena.( `OS_InitArenaEx`)
> Initializes the IRQ interrupt table.( `OS_InitIrqTable`)
> Embeds IRQ stack check data.( `OS_SetIrqStackChecker`)
> Initializes the exception display system.( `OS_InitException`)
> Performs MI-related initialization.( `MI_Init`)
> Initializes the V count alarm system.( `OS_InitVAlarm`)
> Initializes the VRAM exclusion system.( `OSi_InitVramExclusive`)
> Initializes the thread system.( `OS_InitThread`)
> Initializes the software reset system.(`OS_InitReset`)
> Initializes the cartridge library if other than TWL LIMITED.( `CTRDG_Init`)
> Initializes the card library.( `CARD_Init`)
> Initializes WRAM-A/B/C for TWL builds.( `MI_InitWramManager`)
> Initializes the system configuration if in TWL mode.( `SCFG_Init`)
> Initializes the power control system.( `PM_Init`)
> Waits for the V-Count to reach 0.
> Initializes application jump settings in TWL mode.( `OSi_InitPrevTitleId`)

> ARM7
> Initializes the inter-processor communication system.( `PXI_Init`)
> Initializes the arena.( `OS_InitArena`)
> Initializes the lock system.( `OS_InitLock`)
> Initializes the IRQ interrupt table.( `OS_InitIrqTable`)
> Initializes the exception display system.( `OS_InitException`)
> Initializes MI for TWL builds.( `MI_Init`)
> Initializes the check system.( `OS_InitTick`)
> Initializes the alarm system.( `OS_InitAlarm`)
> Initializes the thread system.( `OS_InitThread`)
> Initializes the reset system.( `OS_InitReset`)
> Initializes the cartridge library.( `CTRDG_Init`)
> Initializes WRAM-A/B/C for TWL builds.( `MI_InitWramManager`)
> Initializes the system configuration if in TWL mode.( `SCFG_Init`)

For both NITRO and TWL, after control has moved to the user `NitroMain` function, call the `OS_Init` function first. The functions called in `OS_Init` are required for proper behavior and cannot be used in a different order.

We have provided a way to reduce the memory footprint of the cartridge library when you know that it will not be used to access data. See the `CTRDG_Init` function.

Tick system initialization and alarm system initialization are not performed on the ARM9's `OS_Init` function. If necessary, call the `OS_InitTick` and `OS_InitAlarm` functions (in that order) after the `OS_Init` function.

## See Also

`OS_InitThread`
`OS_InitArena`
`OS_InitIrqTable`
`OS_InitTick`
`OS_InitVAlarm`
`OS_InitException`
`OS_InitLock`
`MI_Init`
`PM_Init`
`OS_InitReset`
`CTRDG_Init`
`CARD_Init`
`OS_InitTick`
`OS_InitAlarm`
`OS_SetIrqStackChecker`

## Revision History

2009/04/13 Removed the phrase "if necessary" as it related to ARM9 thread initialization. Added a note on decreasing the memory footprint with the `CTRDG_Init` function.
2008/07/11 Added descriptions regarding initialization in TWL mode.
2005/07/19 Added the `OS_SetIrqStackChecker` function.
2005/03/14 Fixed broken links.
2005/02/09 Added the `MI_Init` function and added a link to the `OS_InitLock` function.
2004/12/08 Explained that `OS_Init` is the first function that should be called.
2004/09/27 Added the `CARD_Init` function.
2004/09/15 Made revisions.
2004/08/09 Made revisions.
2004/02/19 Made revisions.
2003/12/24 Initial version.

CONFIDENTIAL