STEPHANE REY

Memory overlapping !!!

Discussion created by STEPHANE REY on Aug 21, 2007
Latest reply on Aug 24, 2007 by STEPHANE REY
Hi there,
 
I've seen twice a memory overlap made by the compiler/linker, without warning... The second one is critical as I don't find a workaround for that
 
I'm using both CW3.1 and CW5.9
 
1. First bug
---------------
I'm setting an array at a specified memory adress like that :
 
Code:
char u8CopyRamToFlash [FLASH_PAGE_SIZE] @0x000000CB = {0};

 I'm using a HC08QB8 and if there is no RAM left, then the linker put variables inside the u8CopyRamToFlash  array without warning
 
Workaround : check al lthe time that there is no overlapping due to RAM size limitation
 
 
 
 
2. Second bug : critical no workaround found
----------------------------------------------------------
I'm using then HCS08AW.
I've the folowing code :

 
Code:
void GLCD_Printf (char *au8Text, FONT_DEF *stFont, char u8Type) { while(*au8Text != 0) {  LcdPutchar (*au8Text, stFont, u8Type);  au8Text++; }}void LcdPutchar (char u8Char, FONT_DEF *stFont, char u8Type){ char u8CharColumn=0,u8RightSide=0;       ....}

First of all the function GLCD_Printf() was working perfectly on 8051 and works until the second character is displayed with HCS08AW.
 
*au8Text is the pointer to an array with undefined size, pushed in the stack at adress 0x084A. It contains the adress of the array 0x0838. In this location I can find the data 0x04 0x05 0x05 which is normal.
 
Once jumping into LcdPutChar, then the first line is u8CharColomn=0 and this variable is located in 0x083A which overlaps the au8Text....
Again, this issue come after the second displayed character
 
And there I don't find any workaround...
 
Any suggestion highly appreciated. Automotive customers are waiting their prototypes....
Best regards
Stephane Rey
 
 

Outcomes