[En-Nut-Discussion] Thread Stack High-Tide Monitor

Jared Broad jared.broad at infact.co.nz
Sun Sep 30 23:43:13 CEST 2007


Hello List,

Following up on my earlier post regarding monitoring the thread stack I
thought I would post our solution. The following code is a high-tide
mark tester which fills the buffer with 0xFEEDABBA and then when the
stack check routine is called it counts the instances of this code and
displays a percentage used.

Application.c 
=> This routine needs to be included in your application
=> TRACE() is our RS232 comm's routine, you can delete/replace with your
own.
=>This function counts the number of FEEDABBA's
=> Our application will use this routine to return true if stack is OK.

Nut\arch\avr\os\ context_gcc.c
=> Insert new file, rebuild NutOS.
=> Provides global for stack test to access number of threads
=> Generates initial 0xFEEDABBA buffer

Courtesy of Dave Marshall & Jared Broad =)

Regards,

Jared



More information about the En-Nut-Discussion mailing list