打印

IAR编译器,怎么知道HEAP和STACK的地址?

[复制链接]
4967|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
snakeemail|  楼主 | 2010-1-31 15:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
snakeemail|  楼主 | 2010-1-31 17:08 | 只看该作者
IAR的数据放在三个地方:1.局部变量放在stack, 2.static 和全局放在static memory中,3还有一个heap,用来放动态分配的变量。我是怎么跳过这3个区呢?
● On the stack. This is memory space that can be used by a function as long as it is
executing. When the function returns to its caller, the memory space is no longer
valid.
● Static memory. This kind of memory is allocated once and for all; it remains valid
through the entire execution of the application. Variables that are either global or
declared static are placed in this type of memory. The word static in this context
means that the amount of memory allocated for this type of variable does not
change while the application is running.
● On the heap. Once memory has been allocated on the heap, it remains valid until it
is explicitly released back to the system by the application. This type of memory is
useful when the number of objects is not known until the application executes. Note
that there are potential risks connected with using the heap in systems with a limited
amount of memory, or systems that are expected to run for a long time.

使用特权

评论回复
板凳
snakeemail|  楼主 | 2010-1-31 17:38 | 只看该作者
而且ATMEGA168的pdf说,stack是由最高的地址开始,即压入一个数据,stack指针是减小的。

使用特权

评论回复
地板
snakeemail|  楼主 | 2010-1-31 17:43 | 只看该作者
我现在干脆取巧,先搞一个全局数组unsigned char a[20],放入Memory_Init( a );

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:提供500W线性 交流电源。0~300VAC,45~500Hz 提供10KW,0-330V直流电源,具体见http://blog.21ic.com/user1/3639/archives/2012/88528.html

547

主题

1910

帖子

8

粉丝