在VDSP程序中,有一个叫做bsz的段,其含义是
Controls placement of zero-initialized variable data
其实就是相当于u-boot.lds.s中的.bss段,所以我们可以将这个段放在.bss段中。
.bss
{
INPUT_SECTION_ALIGN(4)
__bss_start = .;
INPUT_SECTIONS($LIBRARIES_UBOOT(.sbss) $LIBRARIES_UBOOT(.scommon))
INPUT_SECTIONS($LIBRARIES_UBOOT(.dynbss))
INPUT_SECTIONS($LIBRARIES_UBOOT(.bss))
INPUT_SECTIONS($LIBRARIES_UBOOT(bsz))
INPUT_SECTIONS($LIBRARIES_UBOOT(COMMON))
__bss_end = .;
} > MEM_SDRAM
当然,这样做会引起链接器的一个警告:
[Warning li2131] "./u-boot.ldf":687 Input section(s) of incompatible init qualifier detected in the output section '.bss'
For more details, see 'linker_log.xml' in the output directory.
Li2131的解释是:
A section qualifier can be specified for an output section. The input sections mapped into the qualified output section should have a compatible initialization qualifier. The linker warns you if:
The section qualifier is not compatible with an initialization qualifier on an input section.
A section qualifier is on the output section and an input section without a qualifier is mapped into it.
No section qualifier is on the output section and an input section with a qualifier is mapped into it.
Section qualifiers that can be used in the .ldf file to qualify output sections are:
NO_INIT
ZERO_INIT
RUNTIME_INIT
SHT_NOBITS
引起这个警告的原因在于bsz段应该使用ZERO_INIT来进行修饰,当然,由于我们将这个段放在.bss中,在start.s中会对这个段中的数据清0,也可以达到同样的效果,所以尽可以忽略这个警告。