KRNL - Debugging - breakout functions

under construction

Krnl has a number of breakoutfunctions you can overrule with your own code.

They are called at events like

  • task shift - k_breakout

  • semaphore call k_sem_no_clip

and so for

The k_breakout function is considered as the most important and relevant because you can trace task shifts

See debug.html for some examples

The calls are here See debug.html for how to install you own instead of these without editing in the krnl source

Debug can be removed at compile time by commenting out KRNLBUG define in krnl.h

// defined as weak so compiler will take yours instead of mine

// Default weak debug functions do nothing
// k_malloc and k_free is operational allthough k_free do not release memory

void __attribute__ ((weak)) k_breakout (void)
{
}

void __attribute__ ((weak)) k_sem_clip (unsigned char nr, int nrClip)
{
}

void __attribute__ ((weak)) k_sem_signal (unsigned char nr, int semVal)
{
}

void __attribute__ ((weak)) k_sem_wait (unsigned char nr, int semVal)
{
}


void __attribute__ ((weak)) k_send_Q_clip (unsigned char nr, int nrClip)
{
}

#endif

#ifdef DYNMEMORY
void * __attribute__ ((weak)) k_malloc(int k)
{
void * m;
  DI();
  m = malloc(k);
  EI();
  return m;
}

void __attribute__ ((weak)) k_free (void *m)
{
// no code bq real people do not free memory in a real time system due to
// danger for fragmentation of vacant memory
}
#endif


// The wdt is reset in the timerinterrupt in krnl (krnl tick ISR)

#ifdef WDT_TIMER
void __attribute__ ((weak)) k_enable_wdt(void)
{
  DI();
  wdt_enable(WDT_PERIOD);
  EI();
}
#endif