gpt4 book ai didi

c - sbss2/sdata2有什么意义?

转载 作者:行者123 更新时间:2023-12-04 15:30:34 26 4
gpt4 key购买 nike

我正在使用基于 GCC 的编译器处理 PPC 微 Controller (特别是 e200z4)。如果我们定义一个大小小于定义数量的变量(我的例子是 8),PPC EABI 支持小数据分配。我的理解是:

  • sdata 用于小的初始化数据,它是可修改的(将位于 RAM 部分)。
  • sbss 与将位于 RAM 上的 sdata 相同,但它用于单元化或零变量。
  • 这 2 个部分只能由一条指令访问,该指令由 16 位有符号偏移量 + 基址寄存器引用。

我不知道的是sbss2sdata2的意义,通过阅读PPC EABI规范?它们会是 RAM 或 Flash 上的小变量吗?它们是否与 sdatasbss 不同?

最佳答案

来自EABI

External variables that are scalars of 8 or fewer bytes, whose values might be changed by the program, and whose values will not be changed outside of the program, shall be accessed as .sdata or .sbss entries...

When the object file is not to be part of a shared object file, external variables that are scalars of 8 or fewer bytes, whose values cannot be changed by the program, and whose values will not be changed outside of the program, shall be accessed as .sdata2 or .sbss2 entries...

The special section .sdata2 is intended to hold initialized read-only small data that contribute to the program memory image. The section can, however, be used to hold writable data. The special section .sbss2 is intended to hold writable small data that contribute to the program memory image and whose initial values are 0.

关于c - sbss2/sdata2有什么意义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61319596/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com