CW9.2 simulator for MobileGT ppc, possibly strange behaviour

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

CW9.2 simulator for MobileGT ppc, possibly strange behaviour

1,266 Views
martinw
Contributor III

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
Labels (1)
0 Kudos
Reply
2 Replies

411 Views
ronco
NXP Employee
NXP Employee

Hi Martin,

 

Yep, you got us.  I confirmed your findings on the 9.2 CodeWarrior for mobileGT and saw that the value of pCMS_Heap does not change when running with D-Cache enabled.  Clearing HID0[DCE] (bit 17) disables the D-Cache and allows the variable to be updated in the debugger.  We'll have to look at the simulator used for this project and see what we can do to fix it but for now I recommend disabling D-Cache when using the simulator.  Thanks for pointing this out!  Another opportunity to improve our products.  And an excellent test case, BTW.  Made it really easy to see what you were talking about.  Thanks for that.

 

Regards,

Ron

0 Kudos
Reply

411 Views
martinw
Contributor III

Hi Ron,

 

Glad to be of assistance.

 

It's also great to know that the forum is being monitored for issues like this.

 

Cheers


Martin

0 Kudos
Reply