Ejemplo n.º 1
0
void AnalyzeMemory(uint8_t **largest_begin,uint16_t *largest_size)
{
   uint8_t *memptr, *endptr, *section_begin;
   uint16_t section_size;
   
   *largest_size=0;
   memptr = *largest_begin = EndOfUsedMem();
   endptr = GetStackPtr();

   while(memptr < endptr)
   {
     if (*memptr == ((uint16_t)memptr & 0xFF))
     {
       section_begin = memptr;
       while(1)
    {
           memptr++;
           //*largest_begin = (uint8_t *) 1;
       if ((*memptr != ((uint16_t)memptr & 0xFF)) || (memptr == endptr-1)) 
        {
            //*largest_begin = (uint8_t *) 2;
           if ((section_size =  (memptr - section_begin)) > *largest_size)
        {
           *largest_size = section_size;
           *largest_begin = section_begin;
        }
           break;
        }
    } /* while(1) */
      }
      memptr++;
    } /* while(memptr < endptr) */
}
Ejemplo n.º 2
0
void InitializeMemory()
{
   uint8_t *memptr;
   
   for(memptr = EndOfUsedMem(); memptr < GetStackPtr(); memptr++)
      *memptr = (uint16_t)memptr & 0xFF;   
}