📄 comman49.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher Professional Edition 6.0.5">
<meta name="TEMPLATEBASE" content="book_html">
<meta name="LASTUPDATED" content="12/04/03 16:07:46">
<title>heap</title>
<STYLE TYPE="text/css">
<!--
span.Signal { text-transform: uppercase; font-family: Verdana }
-->
</STYLE>
</head>
<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">
<p><img src="images/stlogo.gif" width="106" height="83" align="left"
alt="logo here!"> </p>
<table width="331" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="comman48.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="comman50.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="a_refmaa.htm"><img src="images/navidx.gif" width="84" height="23"
border="0" alt="INDEX"> </a></td>
</tr>
</table>
<p><br clear="all">
</p>
<hr align="left">
<blockquote>
<h2>
<a name="1206284"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">heap</font>
</h2><hr>
<p>
<a name="1267046"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Define the heap segment (and size)</font>
</p>
<h3>
<a name="1206286"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">Command type</font>
</h3>
<p>
<a name="1226929"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Code and data placement</font>
</p>
<h3>
<a name="1206288"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">Tool environment</font>
</h3>
<p>
<a name="1228029"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><strong>st20cc</strong></font>
</p>
<h3>
<a name="1206289"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">Synopsis</font>
</h3>
<a name="1206290"> </a><font size=2 face=Courier><strong>heap <font size=2 face=Courier><strong><em>segment_name</em></strong></font> [<font size=2 face=Courier><strong><em>length</em></strong></font>]<br></strong></font>
<h3>
<a name="1206291"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">Arguments</font>
</h3>
<p>
<a name="1224355"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><b><font size=2 face=Courier><strong><em>segment_name</em></strong></font></b></font>
<br>
<dl><dl> <dl>
<dt> <a name="1224357"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The name of the segment where the heap is to be placed</font>
</dl>
</dl></dl>
<p>
<a name="1224359"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><b><font size=2 face=Courier><strong><em>length</em></strong></font></b></font>
<br>
<dl><dl> <dl>
<dt> <a name="1224361"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The size of the heap in bytes, which must be a whole number of words, that is divisible by 4. It is also illegal to specify a size which is zero or negative (see below).</font>
</dl>
</dl></dl>
<h3>
<a name="1206296"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">Description</font>
</h3>
<p>
<a name="1206297"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The <font size=2 face=Courier><strong>heap</strong></font> command is used to define the segment where the heap is placed, and optionally the size of the heap. The heap is the area of memory that the C library function <font size=2 face=Courier><strong>malloc</strong></font> can use. The command takes the name of a memory segment where the heap is to be placed, plus an optional size.</font>
</p>
<p>
<a name="1242323"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The next available address within the specified segment is used as the start address, after all other sections have been placed.</font>
</p>
<p>
<a name="1206299"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The area allocated for heap also depends on whether the stack is allocated to the same memory segment. If the stack is allocated to the same memory segment as the heap then the following rules are used to determine the size of the stack and heap regions.</font>
</p>
<ul>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1206300"> </a>If both the <font size=2 face=Courier><strong>heap</strong></font> and <font size=2 face=Courier><strong>stack</strong></font> commands specify <font size=2 face=Courier><strong><em>length</em></strong></font> then they are each allocated an area of memory as specified.</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1206301"> </a>If either but only one of the <font size=2 face=Courier><strong>heap</strong></font> or <font size=2 face=Courier><strong>stack</strong></font> commands specify <font size=2 face=Courier><strong><em>length</em></strong></font> then the command which specified <font size=2 face=Courier><strong><em>length</em></strong></font> is allocated the specified area of memory, and the remaining unallocated memory is allocated to the other command.</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1206302"> </a>If both the <font size=2 face=Courier><strong>heap</strong></font> and <font size=2 face=Courier><strong>stack</strong></font> commands omit <font size=2 face=Courier><strong><em>length</em></strong></font> then the unallocated memory is divided equally between them.</font></p>
</ul>
<p>
<a name="1206303"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">If the heap command is not specified then a zero sized heap is assumed.</font>
</p>
<h3>
<a name="1206304"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">Examples</font>
</h3>
<a name="1206305"> </a><font size=2 face=Courier><strong><font size=2 face=Courier><strong>heap</strong></font> segment<br></strong></font>
<p>
<a name="1206306"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This example instructs <strong>st20cc</strong> to use the unallocated space at the end of <font size=2 face=Courier><strong>segment</strong></font> for the heap.</font>
</p>
<a name="1216373"> </a><font size=2 face=Courier><strong>heap mysegment 1024<br></strong></font>
<p>
<a name="1206309"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This example directs <strong>st20cc</strong> to place the heap in <font size=2 face=Courier><strong>mysegment</strong></font> and make it 1024燽ytes long.</font>
</p>
<a name="1216377"> </a><font size=2 face=Courier><strong>heap segment 1024<br>stack segment 512<br></strong></font>
<p>
<a name="1206312"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This example directs <strong>st20cc</strong> to:</font>
</p>
<ul>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1206313"> </a>place the heap in <font size=2 face=Courier><strong>segment</strong></font> and make it 1024燽ytes long,</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1206314"> </a>place the stack in <font size=2 face=Courier><strong>segment</strong></font> and make it 512燽ytes long.</font></p>
</ul>
<a name="1216384"> </a><font size=2 face=Courier><strong>heap segment 1024<br>stack segment<br></strong></font>
<p>
<a name="1206317"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This example directs <strong>st20cc</strong> to:</font>
</p>
<ul>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1206318"> </a>place the heap in <font size=2 face=Courier><strong>segment</strong></font> and make it 1024燽ytes long,</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1206319"> </a>place the stack in <font size=2 face=Courier><strong>segment</strong></font> and to allocate it the remaining memory in the segment above the heap.</font></p>
</ul>
<a name="1216388"> </a><font size=2 face=Courier><strong>heap segment <br>stack segment<br></strong></font>
<p>
<a name="1206322"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This example directs <strong>st20cc</strong> to divide the unallocated memory in <font size=2 face=Courier><strong>segment</strong></font> equally between the stack and the heap.</font>
</p>
<h3>
<a name="1206324"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">See also</font>
</h3>
<p>
<a name="1206328"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><a href="comman93.htm#1208395"><font color="#0000ff" face="Verdana, Arial, Helvetica, sans-serif"><i>stack</i></font></a></font>
</p>
</blockquote>
<hr>
<table width="331" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="comman48.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="comman50.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="a_refmaa.htm"><img src="images/navidx.gif" width="84" height="23"
border="0" alt="INDEX"> </a></td>
</tr>
</table>
<font size=1 face="Verdana, Arial, Helvetica, sans-serif"> © 2001, 2002, 2003 STMicroelectronics. All Rights Reserved.<br>
ADCS 7250966F</font>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -