martin wakely

CW9.2 simulator for MobileGT ppc, possibly strange behaviour

Discussion created by martin wakely on Jun 30, 2009
Latest reply on Jul 3, 2009 by martin wakely

Hi,

 

I have discovered that the simulator in CW9.2 for MobileGT (MPC5121) doesn't update variables correctly when cacheing is enabled - is that expected behaviour?

 

Below is an example, using the demo project created in CW for ADS5121 native mode (i.e. no OS).

 

I ran the "Cache ISR Debug Version' in the CW simulator.

 

With cacheing enabled, "pCMS_Heap = 0x1100000;" does not update pCMS_Heap.

 

If I disable cacheing then the statement behaves as expected.

 

To disable cacheing I comment out the following line in "ini_mmu_cache.c"

 

// Initialize Instruction and Caches
//   bl       init_caches

 

 

Thanks


Martin Wakely

 

 

 

 

 

This is main.c

 

/////////////////////////
//    Project Stationery  //
//////////////////////////

#include <stdio.h>

asm void system_call();

asm void system_call()
{
    nofralloc
    sc
    blr
}

 

unsigned long pCMS_Heap;

void InitCMSHeap(void);


void main()
{
    int i=0;
       
    InitCMSHeap();
   

    printf("Welcome to CodeWarrior!\r\n");

    system_call(); // generate a system call exception to demonstrate the ISR
       
    while (1) { i++; } // loop forever
}



void InitCMSHeap(void)
{

            // this variable is not aparently updated correctly

   pCMS_Heap = 0x1100000;

}

Message Edited by martinw on 2009-06-30 11:55 AM

Outcomes