CW9.2 simulator for MobileGT ppc, possibly strange behaviour

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

CW9.2 simulator for MobileGT ppc, possibly strange behaviour

1,292 次查看
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
标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

437 次查看
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 项奖励
回复

437 次查看
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 项奖励
回复