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;}
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