完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我在优化时遇到了这个问题。XC16 V1.30,-O1。DSPIC33 EV256GM106所发生的是调用一个函数,但其中一个参数不是校正函数原型。UE被加载到WrGe0.WRG1中,加载了结构的基地址,然后调用函数。两个地址是正确的。问题是……地址0x2550的指令被跳过!!!!从拆卸视图中退出。除了指令0x2550之外的所有单步骤(跳过)和W9的值在指令之前和之后都没有改变。**我在调用之前还添加了NOP,只是为了保证如果我禁用优化,这不会发生,但是代码变成20%个大的什么??
以上来自于百度翻译 以下为原文 I'm having this issue when optimization is enabled. XC16 v1.30, -O1 enabled. DSPIC33EV256GM106 what is happening is that a function is called but one of the parameter isn't correct function prototype void function(unsigned int param, mystruct_t *mystruct) this is compiled as 0x2750: MOV #0x1514, W9 0x27A2: MOV #0x1300, W1 0x27A4: MOV [W9], W0 0x27A6: RCALL function translated, WREG9 is loaded with the address of the variable and then its current value is loaded into WREG0. WREG1 is loaded with the base address of the structure, then the function is called. the two addresses are CORRECT the problem is... INSTRUCTION AT ADDRESS 0x2750 IS SKIPPED!!! stepped from disassembly view.. all single steps besides instruction 0x2750 (skipped over) and value of W9 doesn't change before and after the instruction. ** I also added NOPs before the call just to be sure this is not happening if i disable optimizations, however code becomes 20% bigger what the?? |
|
相关推荐
2个回答
|
|
如果你在0x2550之前向我们展示代码,这将非常有帮助。或者在调用函数时简单地检查寄存器是否包含正确的值。可能是“PARAM”的地址已经被保存在W9中。那么,为什么要重新加载呢?
以上来自于百度翻译 以下为原文 It would really help if you showed us the code prior 0x2750 as well. Or simply check whether the Registers contain the correct values upon calling the function. Could be that the address of 'param' is already held in W9. Then, why reload? |
|
|
|
在我写的时候,我添加了一组NopSi,虽然它会很正确,因为传递的参数不正确,WReG9的内容是不正确的,因此它应该被更新。而且,DSPIC如何事先知道它可以跳过指令?不管怎样,为了增加陌生感,我在几行之后评论了一个不同的函数,它毫无问题地工作。我删除了注释,代码再次工作,没有问题。第一个功能是获得正确的参数。
以上来自于百度翻译 以下为原文 as i wrote, i added a bunch of NOPs i though it would be ovious that since the passed parameter isn't correct, the content of WREG9 was not correct, therefore it should have been updated. Also, how can the dspic know in advance that it can skip an instruction? Anyway, to add to the strangeness i commented out a call to a different function several lines after, it worked without problems. I removed the comment, the code is working without problems again.. first function is getting the correct parameters. |
|
|
|
只有小组成员才能发言,加入小组>>
5152 浏览 9 评论
1994 浏览 8 评论
1924 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3166 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2221 浏览 5 评论
716浏览 1评论
603浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
488浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
618浏览 0评论
515浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-16 05:16 , Processed in 1.608735 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号