Memory, Memory protection, Stack memory – Rainbow Electronics MAXQ613 User Manual
Page 13: Utility rom, Memory protection stack memory utility rom, Bit microcontroller with infrared module maxq613

16-Bit Microcontroller with Infrared Module
MAXQ613
______________________________________________________________________________________ 13
Memory
The microcontroller incorporates several memory types:
• 48KB program flash memory
• 1.5KB SRAM data memory
• 5.5KB utility ROM
• Soft stack
Memory Protection
The optional memory-protection feature separates code
memory into three areas: system, user loader, and user
application. Code in the system area can be kept con-
fidential. Code in the user areas can be prevented from
reading and writing system code. The user loader can
also be protected from user application code.
Memory protection is implemented using privilege levels
for code. Each area has an associated privilege level.
RAM/ROM are assigned privilege levels as well. Refer to
the MAXQ610 User’s Guide for a more thorough expla-
nation of the topic. See Table 1.
Stack Memory
The device provides a soft stack that can be used to
store program return addresses (for subroutine calls
and interrupt handling) and other general-purpose data.
This soft stack is located in the 1.5KB SRAM data
memory, which means that the SRAM data memory must
be shared between the soft stack and general-purpose
application data storage. However, the location and
size of the soft stack is determined by the user, provid-
ing maximum flexibility when allocating resources for a
particular application. The stack is used automatically
by the processor when the CALL, RET, and RETI instruc-
tions are executed and when an interrupt is serviced. An
application can also store and retrieve values explicitly
using the stack by means of the PUSH, POP, and POPI
instructions.
The SP pointer indicates the current top of the stack,
which initializes by default to the top of the SRAM data
memory. As values are pushed onto the stack, the SP
pointer decrements, which means that the stack grows
downward towards the bottom (lowest address) of the
data memory. Popping values off the stack causes the
SP pointer value to increase. Refer to the MAXQ610
User’s Guide for more details.
Utility ROM
The utility ROM is a 5.5KB block of internal ROM memory
located in program space beginning at address 8000h.
This ROM includes the following routines:
• In-system programming (bootstrap loader) using
JTAG interface
• In-circuit debugging routines using JTAG interface
• Production test routines (internal memory tests,
memory loader, etc.), which are used for internal
testing only, and are generally of no use to the end-
application developer
• User-callable routines for in-application flash program-
ming, buffer copying, and fast table lookup (more
information on these routines can be found in the
MAXQ610 User’s Guide)
Following any reset, execution begins in the utility ROM
at address 8000h. At this point, unless loader mode or
test mode has been invoked (which requires special pro-
gramming through the JTAG interface), the utility ROM in
the device always automatically jumps to location 0000h,
which is the beginning of user application code in pro-
gram flash memory.
Some applications require protection against unauthor-
ized viewing of program code memory. For these appli-
cations, access to in-system programming, in-applica-
tion programming, or in-circuit debugging functions is
prohibited until a password has been supplied. Three
Table 1. Memory Areas and Associated Maximum Privilege Levels
AREA
PAGE ADDRESS
MAXIMUM PRIVILEGE LEVEL
System
0 to ULDR-1
High
User Loader
ULDR to UAPP-1
Medium
User Application
UAPP to top
Low
Utility ROM
N/A
High
Other (RAM)
N/A
Low