Chapter Four
Chapter Four
com
BIHE university
B.Sc(SE), 2023
By Mikru L
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Memory Management in Embedded Systems
In embedded systems, memory management is a crucial aspect of
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
5
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Types of RAM:
There are two important memory devices in the RAM family:
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
7
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Types of RAM:
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
8
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Types of ROM:
www. Micro Digital Ed. com ROM devices from hardwired to one-time programmable to BIHE university
erasable-and-programmable.
A common feature across all these devices is their ability to
retain data and programs forever, even during a power failure.
Masked ROM:
The contents of the ROM had to be specified before chip
production, so the actual data could be used to arrange the
transistors inside the chip!
Hardwired memories are still used, though they are now
called “masked ROMs” to distinguish them from other types
of ROM.
The main advantage of a masked ROM is its low production
cost.
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
9
Assembly and C Upper Saddle River, NJ 07458. • All Rights
PROM:
One step up from the masked ROM is the PROM
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
11
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Hybrid Types:
EEPROM:
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
12
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Flash Memory:
Flash memory is the most recent advancement in-memory
www. Micro Digital Ed. com
BIHE university
technology.
Flash memory devices are high density, low cost, nonvolatile, fast
(to read, but not to write), and electrically reprogrammable.
These advantages are overwhelming and the use of Flash memory
has increased dramatically in embedded systems.
From a software viewpoint, Flash and EEPROM technologies are
very similar.
The major difference is that Flash devices can be erased only one
sector at a time, not byte by byte.
Typical sector sizes are in the range of 256 bytes to 16 kilobytes.
Despite this disadvantage, Flash is much more popular than
EEPROM and is rapidly displacing many of the ROM devices as
well.
AVR Microcontroller and Embedded System Using
Assembly and C
© 2011 Pearson Higher Education,
13
Upper Saddle River, NJ 07458. • All Rights
NVRAM:
The third member of the hybrid memory class is
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
14
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Memory Device Characteristics:
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
15
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Working with Flash Memory
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
21
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Memory Allocation Map with Possible
www. Micro Digital Ed. com
Fragmentation BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
22
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Problems with Memory Compaction
www. Micro Digital Ed. com
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
25
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Finding Free Blocks Quickly
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
26
Assembly and C Upper Saddle River, NJ 07458. • All Rights
The malloc Operation
• Examine the heap to determine if a free block that is
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
27
Assembly and C Upper Saddle River, NJ 07458. • All Rights
The free Operation
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
29
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Fixed-Size Memory Management in Embedded Systems
www. Micro Digital Ed. com
BIHE university
Advantages
more deterministic than the heap method
algorithm (constant time)
provide high utilization for static embedded
applications
Disadvantages
This issue results in increased internal memory
fragmentation per allocation for embedded
applications that constantly operate in dynamic
environments
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
30
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Blocking vs. Non-Blocking Memory Functions
If tasks know that the memory congestion
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
31
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Blocking Allocation/Deallocation
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
32
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Memory Leak Detection
www. Micro Digital Ed. com
BIHE university
• A library
• Designed as a drop-in substitute for malloc,
realloc, calloc, free and other memory
management functions
• Keep track debug information about your
pointer
• Verify the debug information and logged on
errors.
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
35
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Hardware Design Challenges
High Power Dissipation: An embedded hardware system
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
37
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Software of Embedded System
Embedded System: Hardware and Software
www. Micro Digital Ed. com
BIHE university
Embedded software:
It is a program that controls the ES.
Program is a piece of code written to perform a
task means it is going to perform some action.
So its based on the time settings and the based
on the intervals So it's just a software
program.
It is a piece of code written to perform a task
so written speech specifically for the
particular hardware that is runs on so whatever
the hardware we have taken if you want to work
if you want to run that hardware we need
software is a program which controls all the
hardware's .
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
38
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Software of Embedded System
Embedded software example:
www. Micro Digital Ed. com
BIHE university
Hidden in watches
Cellular phones
VCS, toaster
Guide the missile
Control satellite, use in medical instrument
Software complexity:
8-bit microcontroller with just a few kilo
byte of memory
(controlling lighting in the home by using
remote or by chip)
complex embedded software(in aircrafts,
missile guidance
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
system, navigation system
39
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Embedded software design process
www. Micro Digital Ed. com
BIHE university
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
40
Assembly and C Upper Saddle River, NJ 07458. • All Rights
www. Micro Digital Ed. com
BIHE university
END of The
CHAPTER
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
41
Assembly and C Upper Saddle River, NJ 07458. • All Rights