How to share the const data between CPU12 and xgate?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to share the const data between CPU12 and xgate?

跳至解决方案
2,358 次查看
100asong
Contributor I

Hi,Sir

      Please give support about it,any advice is welcome.

     I am transfering UCOS-II to MC9S12XEP,I let xgate create time tick.

     The TickISR function in xgate is here:

void interrupt  RtiHandler(int dataptr)
{

        u8 y;

         ...

         ...
           y             = OSUnMapTbl[OSRdyGrp];          /* Get pointer to HPT ready to run              */
        OSPrioHighRdy = (INT8U)((y << 3) + OSUnMapTbl[OSRdyTbl[y]]);

 
      if(OSPrioHighRdy!=OSPrioCur)
      {
        asm("SIF");
        //{ SIF } ;
      }
 
}

OSUnMapTbl is defined in OS_CORE.c file.

  INT8U  const  OSUnMapTbl[] = {
    0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x00 to 0x0F                             */

    ...

    ...
  };

Now we can enter RTI_Handler,but y  can not get the right value.

question:

1. whether we should add some sentence to share OSUnMapTbl?

 

   I have a try here to share OSUnMapTbl:

#pragma CONST_SEG  XGATE_CONST_FLASH

  INT8U  const  OSUnMapTbl[] = {

...

#pragma CONST_SEG  DEFAULT

 

But system can not enter RtiHandler interrupt.

question:

2.How to share const variable?

3.Why we can not enter RtiHandler since add " #pragma CONST_SEG  XGATE_CONST_FLASH"

 

Please give me help.Wait online.thanks.

标签 (1)
0 项奖励
回复
1 解答
1,438 次查看
kef
Specialist I

1. "Expected ;" usually is a symptom of not recognised syntax. Maybe INTU8 is not defined in your code?

 

2. XGATE can't access misaligned words, thus XGATE compiler is padding >=2byte wide structure members. Try using in S12X code:

 

#pragma align on

#pragma align off

 

3. What you are doing is weird. You have two cores = you need to run two OS copies, one on S12X and another one on XGATE. From screenshot it looks like you are debugging the same OS on both cores. Shouldn't you try to run OS on one of cores first?

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,438 次查看
kef
Specialist I

XGATE is able to access only 30k of flash on PPAGE's E0 and E1. Thus only constants in pages E0 and E1 can be shared. Also S12X should be told constants are far.

 

#pragma CONST_SEG XGATE_CONST

far INT8U  const  OSUnMapTbl[] = {
    0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x00 to 0x0F                             */

    ...

    ...
  };

#pragma CONST_SEG DEFAULT

 

Shared header file should include this:

 

#pragma CONST_SEG XGATE_CONST

extern far INT8U  const  OSUnMapTbl[];

#pragma CONST_SEG DEFAULT

 

 

0 项奖励
回复
1,439 次查看
kef
Specialist I

1. "Expected ;" usually is a symptom of not recognised syntax. Maybe INTU8 is not defined in your code?

 

2. XGATE can't access misaligned words, thus XGATE compiler is padding >=2byte wide structure members. Try using in S12X code:

 

#pragma align on

#pragma align off

 

3. What you are doing is weird. You have two cores = you need to run two OS copies, one on S12X and another one on XGATE. From screenshot it looks like you are debugging the same OS on both cores. Shouldn't you try to run OS on one of cores first?

0 项奖励
回复
1,438 次查看
100asong
Contributor I

I use xgate to sub 1 for TCBDly counter,and find the highest priority task.And CPU switch task.

0 项奖励
回复