How to share the const data between CPU12 and xgate?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to share the const data between CPU12 and xgate?

Jump to solution
2,353 Views
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.

Labels (1)
0 Kudos
Reply
1 Solution
1,433 Views
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?

View solution in original post

0 Kudos
Reply
3 Replies
1,433 Views
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 Kudos
Reply
1,434 Views
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 Kudos
Reply
1,433 Views
100asong
Contributor I

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

0 Kudos
Reply