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.

关于F2812的cmd文件

2812_RAM_lnk.cmd中有这么一段:

#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
.TI.ramfunc : {} > PRAMH0, PAGE = 0
#else
ramfuncs : > PRAMH0 PAGE = 0
#endif
#endif

但是编译之后会弹出警告:“creating output section “ramfuncs” without SECTION specification”。查看map文件,发现ramfuncs段被分配到了程序空间RAMM0中,索性把上面那一段直接改成ramfuncs         : > PRAMH0       PAGE = 0,这时警告消失了,ramfuncs也被分配到了PRAMH0中。那么问题来了,为啥?难道是__TI_COMPILER_VERSION__不存在吗?

  • 供参考

    http://www.deyisupport.com/question_answer/wireless_connectivity/f/45/t/127524.aspx

  • 这是个条件编译语句啊

    当你的编译器版本比较新 即__TI_COMPILER_VERSION__>=15009000

    就只编译了.TI.ramfunc : {} > PRAMH0, PAGE = 0

    而没有编译ramfuncs : > PRAMH0 PAGE = 0 

    因此会提示没有给ramfuncs指定内存,编译器自动分配到了RAMM0中。

  • 但是为什么要加这个条件编译语句呢?编译的这个段.TI.ramfunc : {} > PRAMH0, PAGE = 0有啥用处呢

  • 是这样的,在新版本的linker中支持用attribute命令代替之前常用的#pragma CODE_SECTION命令

    具体请参考这个链接:

    http://processors.wiki.ti.com/index.php/Placing_functions_in_RAM#.22ramfunc.22_attribute_and_option

    如果你只是用了#pragma命令 写的时候可以把这个条件编译注释掉,

    或者在#pragma中用.TI.ramfunc代替ramfunc