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.

[参考译文] 编译器/TMS320F28335:汇编语言中的变量定义

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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/943307/compiler-tms320f28335-variable-definition-in-assembly

器件型号:TMS320F28335

工具/软件:TI C/C++编译器

尊敬的团队:

我使用的是 CCS 6.1中的 C/C++和汇编语言混合编程。 我 在 .asm 文件中定义了变量。 这些 变量未与 C 代码共享。

但在汇编头文件中声明的变量无法正常编译到 Map 文件中。

_test_1.set140h
_test_2.set141h
_test_3.set142h
_test_4.set143h
_test_5.set144h
_test_6.set145h
_test_7.set146h
_test_8.set147h
_test_9.set148h
_test_149h.set

PS:  

如果我使用.global 声明和在 C 语言头文件中在外部声明的全局变量、则可以在映射文件中找到声明的变量和相应的地址。

e2e.ti.com/.../EC_2D00_F28335_2D00_BasicAndCProgram.rar

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

    例如_test_1等名称是绝对符号。  绝对符号不会显示在映射文件中。  尽管您确实在符号表中看到了它们,但实用程序 nm2000...

    % nm2000 BasicAndCProgramTest.out | findstr _test_00008800
    T B_test_Fun
    00000140 A _test_1
    00000149 A _test_10
    00000149 A _test_10
    0000014a _test_11
    ... 

    如果要在映射文件中看到绝对符号、则必须将其设置为全局符号。  您已经对源文件 BasicVar.h 中的一些符号执行此操作...

    全局_test_1
    .global _test_2
    .global _test_3
    .global _test_4
    

    为要在映射文件中看到的任何其他绝对符号添加相同条目。

    谢谢、此致、

    乔治