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.
Data memory consists of :
- Rx space
- I/O Memory
- Extended I/O Memory (MCU dependent)
- Internal SRAM
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:
What do you think about this topic ? Send us feedback!