| typedef struct {
 u1_t cmd;           //!< command code
 s1_t status;        //!< communication status
 u1_t nBytesSent;    //!< how many bytes already sent
 u1_t nBytesToSend;  //!< how many bytes to send
 u1_t nBytesReceived;//!< how many bytes received
 u1_t nBitsReceived; //!< how many bits received
 u1_t irqSource;     //!< which interrupts have occured
 u1_t collPos;       /*!< at which position occureda           collision*/
 u1_t errFlags;      //!< error flags
 u1_t saveErrorState;//!< accumulated error flags for
 //!< multiple responses
 u1_t RxAlignWA;     //!< workaround for RxAlign = 7
 u1_t DisableDF;     //!< disable disturbance filter
 } MfCmdInfo;
 其中
 u1_t nBytesSent;    //!< how many bytes already sent
 u1_t nBytesToSend;  //!< how many bytes to send
 u1_t nBytesReceived;//!< how many bytes received
 u1_t nBitsReceived; //!< how many bits received
 改成u1型了,原本是u2_t型(即uint型)。
 问题就没有了:结构体和数组放片外,用指针操作没有问题。真是奇怪,我对比查看了编译后的汇编代码也没发现什么问题,而且就是不用指针时,跟踪到最底层的数据输出都没有出错的。
 现在先就这样用着吧,但是这个地方真的无法理解,猜想是不是MpIsrOut[MpIsrInfo->nBytesSent]这样指针套指针,而且还是片外、双字节数,keil编译出的代码有漏洞???但是这里再重复一下:1、跟踪到最底层的数据输出数据都没有出错。2、编译出的汇编代码看不出问题。3、如果都放在片内就没有问题。
 另外:这个程序最多的时候函数发生了6级嵌套,也就是这个函数里的时候最深。不知道这里会不会有疑点,我用的是keil3 8.05a版本。
 
 
 堆栈溢出,代码空间溢出应该不会,ram和code区的使用还远未到容量。而且如果溢出,程序应该不跑飞也是瞎跑吧,但这里程序运行轨迹没有问题,能重复运行。
 
 
 |