lpp 发表于 2023-5-16 07:36:24

STC-USB Link1D仿真调试,KeilC251 debug模式进入函数,局部变量总是显示0x0000

现象:芯片:STC32G12K128
         仿真器:STC-USB Link1D
         软件:keil C251
         debug模式进入函数,call stack+local窗口:局部变量总是显示0x0000
测试过程:编写测试函数,small模式编译后,debug模式进入函数,call stack+local窗口:能看到函数局部变量数值变化
                                    Xsmall模式编译后,debug模式进入函数,call stack+local窗口:局部变量总是显示0x0000
各位大咖帮忙看看怎么回事呀,多谢!
#include "stc32g.h"
#include "stc.h"
u16 u32temp_g1;
u16 u32temp_g2;
u8 xdata arr;

u16 sub(u16 datain)
{
        u16 u16temp1 = 0x11;
        u16 u16temp2 = 0;       
        u16temp2 = u16temp1 + datain;
        u16temp2 = u16temp2 + 10;       
        return u16temp2;
        //return 0;       
       
}
u16 sub2(u16 datain)
{
        u16 u16temp1 = 0x11;
        u16 u16temp2 = 0;       
        u16temp2 = u16temp1 + datain;
        u16temp2 = u16temp2 + 10;       
        return u16temp2;
        //return 0;       
       
}
void main()
{
        u32temp_g1 = 0x8899;
        u32temp_g2 = sub(u32temp_g1);
        u32temp_g1 = 0x1122;
        //if (0)
        //sub(0x1);
        if (u32temp_g1 == 0)
                sub2(u32temp_g1);
       
}

8051启蒙者 发表于 2023-5-16 08:53:56

仿真步骤和设置参考此贴:用 STC-USB Link1D 硬件SWD仿真STC32 -   https://www.stcaimcu.com/forum.php?mod=viewthread&tid=703&extra=page%3D1



pingfr 发表于 2023-8-23 10:38:15

没人给个解决办法吗?按楼上的仿真步骤和设置搞完还是看不到局部变量值,是和small模式有关吗?
页: [1]
查看完整版本: STC-USB Link1D仿真调试,KeilC251 debug模式进入函数,局部变量总是显示0x0000