搜索
bottom↓
回复: 2

PIC XC8编译器中的共用体出错,是什么原因啊,谢谢!

[复制链接]

出0入0汤圆

发表于 2017-5-31 19:35:30 | 显示全部楼层 |阅读模式


用这个共用体,却报如下错误是什么原因啊,谢谢!
union {unsigned long All_time;unsigned char time[4];}Total_time;

C:\Program Files (x86)\Microchip\xc8\v1.41\sources\common\Umul32.c:15: advisory: (1510) non-reentrant function "___lmul" appears in multiple call graphs and has been duplicated by the compiler

阿莫论坛20周年了!感谢大家的支持与爱护!!

月入3000的是反美的。收入3万是亲美的。收入30万是移民美国的。收入300万是取得绿卡后回国,教唆那些3000来反美的!

出0入0汤圆

 楼主| 发表于 2017-5-31 19:36:28 | 显示全部楼层
弹出这样一个提示,有解决办法吗
// 32 x 32 bit multiplication with 32 bit result
#ifdef _PIC18
#define _Has_hardware_multiply 1
#else
#define _Has_hardware_multiply 0
#endif

#if defined(_PIC14E) || defined(_PIC14EX) || defined(_PIC18)
#define _Has_large_call_stack 1
#else
#define _Has_large_call_stack 0
#endif

unsigned long
__lmul(unsigned long multiplier, unsigned long multiplicand)
{
        unsigned long product;

#define LOWBYTE(x)  (*(unsigned char *)(&x))
#define LMIDBYTE(x) (*(((unsigned char *)(&x))+1))
#define HMIDBYTE(x) (*(((unsigned char *)(&x))+2))
#define HIGHBYTE(x) (*(((unsigned char *)(&x))+3))

#if (_Has_hardware_multiply || _Has_large_call_stack) && defined(__OPTIMIZE_SPEED__)
        {

#define USE_SHRINK

/*
a 32-bit multiply can be decomposed into the sum of ten 8-bit multiplies
             a  b  c  d
*            e  f  g  h
-----------------------
           |         dh
           |      ch  0
           |   bh  0  0
           |ah  0  0  0
           |      dg  0
           |   cg  0  0
           |bg  0  0  0
         ag| 0  0  0  0 (we ignore this intermediate product
                         because it does not affect the low 32 bits of the result)
           |   df  0  0
           |cf  0  0  0
         bf| 0  0  0  0 (ignore)
      af  0| 0  0  0  0 (ignore)
           |de  0  0  0
         ce| 0  0  0  0 (ignore)
      be  0| 0  0  0  0 (ignore)
+  ae  0  0| 0  0  0  0 (ignore)
=======================
*/
                product =  (unsigned int)LOWBYTE(multiplier) * LOWBYTE(multiplicand);

#if defined(USE_MASKS)
                product += ((unsigned long)
                             ((unsigned int)LOWBYTE(multiplier) * LMIDBYTE(multiplicand))
                             +
                             ((unsigned int)LMIDBYTE(multiplier) * LOWBYTE(multiplicand)))
                        << 8;

                product += ((unsigned long)
                            ((unsigned int)LOWBYTE(multiplier) * HMIDBYTE(multiplicand))
                            +
                            ((unsigned int)LMIDBYTE(multiplier) * LMIDBYTE(multiplicand))
                            +
                            ((unsigned int)HMIDBYTE(multiplier) * LOWBYTE(multiplicand)))
                        << 16;

                /* cast to smaller type to avoid adding high bits just to discard */
                product += ((unsigned long)
                            (unsigned char)
                            ((unsigned int)LOWBYTE(multiplier) * HIGHBYTE(multiplicand))
                            +
                            (unsigned char)
                            ((unsigned int)LMIDBYTE(multiplier) * HMIDBYTE(multiplicand))
                            +
                            (unsigned char)
                            ((unsigned int)HMIDBYTE(multiplier) * LMIDBYTE(multiplicand))
                            +
                            (unsigned char)
                            ((unsigned int)HIGHBYTE(multiplier) * LOWBYTE(multiplicand)))
                        << 24;

#elif defined(USE_SHRINK)
                /* add direct to upper bytes, rather than shift and add all bytes */
                *((unsigned short long*)(((unsigned char*)&product)+1)) +=
                        ((unsigned int)LOWBYTE(multiplier) * LMIDBYTE(multiplicand));
                *((unsigned short long*)(((unsigned char*)&product)+1)) +=
                        ((unsigned int)LMIDBYTE(multiplier) * LOWBYTE(multiplicand));


                *((unsigned int*)(((unsigned char*)&product)+2)) +=
                        ((unsigned int)LOWBYTE(multiplier) * HMIDBYTE(multiplicand));
                *((unsigned int*)(((unsigned char*)&product)+2)) +=
                        ((unsigned int)LMIDBYTE(multiplier) * LMIDBYTE(multiplicand));
                *((unsigned int*)(((unsigned char*)&product)+2)) +=
                        ((unsigned int)HMIDBYTE(multiplier) * LOWBYTE(multiplicand));

                *(((unsigned char*)&product)+3) +=
                        (unsigned char)
                        ((unsigned int)LOWBYTE(multiplier) * HIGHBYTE(multiplicand));
                *(((unsigned char*)&product)+3) +=
                        (unsigned char)
                        ((unsigned int)LMIDBYTE(multiplier) * HMIDBYTE(multiplicand));
                *(((unsigned char*)&product)+3) +=
                        (unsigned char)
                        ((unsigned int)HMIDBYTE(multiplier) * LMIDBYTE(multiplicand));
                *(((unsigned char*)&product)+3) +=
                        (unsigned char)
                        ((unsigned int)HIGHBYTE(multiplier) * LOWBYTE(multiplicand));

#else
#error No method chosen
#endif
        }
#else

        product = 0;
        do {
                if(multiplier & 1)
                        product += multiplicand;
                multiplicand <<= 1;
                multiplier >>= 1;
        } while(multiplier != 0);

#endif
        return product;
}

出0入0汤圆

发表于 2017-6-16 10:24:30 | 显示全部楼层
在中断和主程序中(非主循环)调用同一个函数,产生警告:testmain.c:15: advisory: (1510) non-reentrant function "_autoDelay" appears in multiple call graphs and has been duplicated by the compiler。
导致程序在结构体访问时运行不正常。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-4-24 19:55

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表