搜索
bottom↓
回复: 4

ICCAVR compiler option里面 Return Stack Size到底是如何作用的?

[复制链接]

出0入0汤圆

发表于 2005-3-10 15:03:40 | 显示全部楼层 |阅读模式
能否给个解释~~

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

发表于 2005-3-10 16:25:57 | 显示全部楼层
设定堆栈的大小,一般为16,但是如果递归调用或者是嵌套很深或者使用了printf这类大型函数就设置成更多,例如32。我写bootload就设置成24

出0入0汤圆

 楼主| 发表于 2005-3-10 16:27:14 | 显示全部楼层
恩~

出0入0汤圆

发表于 2012-9-3 15:11:32 | 显示全部楼层
怎么有人说是硬件堆栈的深度。

出0入0汤圆

发表于 2013-12-4 16:32:18 | 显示全部楼层
本帖最后由 crazydtone 于 2013-12-4 16:34 编辑

Return Stack Size-

the compiler uses two stacks, one for the return
addresses for the function calls and interrupt handler (known as the hardware stack), and one for parameter passing and local storage (known as the software stack). This option allows you to control the size of the return stack. The size of the software stack does not need to be specified. See Stacks.Each function call or interrupt handler uses two bytes of the return stack and 3 bytes if the CPU is a M256x. Therefore, you need to estimate the deepest level of your call trees (i.e. the maximum number of nested routines your program may call, possibly any interrupts), and enter the appropriate size here. Programs using floating points or longs should specify a hardware stack size of at least 30 bytes. However, in most cases, a hardware stack size of maximum 50 bytes should be sufficient. Since the hardware stack uses SRAM, if you specify a stack that is too large, the stack may overflow into the global variables or the software stack and Bad Things Can Happen.



From ICCAVR.pdf (help documentation)
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-23 22:20

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表