I am writing one AVR Mikrobasic Program which my Atmega32 flash memory is fulled.
Can I use EEPROM space for saving my functions routines instead of flash memory for releasing some space of flash memory?
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
From the Atmega328PB datasheet:
In order to maximize performance and parallelism, the AVR uses a Harvard architecture – with separate memories and buses for program and data. Instructions in the program memory are executed with a single level pipelining. While one instruction is being executed, the next instruction is pre-fetched from the program memory. This concept enables instructions to be executed in every clock cycle. The program memory is In-System Reprogrammable Flash memory.
Harvard architecture means, that instruction and data processing is separated within the CPU. From Wikipedia:
The Harvard architecture is a computer architecture with physically separate storage and signal pathways for instructions and data.
Another quote from the Atmel328P datasheet, section 11.1:
This section describes the different memory types in the device. The AVR architecture has two main memory spaces, the Data Memory and the Program Memory space. All memory spaces are linear and regular.
Take a look at this block diagram found in the Atmel328PB datasheet:
As you can see the flash memory and the instruction pipeline and the EEPROM are physically separated.
Aside: while running a program from memories other than flash is not possible, loading data from program memory is possible using the
LPM instruction found on some AVR platforms.
Reference from the datasheet:
Constant tables can be allocated within the entire program memory address space, using the Load Program Memory (LPM) instruction.