This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

使用ti-cgt-c2000_V5.2.1编译程序正常运行,改用ti-cgt-c2000_V6.4.12编译器或是其他高版本编译器,编译的文件无法正常运行。

使用ti-cgt-c2000_V5.2.1编译程序正常运行,改用ti-cgt-c2000_V6.4.12编译器或是其他高版本编译器,编译的文件无法正常运行,调试中程序流有问题。

  • 能不能把问题截图贴上来哈

  • 你好,建议你查下编译器型号,看他支持的css版本具体是哪个。

  • 用高版本的编译器时,看一下工程属性中的CCS compiler中的优化选项里面是否有开优化级别,试一下把优化关掉。

    另外,从我的角度上讲,如果用高版本的编译器编译程序出现问题,我认为还是你的程序还是有问题。首先rebuild project看一下编译后出现什么警告内容。另外,在调试时,逐步调试看看。

    ERIC

  • 使用ccs6.2 编译器用过6.4和最新的17,程序最终就会死在图中的那条注释上。

  • 编译器并没有报什么错误和警告。 优化也是关掉的。可能是因为程序中用了比较老的ucos系统调度导致的。但还没找到具体原因。单步调试时程序会死在一条注释语句上,应该是跑飞了。

  • 高版本编译运行两个结构体赋值的结果。这个memcpy的代码存在问题。 

  • void *memcpy(void *to, const void *from, size_t n)
    {
    register char *rto = (char *) to;
    register char *rfrom = (char *) from;
    register unsigned int rn;
    register unsigned int nn = (unsigned int) n;

    /***********************************************************************/
    /* Copy up to the first 64K. At the end compare the number of chars */
    /* moved with the size n. If they are equal return. Else continue to */
    /* copy the remaining chars. */
    /***********************************************************************/
    for (rn = 0; rn < nn; rn++) *rto++ = *rfrom++;
    if (nn == n) return (to);

    /***********************************************************************/
    /* Write the memcpy of size >64K using nested for loops to make use */
    /* of BANZ instrunction. */
    /***********************************************************************/
    {
    register unsigned int upper = (unsigned int)(n >> 16);
    register unsigned int tmp;
    for (tmp = 0; tmp < upper; tmp++)
    {
    for (rn = 0; rn < 65535; rn++)
    *rto++ = *rfrom++;
    *rto++ = *rfrom++;
    }
    }

    return (to);
    }

    //将该方法复制到c文件中,运行正常了。  不知道什么原因。 是不是高版本的改方法存在不兼容,或是没有该方法。

  • //------------6.2.11 编译器目录下的memcpy.c方法如下----------------------
    #include <string.h>

    void *memcpy(void *to, const void *from, size_t n)
    {
    return memcpy(to, from, n); /* NOTE: MEMCPY() IS A BUILTIN FUNCTION */
    }
    //---------------------------------------------------------------------------------------
    //-----------17.3.0编译器目录下的memcpy.c方法代码如下----------------
    #include <string.h>
    void *memcpy(void *to, const void *from, size_t n)
    {
    register char *rto = (char *) to;
    register char *rfrom = (char *) from;
    register unsigned int rn;
    register unsigned int nn = (unsigned int) n;

    /***********************************************************************/
    /* Copy up to the first 64K. At the end compare the number of chars */
    /* moved with the size n. If they are equal return. Else continue to */
    /* copy the remaining chars. */
    /***********************************************************************/
    for (rn = 0; rn < nn; rn++) *rto++ = *rfrom++;
    if (nn == n) return (to);

    /***********************************************************************/
    /* Write the memcpy of size >64K using nested for loops to make use */
    /* of BANZ instrunction. */
    /***********************************************************************/
    {
    register unsigned int upper = (unsigned int)(n >> 16);
    register unsigned int tmp;
    for (tmp = 0; tmp < upper; tmp++)
            {
    for (rn = 0; rn < 65535; rn++)
                    *rto++ = *rfrom++;
             *rto++ = *rfrom++;
            }
    }

    return (to);
    }
    //--------------------------------------------------------------------------------------
    具体为什么出错,真的搞不清。
  • 你好,找到这个问题胡原因了吗?我目前也遇到了
  • 我遇到的原因是因为新版本的编译器memcpy函数的问题,新版本编译器需要自己重写memcpy函数,然后就正常了。
  • 我和你的问题是一模一样的。老版本的CCS3.3没问题,今天换成CCS8.0出现问题的,现象和你的一样