Value out of range for 32-bit array element: 32位数组元素的值超出范围

huangapple go评论46阅读模式
英文:

Device tree: Value out of range for 32-bit array element

问题

在我的硬件中,我想要访问8GB的RAM内存,但编译失败并显示错误:“32位数组元素超出范围”。是否有一种方法可以在内存属性中使用64位数字?我在内核树的文档目录中找不到与此属性相关的绑定文件...有人可以指导我正确的位置吗?

memory@200000000 {
device_type = "memory";
/* 8G RAM */
reg = <0x000000000 0x200000000 0x000000000 0x200000000>;
};

英文:

In my hardware I want to address 8GB RAM memory but compilation fails with error: "Value out of range for 32-bit array element". Is there any workaround that allow use 64bit numbers in memory property? I can't find binding file for this property in Documentation directory of kernel tree... Can anyone point me right place?

 memory@200000000 {
             device_type = &quot;memory&quot;;
              /* 8G RAM */
              reg = &lt;0x000000000 0x200000000 0x000000000 0x200000000&gt;;
};

Thanks

答案1

得分: 1

是的,区域数组中的元素(reg =)是32位的,但您可以使用2x32位来指定大小(类似于高/低地址)。

所以对于从0x20000000开始的8GB内存,应该如下所示:

memory@200000000 {
    device_type = "memory";
    /* 8G RAM */
    reg = <0x0 0x0000000020000000 0x00000001 0x00000000>,
          <0x1 0x0000000000000000 0x00000001 0x00000000>;
};

其中,0x00000001 0x00000000 实际上表示4GB(0x1000000000),但以2x32位值的方式写入。

英文:

Yes the elements in the regions array (reg =) are 32bit but you can use 2x32bit to specify the size (like hi/low addresses).

So for a 8GB memory starting at 0x20000000 it should look like this:

  memory@200000000 {
                  device_type = &quot;memory&quot;;
                   /* 8G RAM */
                   reg = &lt;0x0 0x0000000020000000 0x00000001 0x00000000&gt;,
                         &lt;0x1 0x0000000000000000 0x00000001 0x00000000&gt;;
 };

Where 0x00000001 0x00000000 actually represent the 4GB (0x1000000000) but written as 2x32bit values.

huangapple
  • 本文由 发表于 2023年2月10日 13:12:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75407209.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定