在线时间50 小时
UID263044
注册时间2011-2-16
NXP金币0
TA的每日心情 | 开心 2018-9-14 09:26 |
---|
签到天数: 2 天 连续签到: 1 天 [LV.1]初来乍到
高级会员

- 积分
- 952
- 最后登录
- 2021-1-4
|
发表于 2012-3-6 15:00:48
|
显示全部楼层
回复:C语言中 stack操作
我在刚好在写一段C code, 帮你看看这个问题
你应该是没有在 .prm文件进行设置
NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */
SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
Z_RAM = READ_WRITE 0x0040 TO 0x00FF;
RAM = READ_WRITE 0x0100 TO 0x02FF;
USER_STACK = READ_WRITE 0x0300 TO 0x043F; //healy----1
ROM = READ_ONLY 0xC000 TO 0xFFAD;
ROM1 = READ_ONLY 0xFFC0 TO 0xFFCF;
/* INTVECTS = READ_ONLY 0xFFD0 TO 0xFFFF; Reserved for Interrupt Vectors */
END
PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */
DEFAULT_RAM, /* non-zero page variables */
INTO RAM;
_PRESTART, /* startup code */
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
DEFAULT_ROM,
COPY /* copy down information: how to initialize variables */
INTO ROM; /* ,ROM1: To use "ROM1" as well, pass the option -OnB=b to the compiler */
_DATA_ZEROPAGE, /* zero page variables */
MY_ZEROPAGE INTO Z_RAM;
SSTACK INTO USER_STACK; //healy----2
END
STACKSIZE 0x140 //healy---3
其中1、2是我加的,3是我改的,本来是0x60
MAP文件的输出结果是
*********************************************************************************************
SECTION-ALLOCATION SECTION
Section Name Size Type From To Segment
---------------------------------------------------------------------------------------------
.init 132 R 0xC000 0xC083 ROM
.startData 14 R 0xC084 0xC091 ROM
.text 125 R 0xC092 0xC10E ROM
.copy 2 R 0xC10F 0xC110 ROM
.stack 320 R/W 0x300 0x43F USER_STACK
你可按照我的设置改一下你的
|
|