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.

[参考译文] MSP430FR2633:关于 CodeGen-274

Guru**** 2380860 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1048751/msp430fr2633-regarding-codegen-274

器件型号:MSP430FR2633

各位专家、您好!

当我编写下面的链接时、编译器错误会发生什么类型的 C 代码?

https://sir.ext.ti.com/jira/browse/EXT_EP-8048

此致、
Sasaki

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Sasaki、您好!

    我 尝试将其转移到编译器论坛、以了解他们是否可以为此提供一些帮助。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="7882" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1048751/msp430fr2633-regarding-codegen-274 ]]编写以下链接时,编译器错误会发生什么类型的 C 代码?

    /*
    
    cl430 -vmspx --code_model=large --data_model=large --near_data=globals --opt_level=off test.c -k --symdebug:none -z -llnkx.cmd
    
    */
    
    #include <stdio.h>
    
    void func(void) { }
    void call1(void) { }
    
    int something;
    
    void fn1()
    {
        if ((unsigned)(unsigned long)func & 1) call1();
    }
    
    void fn2()
    {
        if ((unsigned)(unsigned long)&something & 1) call1();
    }
    
    int main()
    {
        fn1();
        fn2();
        return 0;
    }

    当此代码的构建如注释中开头附近所示时,会发生...

    % cl430 -vmspx --code_model=large --data_model=large --near_data=globals --opt_level=off test.c -k --symdebug:none -z -llnkx.cmd
    "test.c", line 16: warning: integer conversion resulted in truncation
    "test.c", line 21: warning: integer conversion resulted in truncation
    <Linking>
    warning: relocation to symbol "func" overflowed; the 17-bit relocated address
       0x100f6 is too large to encode in the 16-bit field (type = 'R_MSP430X_ABS16'
       (15), file = "test.obj", offset = 0x00000004, section = ".text:fn1")
    warning: output file "a.out" cannot be loaded and run on a target system

    谢谢、此致、

    乔治

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、George-San、

    感谢您的支持。

    我明白了。

    此致、
    Sasaki