AVR Memory Organization

The AVR microcontroller's memory is divided into Program Memory and Data Memory. Program Memory (ROM) is used for permanent saving program being executed, while Data Memory (RAM) is used for temporarily storing and keeping intermediate results and variables.

Program Memory (ROM)

Program Memory (ROM) is used for permanent saving program (CODE) being executed, and it is divided into two sections, Boot Program section and the Application Program section. The size of these sections is configured by the BOOTSZ fuse. These two sections can have different level of protection since they have different sets of Lock bits.
Depending on the settings made in compiler, program memory may also used to store a constant variables. The AVR executes programs stored in program memory only. code memory type specifier is used to refer to program memory.

AVR Program Memory

Data Memory

Data memory consists of :

Rx space consists of 32 general purpose working 8-bit registers (R0-R31). These registers have the shortest (fastest) access time, which allows single-cycle Arithmetic Logic Unit (ALU) operation.
I/O Memory space contains addresses for CPU peripheral function, such as Control registers, SPI, and other I/O functions.
Due to the complexity, some AVR microcontrollers with more peripherals have Extended I/O memory, which occupies part of the internal SRAM. Extended I/O memory is MCU dependent.
Storing data in I/O and Extended I/O memory is handled by the compiler only. Users can not use this memory space for storing their data.
Internal SRAM (Data Memory) is used for temporarily storing and keeping intermediate results and variables (static link and dynamic link).

There are four memory type specifiers that can be used to refer to the data memory: rx, data, io and sfr.


AVR RAM Memory


Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code