AnsweredAssumed Answered

Get and Set Variable on RAM1 segmen

Question asked by Nurul Hari Lesmono on Nov 2, 2009
Latest reply on Nov 5, 2009 by Nurul Hari Lesmono

Dear All,

 

I am new on code warior and need you help.

 

my problem is get and set variable when the variable are on the RAM1 segmen.

 

this are my code:

 

derivarive.h

 

#pragma DATA_SEG  Myuse
  volatile far unsigned char SCIBUF[35];
#pragma DATA_SEG default

 

project.prm

/* This is a linker parameter file for the mc9rs08la8 */

NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */

SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
    TINY_RAM                 =  READ_WRITE   0x0005 TO 0x000D;
    RAM                      =  READ_WRITE   0x0050 TO 0x00BF;
    RAM1                     =  NO_INIT      0x0100 TO 0x017F;
    RESERVED_RAM             =  NO_INIT      0x0000 TO 0x0004;
    ROM                      =  READ_ONLY    0x2000 TO 0x3F00;
    CONST_PAGE               =  READ_ONLY     0x3f01 TO 0x3FF9;
END

PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */
    RESERVED                 INTO RESERVED_RAM;
    TINY_RAM_VARS            INTO TINY_RAM;
    DIRECT_RAM_VARS          INTO RAM, TINY_RAM;
   
    Myuse                    INTO RAM1;
   
    DEFAULT_RAM              INTO RAM, TINY_RAM;
    DEFAULT_ROM              INTO ROM;
    CONST_ROM               INTO CONST_PAGE;
END

STACKSIZE 0x00 /* no stack for RS08 */

//VECTOR 0 _Startup     /* Reset vector: this is the default entry point for an application. */
 

 

main.c

#include <hidef.h> /* for EnableInterrupts macro */  
#include "derivative.h" /* include peripheral declarations */

#include "QA_Features.h"
#include "QA_Function.h"

.

.

.

.

#ifdef __Test_Simulation__
         
          //E91020237676615F75CF//
          SCIBUF[0] = 0xE9;
          SCIBUF[1] = 0x10;
          SCIBUF[2] = 0x20;
          SCIBUF[3] = 0x23;
          SCIBUF[4] = 0x76;
          SCIBUF[5] = 0x76;
          SCIBUF[6] = 0x61;
          SCIBUF[7] = 0x5F;
          SCIBUF[8] = 0x75;
          SCIBUF[9] = 0xCF;
          
          // i want to get correct address of SCIBUF - i am have problem in here //

         TestSimulation((unsigned int *)&SCIBUF[0],5);
                  
#endif

 

QA_Function.c

void QA_Decryptor(unsigned int * uchStartAddress,unsigned char uchDataLength)
{
    volatile unsigned int *uintpTemporaryAddress = 0;   
    unsigned char uchLoop = 0;
    //unsigned char uchEncryption_key1 = 0;
    //unsigned char uchEncryption_key2 = 0;
    unsigned char uchTemporaryByte1 = 0;                
    unsigned char uchTemporaryByte2 = 0;

    //-------------------------------------------//
    // Input Form:
    // ID Key1 Key2 Length Data[Length] Checksum
    //-------------------------------------------//

    uchEncryption_key1 = *uchStartAddress; // get key1 at first Byte
    ++uchStartAddress;
    uchEncryption_key2 = *uchStartAddress; // get key2 at second Byte
    ++uchStartAddress;

.


.

.

.

}

void TestSimulation(unsigned int * DataAddress,unsigned char DataLength){
 
    QA_Decryptor(DataAddress,DataLength);
    QA_Encryptor(DataAddress,DataLength);   
}

 

My question is how i can get  uchEncryption_key1 = SCIBUF[1]???

 

Best Regards,

Hari

Outcomes