打印
[ZLG-ARM]

晕,堆栈设错了?帮忙看一下

[复制链接]
2969|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ZorroCN|  楼主 | 2009-4-16 15:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ST, ck, AC, Stack, IO
错误信息如下(IAR5.30,LPC2378,SmartARM2300板):
Thu Apr 16 14:55:42 2009: DLL version: V3.92a, compiled Oct  6 2008 19:58:36
Thu Apr 16 14:55:42 2009: Firmware: J-Link ARM V6 compiled Jul 30 2008 11:24:59
Thu Apr 16 14:55:42 2009: JTAG speed is initially set to: 32 kHz
Thu Apr 16 14:55:42 2009: Initial reset was performed
Thu Apr 16 14:55:42 2009: TotalIRLen = 4, IRPrint = 0x01
Thu Apr 16 14:55:42 2009: J-Link found 1 JTAG device(s). ARM core Id: 4F1F0F0F ARM7
Thu Apr 16 14:55:42 2009: Device at TAP0 selected
Thu Apr 16 14:55:42 2009: JLINK command: ProjectFile = C:\uCOSARM\HansBoard\NXP\LPC2378\APP\settings\uCOSARM_Debug.jlink, return = 0
Thu Apr 16 14:55:42 2009: JLINK command: device = LPC2378, return = 0
Thu Apr 16 14:55:42 2009: TotalIRLen = 4, IRPrint = 0x01
Thu Apr 16 14:55:42 2009: RTCK reaction time is approx. 189ns
Thu Apr 16 14:55:42 2009: Auto JTAG speed: Adaptive
Thu Apr 16 14:55:45 2009: 40479 bytes downloaded (14.88 Kbytes/sec)
Thu Apr 16 14:55:45 2009: Loaded debugee: C:\uCOSARM\HansBoard\NXP\LPC2378\APP\Debug\Exe\uCOSARM.out
Thu Apr 16 14:55:45 2009: Target reset
Thu Apr 16 14:55:57 2009: Breakpoint hit: Code @ bsp.c:278.9, type: default (auto) 
Thu Apr 16 14:55:57 2009: The stack pointer for stack 'SVC_STACK' (currently 0x40001B70) is outside the stack range (0x40000400 to 0x40000600)
Thu Apr 16 14:55:59 2009: Breakpoint hit: Code @ bsp.c:278.9, type: default (auto) 
Thu Apr 16 14:55:59 2009: The stack pointer for stack 'SVC_STACK' (currently 0x40001B60) is outside the stack range (0x40000400 to 0x40000600)
Thu Apr 16 14:56:01 2009: The stack pointer for stack 'SVC_STACK' (currently 0x40001B60) is outside the stack range (0x40000400 to 0x40000600)
Thu Apr 16 14:56:02 2009: The stack 'CSTACK' is filled to 96% (992 bytes used out of 1024). The warning threshold is set to 90.%
Thu Apr 16 14:56:02 2009: The stack pointer for stack 'SVC_STACK' (currently 0x40001B60) is outside the stack range (0x40000400 to 0x40000600)




很奇怪,堆栈指针一下子就已经跑到0x40001B70去了,中间连个90%的提示都没有,很显然不是堆栈设置过小,而是堆栈指针从一开始就根本没有在0x40000400 to 0x40000600这个区域内,各位帮忙看看这是哪里设置错了?


icf文件:

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__              = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__          = 0x00000044;
define symbol __ICFEDIT_region_ROM_end__            = 0x0007FFFF;
define symbol __ICFEDIT_region_RAM_start__          = 0x40000000;
define symbol __ICFEDIT_region_RAM_end__            = 0x40007FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__   = 0x400;
define symbol __ICFEDIT_size_svcstack__ = 0x200;
define symbol __ICFEDIT_size_irqstack__ = 0x100;
define symbol __ICFEDIT_size_fiqstack__ = 0x40;
define symbol __ICFEDIT_size_undstack__ = 0x10;
define symbol __ICFEDIT_size_abtstack__ = 0x10;
define symbol __ICFEDIT_size_heap__     = 0x2000;
/**** End of ICF editor section. ###ICF###*/


define memory mem with size = 4G;
define region ROM_region        = mem:[from __ICFEDIT_region_ROM_start__            to __ICFEDIT_region_ROM_end__];
define region RAM_region        = mem:[from __ICFEDIT_region_RAM_start__            to __ICFEDIT_region_RAM_end__];

define symbol __region_USB_DMA_RAM_start__  = 0x7FD00000;
define symbol __region_USB_DMA_RAM_end__    = 0x7FD01FFF;
define region USB_DMA_RAM_region= mem:[from __region_USB_DMA_RAM_start__    to __region_USB_DMA_RAM_end__];

define symbol __region_EMAC_DMA_RAM_start__ = 0x7FE00000;
define symbol __region_EMAC_DMA_RAM_end__   = 0x7FE03FFF;
define region EMAC_DMA_RAM_region= mem:[from __region_EMAC_DMA_RAM_start__  to __region_EMAC_DMA_RAM_end__];

define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

initialize by copy { readwrite };
do not initialize  { section .noinit };
do not initialize  { section USB_DMA_RAM };
do not initialize  { section EMAC_DMA_RAM };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in ROM_region   { readonly };
place in RAM_region   { readwrite,
                        block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
                        block UND_STACK, block ABT_STACK, block HEAP };
place in USB_DMA_RAM_region
                      { readwrite data section USB_DMA_RAM };
place in EMAC_DMA_RAM_region
                      { readwrite data section EMAC_DMA_RAM };


另外,在xcl文件里面有这么一段:

-D_CSTACK_SIZE=100
-D_IRQ_STACK_SIZE=100
-D_FIQ_STACK_SIZE=0
-D_SVC_STACK_SIZE=100
-D_ABT_STACK_SIZE=0
-D_UND_STACK_SIZE=0
-D_HEAP_SIZE=100

-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND
-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND
-Z(DATA)FIQ_STACK+_FIQ_STACK_SIZE=RAMSTART-RAMEND
-Z(DATA)SVC_STACK+_SVC_STACK_SIZE=RAMSTART-RAMEND
-Z(DATA)ABT_STACK+_ABT_STACK_SIZE=RAMSTART-RAMEND
-Z(DATA)UND_STACK+_UND_STACK_SIZE=RAMSTART-RAMEND
-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND

两者设置的明明是同一个东西,但是数值却不一样,尤其是xcl文件,把几个堆栈都定义在整个RAM空间内了?

相关帖子

沙发
ictty| | 2009-5-14 13:36 | 只看该作者

看代码?

使用特权

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

本版积分规则

29

主题

84

帖子

0

粉丝