This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

多核单镜像和多镜像的变量存储和内存划分问题



   HELLO!

 今天翻阅了一下multicore programming guide 文档,有几个不太清楚的地方请教一下

   1.当多核使用同一个工程文件 (sigle image)模式下,如果在SL2中定义一个变量或者一个数组缓冲,那么多核访问该变量和缓冲是否使用同一个地址。上述文档第七章有原文:

                             The code must set up pointer tables for unique data sections that reside in shared L2 or DDR2 SDRAM

              这里说的这个pointer tables  和unique data sections 指的是什么呢

  2.当多核用多工程,多个CMD文件时(multiple image),如果多个核的工程都需要使用SL2,是否需要程序员把SL2提前划分好,给不同的核使用,在每个核工程的CMD文件中体现划分的方法。这时在core0还可以看到其他核的变量吗?

 3.multicore programming guide 文档里还有这样的原文:

External data sections or unique data tables within the SL2 data sections cannot simply be placed using the linker. Instead, the per-core addresses must be determined at initialization time and stored in a pointer (or calculated each time they are used).
The programmer can use the formula:
<base address> + <per-core-area size> × DNUM
This can be done at boot time or during thread creation time when pointers are calculated and stored in local L2. This allows the rest of the processing through this pointer to be core-independent, such that the correct unique pointer is always retrieved from local L2 when it is needed.

当多核访问SL2数据段的时候为什么不用同一个指针,要在LL2中保存一个指针表呢。

 

望解答。。谢谢!

 

 

  • 您好,

    1. 多核共享一个image时,声明的共享变量多核访问时的地址是一样的;

    2. 对。对于共享内存,需要用户在使用时提前根据设计进行划分;可以通过绝对地址访问其他核读写的内存。

    3. 请注意后面这句话:This allows the rest of the processing through this pointer to be core-independent, such that the correct unique pointer is always retrieved from local L2 when it is needed. 多核分别使用一个指针,是为了保证不互相影响。

    对于多核的编程,根据不同应用可以灵活设计,具体还是跟应用有关。