ARM-----#pragma CODE_SECTION

ti的帮助文档里是这么讲的:

The DATA_SECTION pragma allocates space for the symbol in a section called section name. 
The syntax for the pragma in C is:

#pragma DATA_SECTION (symbol, "section name");

The syntax for the pragma in C++ is:

#pragma DATA_SECTION ( "section name");

The DATA_SECTION pragma is useful if you have data objects that you want to link into an area separate from the .bss section.
This directive is illustrated in the following example.

Using the DATA_SECTION Pragma

a)  C source file

#pragma DATA_SECTION(bufferB, "my_sect")
char bufferA[512];
char bufferB[512]:

b)  C++ source file

char bufferA[512];
#pragma DATA_SECTION("my_sect")
char bufferB[512];

c)  Assembly source file

          .global _bufferA
          .bss    _bufferA,512,4
          .global _bufferB
_bufferB: .usect  "my_sect",512,4


我理解的意思是:
  定义一个数据段:  
          段名为:    "section name"
          段的内容在:  symbol   
CCS编程中,如果我们不指定变量的存放位置,编译器会自动的给变量分配一个位置,但是如果有的时候需要把变量放在一个特定的空间内,我们应该如何操作呢,CCS提供了如下的两个指令
#pragma CODE_SECTION
#pragma DATA_SECTION
其中data_section是针对数据空间的,code_section是针对程序空间的,具体的使用办法是
#pragma DATA_SECTION(bufferB, ”my_sect”)
char bufferB[512];
.cmd文件中建立对应的section就可以使用了.

MEMORY
{
PAGE 1: spacename : origin = 0x...., length 0x..
}
SECTIONS
{
    .my_sect  : {} >spacename PAGE 1
}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值