Linker Scripts SECTIONS 部分的一个疑问

在M4 里面Linker Scripts 看到有如下部分描述

SECTIONS
{
     .AppinInfo :
    {
        KEEP(*(.AppinInfo))
    }>FLASH = 0xff

}

一直没搞明白 这个= 0xff 是什么意思,相关中文网是找遍了也没这部分解释,于是只能找老外的网站了,尤其是要找到官方资料。

https://sourceware.org/binutils/docs/ld/Output-Section-Fill.html#Output-Section-Fill

3.6.8.8 Output Section Fill

You can set the fill pattern for an entire section by using ‘=fillexp’. fillexp is an expression (see Expressions). Any otherwise unspecified regions of memory within the output section (for example, gaps left due to the required alignment of input sections) will be filled with the value, repeated as necessary. If the fill expression is a simple hex number, ie. a string of hex digit starting with ‘0x’ and without a trailing ‘k’ or ‘M’, then an arbitrarily long sequence of hex digits can be used to specify the fill pattern; Leading zeros become part of the pattern too. For all other cases, including extra parentheses or a unary +, the fill pattern is the four least significant bytes of the value of the expression. In all cases, the number is big-endian.

You can also change the fill value with a FILL command in the output section commands; (see Output Section Data).

Here is a simple example:

SECTIONS { .text : { *(.text) } =0x90909090 }

原来是用来填充的!

We showed above that the full description of an output section looked like this:

section [address] [(type)] :
  [AT(lma)]
  [ALIGN(section_align) | ALIGN_WITH_INPUT]
  [SUBALIGN(subsection_align)]
  [constraint]
  {
    output-section-command
    output-section-command
    …
  } [>region] [AT>lma_region] [:phdr :phdr …] [=fillexp]

具体详情可以看gcc ld 中文手册,里面很详细介绍了Linker Scripts 的语法,看来还是要找对资料才行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值